File tree Expand file tree Collapse file tree
Examples/ServiceExamples/Scripts
Scripts/Services/SpeechToText/v1 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ public bool Active
182182 _speechToText . EnableWordConfidence = true ;
183183 _speechToText . EnableTimestamps = true ;
184184 _speechToText . SilenceThreshold = 0.01f ;
185- _speechToText . MaxAlternatives = 0 ;
185+ _speechToText . MaxAlternatives = 1 ;
186186 _speechToText . EnableInterimResults = true ;
187187 _speechToText . OnError = OnError ;
188188 _speechToText . InactivityTimeout = - 1 ;
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ public bool Active
102102 _service . EnableWordConfidence = true ;
103103 _service . EnableTimestamps = true ;
104104 _service . SilenceThreshold = 0.01f ;
105- _service . MaxAlternatives = 0 ;
105+ _service . MaxAlternatives = 1 ;
106106 _service . EnableInterimResults = true ;
107107 _service . OnError = OnError ;
108108 _service . InactivityTimeout = - 1 ;
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ public bool Active
108108 _service . EnableWordConfidence = true ;
109109 _service . EnableTimestamps = true ;
110110 _service . SilenceThreshold = 0.01f ;
111- _service . MaxAlternatives = 0 ;
111+ _service . MaxAlternatives = 1 ;
112112 _service . EnableInterimResults = true ;
113113 _service . OnError = OnError ;
114114 _service . InactivityTimeout = - 1 ;
Original file line number Diff line number Diff line change @@ -1298,7 +1298,6 @@ private SpeechRecognitionEvent ParseRecognizeResponse(IDictionary resp)
12981298 if ( ialternative . Contains ( "word_confidence" ) )
12991299 {
13001300 IList iconfidence = ialternative [ "word_confidence" ] as IList ;
1301-
13021301 WordConfidence [ ] confidence = new WordConfidence [ iconfidence . Count ] ;
13031302 for ( int i = 0 ; i < iconfidence . Count ; ++ i )
13041303 {
@@ -1308,7 +1307,9 @@ private SpeechRecognitionEvent ParseRecognizeResponse(IDictionary resp)
13081307
13091308 WordConfidence wc = new WordConfidence ( ) ;
13101309 wc . Word = ( string ) iwordconf [ 0 ] ;
1311- wc . Confidence = ( double ) iwordconf [ 1 ] ;
1310+ string wordConf = iwordconf [ 1 ] . ToString ( ) ;
1311+ double . TryParse ( wordConf , out double wordConfDouble ) ;
1312+ wc . Confidence = wordConfDouble ;
13121313 confidence [ i ] = wc ;
13131314 }
13141315
You can’t perform that action at this time.
0 commit comments