通过c#中的语音搜索网络

编程入门 行业动态 更新时间:2024-10-10 04:28:48
本文介绍了通过c#中的语音搜索网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好,我有一个问题......当我说搜索+我想搜索的东西(通过语音)时,我怎么能搜索一些东西,(也许是谷歌?)。请帮助我,我完整卡住:P,到目前为止查看我的代码...

Hello guys,i have a question...How can i search something when i say "search for" + the thing i wanna search (via speech),(maybe in google?).Please help me,i am completly stuck :P,look my code so far...

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Speech.Recognition; using System.Speech.Synthesis; using System.IO; namespace JARVIStest { public partial class Form1 : Form { SpeechRecognitionEngine _recognizer = new SpeechRecognitionEngine(); SpeechSynthesizer JARVIS = new SpeechSynthesizer(); string QEvent; int count = 1; Random rnd = new Random(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { _recognizer.SetInputToDefaultAudioDevice(); _recognizer.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(File.ReadAllLines(@"C:\Users\Cpyros\Desktop\lefteris\Commands.txt"))))); _recognizer.SpeechRecognized += new EventHandler<speechrecognizedeventargs>(_recognizer_SpeechRecognized); _recognizer.RecognizeAsync(RecognizeMode.Multiple); } void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { int ranNum = rnd.Next(1, 10); string speech = e.Result.Text; switch (speech) { //GREETINGS case "hello": case "hello jarvis": if (ranNum < 6) { JARVIS.Speak("Hello sir"); } else if (ranNum > 5) { JARVIS.Speak("Hi"); } break; case "goodbye": case "goodbye jarvis": case "close": case "close jarvis": JARVIS.Speak("Until next time"); Close(); break; case "jarvis": if (ranNum < 5) { QEvent = ""; JARVIS.Speak("Yes sir"); } else if (ranNum > 4) { QEvent = ""; JARVIS.Speak("Yes?"); } break;

这里我想添加一个案例搜索或搜索谷歌

here i wanna add a case "search for" or "search google"

推荐答案

developers.google。 com / image-search / v1 / devguide [ ^ 阅读本文pLease developers.google/image-search/v1/devguide[^] Read This Article pLease

更多推荐

通过c#中的语音搜索网络

本文发布于:2023-11-28 19:27:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643665.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语音   网络

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!