一个基于speech API5.1的通用语音识别类
来源:互联网 发布:小鬼斩数据 编辑:程序博客网 时间:2024/04/29 21:18
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SpeechLib;
using System.Windows.Forms;
namespace yincheng01@163.com
{
public class SpRecognition
{
public SpeechLib.ISpeechRecoGrammar isrg;
public SpeechLib.SpSharedRecoContextClass ssrContex = null;
public System.Windows.Forms.Control cDisplay;
public SpRecognition(string[] gh) //加载关键词
{
ssrContex = new SpSharedRecoContextClass();
isrg = ssrContex.CreateGrammar(0);
SpeechLib._ISpeechRecoContextEvents_RecognitionEventHandler recHandle =
new _ISpeechRecoContextEvents_RecognitionEventHandler(ContexRecognition);
ssrContex.Recognition += recHandle;
SpeechLib.ISpeechGrammarRule menuRule = isrg.Rules.Add("123", SpeechRuleAttributes.SRATopLevel | SpeechRuleAttributes.SRADynamic, 1);
object PropValue = "";
foreach (string ff in gh)
{
menuRule.InitialState.AddWordTransition(null, ff, " ", SpeechGrammarWordType.SGLexical, ff, 1, ref PropValue, 1.0F);
}
isrg.Rules.Commit();
isrg.CmdSetRuleState("123", SpeechRuleState.SGDSActive);
isrg.DictationLoad("", SpeechLoadOption.SLOStatic);
isrg.DictationSetState(SpeechRuleState.SGDSActive);
}
public void BeginRec(Control tbResult)
{
cDisplay = tbResult;
}
public void CloseRec()
{
ssrContex = null;
cDisplay = null;
}
private void ContexRecognition(int iIndex, object obj, SpeechLib.SpeechRecognitionType type, SpeechLib.ISpeechRecoResult result)
{
cDisplay.Text = result.PhraseInfo.GetText(0, -1, true);
}
}
}
类的调用
SpRecognition ff;
string[] dd={"尹成","华东","玉辉","};
ff = new SpRecognition(dd);
ff.BeginRec(richTextBox1);
ff.CloseRec();
- 一个基于speech API5.1的通用语音识别类
- VC++如何编写一个语音识别的类for Micosoft speech Api5.1
- 一个基于Windows Vista speech API5.3以及WPF技术的语音识别代码
- 一个基于Windows Vista speech API5.3以及WPF技术的语音朗读代码
- 一个基于c#3.0的开发基于vista下语音识别的通用类
- 一个基于c#3.0的开发基于2000/XP/2003下语音识别的通用类
- 一个通用的IBM viavoice语音识别语音朗读的接口,适用于基于IBM viavoice开发
- Deep Speech:端到端的语音识别
- Microsoft Speech SDK5.1 语音识别
- Speech.Recognition(语音识别)
- Siri 语音识别 Speech
- C#3.0基于 Speech.Recognition的grammerbuilder 语音识别定义模糊语法范例
- C#3.0基于 Speech.Recognition的SRGS 语音识别定义模糊语法范例
- 一个集成微软语音识别技术与语音朗读的类,基于Microsoft SpeechAPI5.1的开发
- 一个基于c#3.0的开发基于vista下语音朗读的通用类
- iOS 原生自带的离线语音识别---speech framework
- 隐马尔科夫模型 HMM 与 语音识别 speech recognition (1):名词解释
- 基于科大讯飞的语音识别
- 博客恢复更新
- c#哈希表
- 不错的而且是免费的跑马灯控件 -- jScroller
- RTC-5301错误的解决办法!
- 如何通过技术手段实现火车票实名制
- 一个基于speech API5.1的通用语音识别类
- 哈佛图书馆墙上的训言
- SPI协议简介 (转)(后面加了一些个人观点)
- C#判断硬盘上的文件是否存在方法
- 在vpc下安装Red Hat 9.0
- 她的脸红了
- 继电器原理
- Mess with innodb_thread_concurrency (mysql与多cpu)
- LiveJournal