سؤال

Is it possible to convert speech to text without using a web service? I have tried the following solution but the libraries aren't recognised in eclipse,http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207021(v=vs.105).aspx

I'm thinking there has to be a speech recognition API in Windows 8 RT? Does anyone have an implementation of speech recognition in this platform or point me in the right direction?

I'm guessing that these methods are not available on the Windows 8 RT platform,If so are there any alternatives?

I tried the following in an app bar button click event but none of the methods/namespaces are recognized.

            // Create an instance of SpeechRecognizerUI.
            this.recoWithUI = new SpeechRecognizerUI();

            // Start recognition (load the dictation grammar by default).
            SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync();

            // Do something with the recognition result.
            MessageBox.Show(string.Format("You said {0}.", recoResult.RecognitionResult.Text));
هل كانت مفيدة؟

المحلول

It looks like the SpeechRecognitionUI class is for Windows Phone 8.

For Windows 8 RT, Microsoft has the The Bing Speech Recognition Control and the class is called SpeechRecognizerUx.

The Bing Speech Recognition Control enables a Windows 8, Windows 8.1, or Windows RT machine to convert audio speech input to written text. It does this by receiving audio data from a microphone, sending the audio data to a web service for analysis, and then returning its best interpretations of user speech as text.

The one 'caveat' (if you don't wanna pay) is that this requires a subscription to Windows Azure Data Marketplace, although the free stuff is pretty generous IMO.

The Bing Speech Recognition Control is only available from the Visual Studio Gallery. To develop with the Bing Speech Recognition Control, you must first subscribe on the Windows Azure Data Marketplace, and then register your application. There is no cost to subscribe for the first 500,000 service calls per month.

Here's a code sample.

public MainPage()
{
    this.InitializeComponent();
    this.Loaded += MainPage_Loaded;
}

SpeechRecognizer SR;
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    // Apply credentials from the Windows Azure Data Marketplace.
    var credentials = new SpeechAuthorizationParameters();
    credentials.ClientId = "<YOUR CLIENT ID>";
    credentials.ClientSecret = "<YOUR CLIENT SECRET>";

    // Initialize the speech recognizer and attach to control.
    SR = new SpeechRecognizer("en-US", credentials);
    SpeechControl.SpeechRecognizer = SR;
}

private async void SpeakButton_Click(object sender, RoutedEventArgs e)
{
    try
    {
        // Start speech recognition.
        var result = await SR.RecognizeSpeechToTextAsync();
        ResultText.Text = result.Text;
    }
    catch (System.Exception ex)
    {
        ResultText.Text = ex.Message;
    }
}

Source: http://msdn.microsoft.com/en-us/library/dn434633.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-4

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top