2017-12-10 10 views
0

가이 코드를 사용하여 내 iOS 앱에 음성 인식을 구현하고있어 (자 마린) : 그것은 그 프랑스어 제외하고는 아주 잘 작동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")); 

의미가 있습니다!