简体   繁体   中英

LoadGrammar(New Grammar(VOCABULARIO)) error

My form:

Error in this line:

REC.LoadGrammar(New Grammar(VOCABULARIO))

???????

Thanks.

Imports System.Speech.Recognition
Imports System.Threading
Imports System.Globalization



Public Class Form1

    Dim REC As New SpeechRecognitionEngine
    Dim PALABRA As String

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Thread.CurrentThread.CurrentCulture = New CultureInfo("pt-BR")
        REC.RequestRecognizerUpdate()
        REC.SetInputToDefaultAudioDevice()
        Dim VOCABULARIO As New GrammarBuilder
        VOCABULARIO.Append(New Choices("cc", "web", "word", "paint"))

        REC.LoadGrammar(New Grammar(VOCABULARIO))
        REC.RecognizeAsync(RecognizeMode.Multiple)
        AddHandler REC.SpeechRecognized, AddressOf RECONOCE
        AddHandler REC.SpeechRecognitionRejected, AddressOf NORECONOCE
    End Sub

    Public Sub RECONOCE(ByVal sender As Object, ByVal e As SpeechRecognizedEventArgs)

        Dim RESULTADO As RecognitionResult = e.Result
        Label1.Text = RESULTADO.Text.ToUpper
        Dim PROCESO As New Process
        Select Case RESULTADO.Text

            Case "cc"
                PROCESO.StartInfo.FileName = "C:\Program Files (x86)\Adobe\Adobe Dreamweaver CC 2014\Dreamweaver.exe"
                PROCESO.Start()
            Case "web"
                PROCESO.StartInfo.FileName = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
                PROCESO.Start()
            Case "word"
                PROCESO.StartInfo.FileName = "C:\Program Files\Windows NT\Accessories\wordpad.exe"
                PROCESO.Start()
            Case "paint"
                PROCESO.StartInfo.FileName = "C:\Windows\System32/mspaint.exe"
                PROCESO.Start()
        End Select

    End Sub

    Public Sub NORECONOCE()
        Label1.Text = "Repita, por favor!"
    End Sub

End Class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM