泰米尔语语音识别 [英] Speech Recognation For Tamil Language

查看:80
本文介绍了泰米尔语语音识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

泰米尔语 (英语) அம்மா). 我不知道,在语音识别中是否可以自定义任何方法?

Hi,

Since Microsoft Speech Recognation Supported Language not support Tamil Language. So, I'm trying to translate from English(Tanglish) to Tamil (words or letters). Here you can find my code getTranslatedText method will do the translation. The word or letter in English is not recognize in Speech Engine (Example, ammaa = அம்மா). I'm not aware, Is there any method to customize in Speech Recognization?

        void engine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            txtSpoken.Text += "\r" + getTranslatedText(e.Result.Text);
            scvText.ScrollToEnd();
        }

        private string getTranslatedText(string text)
        {
            ....code skipped....
            text = text.Replace("a", "அ");
            text = text.Replace("A", "ஆ");
            text = text.Replace("e", "எ");
            text = text.Replace("E", "ஏ");
            text = text.Replace("i", "இ");
            text = text.Replace("I", "ஈ");
            text = text.Replace("u", "உ");
            text = text.Replace("U", "ஊ");
            text = text.Replace("o", "ஒ");
            text = text.Replace("O", "ஓ");
            text = text.Replace("q", "ஃ");
            return text;
        }

谢谢,

推荐答案

Sharfudeen,

Hi Sharfudeen,

谢谢您在这里发布.

对于您的问题,由于不支持泰米尔语,因此 Microsoft语音识别支持的语言,因此我们不能直接使用它.您可以说英语,然后将英语翻译成泰米尔语.

For your question, due to the Tamil is not support in Microsoft Speech Recognition Supported Language, so we could not use it directly. You could speak English to text and then translate the English text to Tamil.

在设计器中.

请尝试以下代码.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Speech.Recognition;

namespace speech_to_text
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            button1.Text = "Click and then speak";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine();
            Grammar dictationGrammar = new DictationGrammar();
            recognizer.LoadGrammar(dictationGrammar);
            try
            {
                button1.Text = "Speak Now";
                recognizer.SetInputToDefaultAudioDevice();
                RecognitionResult result = recognizer.Recognize();
                List<string> list = new List<string>();
                foreach (var item in result.Text)
                {
                    list.Add(item.ToString());
                }
                string[] array = list.ToArray();
                for (int i = 0; i < array.Length; i++)
                {
                    switch (array[i])
                    {
                        case "a":
                            array[i] = "அ";
                            break;
                        case "A":
                            array[i] = "ஆ";
                            break;
                        case "e":
                            array[i] = "எ";
                            break;
                        case "E":
                            array[i] = "ஏ";
                            break;
                        case "i":
                            array[i] = "இ";
                            break;
                        case "I":
                            array[i] = "ஈ";
                            break;
                        case "u":
                            array[i] = "உ";
                            break;
                        case "U":
                            array[i] = "ஊ";
                            break;
                        case "o":
                            array[i] = "ஒ";
                            break;
                        case "O":
                            array[i] = "ஓ";
                            break;
                        case "q":
                            array[i] = "ஃ";
                            break;
                    }
                }
                foreach (var item in array)
                {
                    textBox1.Text += array;
                }             
            }
            catch (InvalidOperationException exception)
            {
                button1.Text = String.Format("Could not recognize input from default aduio device. Is a microphone or sound card available?\r\n{0} - {1}.", exception.Source, exception.Message);
            }
            finally
            {
                recognizer.UnloadAllGrammars();
            }
        }
    }
}

我希望这对您有用.

如果还有其他问题,请随时与我们联系.

If you have something else, please feel free to contact us.

最好的问候,

温迪


这篇关于泰米尔语语音识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆