Это приложение для распознавания голоса с помощью VB
/home/QmwHY3/prog.vb (1,17) : warning VBNC40056: The import 'System.Speech.Recognition' could not be found. /home/QmwHY3/prog.vb (7,38) : error VBNC30451: 'SpeechRecognizer' is not declared. It may be inaccessible due to its protection level.
Что я уже пробовал:
Imports System.Speech.Recognition Imports System.Threading Imports System.Globalization Public Class Form1 ' recogniser & grammar Dim recog As New SpeechRecognizer Dim gram As Grammar ' events Public Event SpeechRecognized As _ EventHandler(Of SpeechRecognizedEventArgs) Public Event SpeechRecognitionRejected As _ EventHandler(Of SpeechRecognitionRejectedEventArgs) ' word list Dim wordlist As String() = New String() {"Yes", "No", "Maybe", "ok", "hi"} ' word recognised event Public Sub recevent(ByVal sender As System.Object, _ ByVal e As RecognitionEventArgs) If (e.Result.Text = "Yes") Then Dim sapi sapi = CreateObject("sapi.spvoice") sapi.speak(" yes please tell") ElseIf (e.Result.Text = "No") Then Dim sapi sapi = CreateObject("sapi.spvoice") sapi.speak("ok") ElseIf (e.Result.Text = "Maybe") Then Dim sapi sapi = CreateObject("sapi.spvoice") sapi.speak("maybe you are right ") ElseIf (e.Result.Text = "hi") Then Dim sapi sapi = CreateObject("sapi.spvoice") sapi.speak("hello") End If End Sub ' recognition failed event Public Sub recfailevent(ByVal sender As System.Object, _ ByVal e As RecognitionEventArgs) End Sub ' form initialisation Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ' need these to get British English rather than default US Thread.CurrentThread.CurrentCulture = New CultureInfo("en-GB") Thread.CurrentThread.CurrentUICulture = New CultureInfo("en-GB") ' convert the word list into a grammar Dim words As New Choices(wordlist) gram = New Grammar(New GrammarBuilder(words)) recog.LoadGrammar(gram) ' add handlers for the recognition events AddHandler recog.SpeechRecognized, AddressOf Me.recevent AddHandler recog.SpeechRecognitionRejected, AddressOf Me.recfailevent ' enable the recogniser recog.Enabled = True End Sub End Class