none
Reconhecimento de voz em português-brasil RRS feed

  • Pergunta

  • Olá amigos, boa noite

    Poderiam me ajudar? Eu estou com um código aqui, que não tem erros, mas também não funciona

    Option Strict On
    
    Imports System.Speech
    Imports System.Speech.Recognition
    Imports System.Speech.Recognition.SrgsGrammar
    
    Public Class Form1
    
        Dim WithEvents reco As New SpeechRecognitionEngine
        Dim synth As New Synthesis.SpeechSynthesizer
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            Try
    
                Dim gram As New SrgsDocument
                Dim colorRule As New SrgsRule("color")
                Dim colorsList As New SrgsOneOf("red", "green")
    
                colorRule.Add(colorsList)
                gram.Rules.Add(colorRule)
                gram.Root = colorRule
                reco.LoadGrammarAsync(New Recognition.Grammar(gram))
                reco.SetInputToDefaultAudioDevice()
                reco.RecognizeAsync(RecognizeMode.Multiple)
    
            Catch s As Exception
                MessageBox.Show(s.Message)
            End Try
    
    
        End Sub
    
        Private Sub reco_SpeechDetected(ByVal sender As Object, ByVal e As System.Speech.Recognition.SpeechDetectedEventArgs) Handles reco.SpeechDetected
            Label1.Text = "Voz detectada"
        End Sub
    
        Private Sub reco_SpeechRecognized(ByVal sender As Object, ByVal e As System.Speech.Recognition.RecognitionEventArgs) Handles reco.SpeechRecognized
            Select Case e.Result.Text
                Case "vermelho"
                    SetColor(Color.Red)
                Case "verde"
                    SetColor(Color.Lime)
            End Select
        End Sub
    
    
        Private Sub SetColor(ByVal color As System.Drawing.Color)
            reco.RecognizeAsyncCancel()
            reco.RecognizeAsyncStop()
            synth.Speak("mudando cor para " & color.ToString)
            Me.BackColor = color
            reco.RecognizeAsync(RecognizeMode.Multiple)
        End Sub
    
    End Class

    Porém, quando eu rodo o programa, aprece a seguinte mensagem: "Nenhum reconhecedor instalado"
    E eu também já estou executando em x86 e nada... Poderiam me ajudar a solucionar? Obrigado



    sábado, 27 de janeiro de 2018 22:41

Respostas