2017-12-10 30 views
0

が、私はこのコードを使用して、私のiOSアプリで音声認識を実装しています(xamarin):それはフランス語以外は非常にうまく機能しIOSの認識言語を変更するには?

// Setup audio session 
     var node = AudioEngine.InputNode; 
     var recordingFormat = node.GetBusOutputFormat (0); 
     node.InstallTapOnBus (0, 1024, recordingFormat, (AVAudioPcmBuffer buffer, AVAudioTime when) => { 
      // Append buffer to recognition request 
      LiveSpeechRequest.Append (buffer); 
     }); 

     // Start recording 
     AudioEngine.Prepare(); 
     NSError error; 
     AudioEngine.StartAndReturnError (out error); 

     // Did recording start? 
     if (error != null) { 
      // Handle error and return 
      return; 
     } 

     // Start recognition 
     RecognitionTask = SpeechRecognizer.GetRecognitionTask (LiveSpeechRequest, (SFSpeechRecognitionResult result, NSError err) => { 
      // Was there an error? 
      if (err != null) { 
       // Handle error 
      } else { 
       // Is this the final translation? 
       //if (result.Final) { 
        Console.WriteLine ("You said \"{0}\".", result.BestTranscription.FormattedString); 
       //} 
      } 
     }); 

が認識されていない、私はフランス語で自分の携帯電話を置くが、それは動作しません。 。どこかに設定する引数はありますか?

答えて

0

いくつかの検索の後、私はSpeechRecognizerオブジェクトを初期化するとき、「ロケール」はそのように、定義することができることを見出した。

private SFSpeechRecognizer SpeechRecognizer = new SFSpeechRecognizer (new NSLocale ("fr_FR")); 

それは働きます!

関連する問題