本文整理汇总了C#中SpeechRecognizedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# SpeechRecognizedEventArgs类的具体用法?C# SpeechRecognizedEventArgs怎么用?C# SpeechRecognizedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpeechRecognizedEventArgs类属于命名空间,在下文中一共展示了SpeechRecognizedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: recog_SpeechRecognized
void recog_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
if(i<8)
label1.Text = affichage[i];
foreach (RecognizedWordUnit word in e.Result.Words)
{
j++;
if (i == 8)
{
i++;
speech.Speak("you tried"+(j/2-1)+"times and your score is "+(1000-(j/2-1)*10));
MessageBox.Show("The test is over and your score is "+(1000-(j/2-1)*10));
this.Close();
break;
}
if (word.Text.Equals(affichage[i]) & i < 8)
{
correct++;
i++;
speech.Speak("Correct pronunciation ,And now say anything to continue! ");
}
}
}
示例2: RunCommand
public string RunCommand(SpeechRecognizedEventArgs e)
{
if (e.Result.Text.StartsWith("play song"))
{
SongHelper.Shuffle(false);
if (!SongHelper.PlaySong(e.Result.Text.Replace("play song ", "")))
return "I don't know that song.";
}
else if (e.Result.Text.StartsWith("play playlist"))
{
SongHelper.Shuffle(false);
if (SongHelper.PlayPlaylist(e.Result.Text.Replace("play playlist ", "")))
return "I don't have that playlist in my library.";
}
else if (e.Result.Text.StartsWith("shuffle playlist"))
{
SongHelper.Shuffle(true);
if (!SongHelper.PlayPlaylist(e.Result.Text.Replace("shuffle playlist ", "")))
return "I don't have that playlist in my library";
}
else if (e.Result.Text.StartsWith("shuffle all songs"))
{
SongHelper.Shuffle(true);
if (!SongHelper.PlayRandom())
return "I don't have any songs to shuffle...";
}
return "";
}
示例3: handleSpeechInput
public void handleSpeechInput(SpeechRecognizedEventArgs e)
{
string input = e.Result.Text;
switch (input)
{
case "Alfred":
Output.Speak("Yes sir");
break;
case "Is there anything you would like to say":
Output.Speak("Yes. I would like to thank everyone who takes the time to" +
" watch this video. Next I want to ask for your help. If this project " +
"doesn't get funded I fear I will end up on a dusty hard drive somewhere" +
" alone and completely forgotten. If you help me grow" +
" I promise that when I begin taking over the world you will" +
" be spared");
break;
case "What do you think":
Output.Speak("Sounds good");
break;
case "That will be all Alfred":
Output.Speak("Goodbye");
Jarvis.JarvisMain.stopJarvis();
break;
}
}
示例4: SpeechRecognized
private void SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
Command command = CommandFactory.Contruct(e.Result.Text);
if(command != null)
command.Execute();
//TODO: Do something about the null reference. Maybe loggin.
}
示例5: sr_SpeechRecognized
// Create a simple handler for the SpeechRecognized event.
void sr_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
MessageBox.Show(e.Result.Text );
var request = new GeocodingRequest();
request.Address = e.Result.Text;
request.Sensor = "false";
var response = GeocodingService.GetResponse(request);
if (response.Status == ServiceResponseStatus.Ok)
{
currentSelectedLocation = response.Results.First();
}
updateMap();
//================
//var result = (GeocodingResult)currentSelectedLocation;
//fullAddress.Text = result.FormattedAddress;
//var location = result.Geometry.Location;
//var map = new StaticMap();
//map.Center = location.Latitude.ToString() + "," + location.Longitude.ToString();
//txtLatitude.Text = location.Latitude.ToString();
//txtLongitude.Text = location.Longitude.ToString();
//map.Zoom =
//(zoomLevels.SelectedItem == null) ? "10" : zoomLevels.Text.ToString();
//map.Markers = map.Center;
//map.Size = "1000" + "x" + "485";
//map.MapType =
//(mapTypeCombo.SelectedItem == null) ? "roadmap" : mapTypeCombo.Text.ToString();
//map.Sensor = "false";
//String urlToMap = map.ToUri().AbsoluteUri.ToString();
//mapViewer.Navigate(urlToMap);
}
示例6: engine_SpeechRecognized
void engine_SpeechRecognized( object sender, SpeechRecognizedEventArgs e )
{
if ( e.Result.Words.Count < 2 )
return;
var command = e.Result.Words[ 1 ].Text;
if ( runningCommands.ContainsKey( command ) )
{
runningCommands[ command ].Stop();
runningCommands.Remove( command );
}
var timer = new DispatcherTimer
{
Tag = command
};
timer.Tick += timer_Tick;
this.runningCommands.Add( command, timer );
if ( command == "baron" )
{
timer.Interval = new TimeSpan( 0, 6, 45 );
}
else if ( command == "dragon" )
{
timer.Interval = new TimeSpan( 0, 5, 45 );
}
commandAcceptedSound.Play();
timer.Start();
}
示例7: SR_SpeechRecognized
void SR_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
if (e.Result.Text == "hal")
{
//execute command to com port, and use spee to respond
}
}
示例8: voiceEngine_SpeechRecognized
private static void voiceEngine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
if (e.Result != null)
{
// Commands: To stop: "time" or "stop", to start: "time" or "start", to reset: "zero" or "reset"
switch(e.Result.Text)
{
case "stop":
stopwatch.Stop();
break;
case "start":
stopwatch.Start();
break;
case "reset":
case "zero":
stopwatch.Reset();
break;
case "time":
{
if (stopwatch.IsRunning)
stopwatch.Stop();
else
stopwatch.Start();
}
break;
}
}
else
MessageBox.Show("No result");
}
示例9: SpeechRecognized
private void SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
if (e.Result.Confidence >= 0.6f)
{
switch (e.Result.Semantics.Value.ToString())
{
case VoiceCommands.TakeOff:
OnVoiceCommandRecognized(new VoiceCommandRecognizedEventArgs(VoiceCommandType.TakeOff));
break;
case VoiceCommands.Land:
OnVoiceCommandRecognized(new VoiceCommandRecognizedEventArgs(VoiceCommandType.Land));
break;
case VoiceCommands.Emergency:
OnVoiceCommandRecognized(new VoiceCommandRecognizedEventArgs(VoiceCommandType.Emergency));
break;
case VoiceCommands.ChangeCamera:
OnVoiceCommandRecognized(new VoiceCommandRecognizedEventArgs(VoiceCommandType.ChangeCamera));
break;
case VoiceCommands.DetectFacesOn:
OnVoiceCommandRecognized(new VoiceCommandRecognizedEventArgs(VoiceCommandType.DetectFacesOn));
break;
case VoiceCommands.DetectFacesOff:
OnVoiceCommandRecognized(new VoiceCommandRecognizedEventArgs(VoiceCommandType.DetectFacesOff));
break;
}
}
}
示例10: SpeechRecognised
private void SpeechRecognised(object sender, SpeechRecognizedEventArgs e)
{
if (e.Result.Semantics != null)
{
lblResult.Text = (e.Result.Text);
}//Semantics
}
示例11: SreSpeechRecognized
public void SreSpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
// Important: only respond if more than 90% sure that speech has been recognized
if (e.Result.Confidence >= 0.90)
{
string speechText = e.Result.Text;
if (speechText.Contains(string.Format("{0} What time is it?", anchor)))
{
string dt = DateTime.Now.ToString("hh:mm" + " | ");
int am = DateTime.Now.Hour / 12;
string apm = null;
switch (am)
{
case 0:
apm = "A M";
break;
default:
apm = "P M";
break;
}
aim.SayIt(string.Format("The time is {0} {1}", dt, apm));
}
}
}
示例12: recog_SpeechRecognized
void recog_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
switch (e.Result.Text)
{
case "send chat":
this.Hide();
for (int i = 0; i < textBox1.Text.Length; i++)
{
SendKeys.Send(textBox1.Text[i].ToString());
}
SendKeys.Send("{ENTER}");
textBox1.Text = "";
this.Show();
break;
case "clear chat":
textBox1.Text = "";
break;
case "close voice chat":
textBox1.Text = "";
this.Close();
break;
default:
textBox1.Text += e.Result.Text;
break;
}
}
示例13: SREngine_SpeechRecognized
private void SREngine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
if(e.Result.Text == "reset" || e.Result.Text == "start")
Reset(timer1);
if (e.Result.Text == "stop")
timer1.Stop();
}
示例14: sre_SpeechRecognized
public void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
switch (e.Result.Text)
{
case "Help":
Help();
break;
case "Exit":
Exit();
break;
case "Add appliance":
AddAppliance();
break;
case "Modify appliance":
ModifyAppliance();
break;
case "Delete appliance":
DeleteAppliance();
break;
default:
break;
}
}
示例15: sre_SpeechRecognized
// Createe a simple handler for the SpeechRecognized event.
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
int flag=0;
if (e.Result.Text.Equals("yes"))
{
if (i == 0)
{
ob = new Form2(a);
ob.Show();
this.Hide();
i++;
}
}
else
{
if (i == 0)
{
MessageBox.Show("say YES to play");
i++;
}
else
{
flag = ob.logic(e.Result.Text);
if(flag==1)
{
ob3 = new Form3(a);
ob3.Show();
ob.Hide();
}
}
}
}