@@ -122,6 +122,38 @@ private void TestAddCustomCorpus(string customizationID, string corpusName, bool
122
122
m_SpeechToText . AddCustomCorpus ( HandleAddCustomCorpus , customizationID , corpusName , allowOverwrite , trainingDataPath ) ;
123
123
}
124
124
125
+ private void TestGetCustomWords ( )
126
+ {
127
+ Log . Debug ( "ExampleSpeechToText" , "Attempting to get custom words." ) ;
128
+ m_SpeechToText . GetCustomWords ( OnGetCustomWords , m_CreatedCustomizationID ) ;
129
+ }
130
+
131
+ private void TestAddCustomWordsPath ( string customizationID , string wordsJsonPath )
132
+ {
133
+ Log . Debug ( "ExampleSpeechToText" , "Attempting to add custom words in customization {0} using Words json path {1}" , customizationID , wordsJsonPath ) ;
134
+ m_SpeechToText . AddCustomWords ( OnAddCustomWords , customizationID , wordsJsonPath ) ;
135
+ }
136
+
137
+ private void TestAddCustomWordsWordsObject ( string customizationID , Words words )
138
+ {
139
+ Log . Debug ( "ExampleSpeechToText" , "Attempting to add custom words in customization {0} using Words object" , customizationID ) ;
140
+ m_SpeechToText . AddCustomWords ( OnAddCustomWords , customizationID , words ) ;
141
+ }
142
+
143
+ private void TestDeleteCustomWord ( string customizationID , string word )
144
+ {
145
+ Log . Debug ( "ExampleSpeechToText" , "Attempting to delete custom word {1} in customization {0}" , customizationID , word ) ;
146
+ m_SpeechToText . DeleteCustomWord ( OnDeleteCustomWord , customizationID , word ) ;
147
+ }
148
+
149
+ private void TestGetCustomWord ( string customizationID , string word )
150
+ {
151
+ Log . Debug ( "ExampleSpeechToText" , "Attempting to get custom word {1} in customization {0}" , customizationID , word ) ;
152
+ m_SpeechToText . GetCustomWord ( OnGetCustomWord , customizationID , word ) ;
153
+ }
154
+
155
+
156
+
125
157
private void HandleGetModels ( Model [ ] models )
126
158
{
127
159
if ( models != null )
@@ -369,4 +401,68 @@ private void HandleAddCustomCorpus(bool success, string customData)
369
401
Log . Debug ( "ExampleSpeechToText" , "Failed to delete custom corpus!" ) ;
370
402
}
371
403
}
404
+
405
+ private void OnGetCustomWords ( WordsList wordList , string customData )
406
+ {
407
+ if ( ! string . IsNullOrEmpty ( customData ) )
408
+ Log . Debug ( "ExampleSpeechToText" , "custom data: {0}" , customData ) ;
409
+
410
+ if ( wordList != null )
411
+ {
412
+ if ( wordList . words != null && wordList . words . Length > 0 )
413
+ {
414
+ foreach ( WordData word in wordList . words )
415
+ Log . Debug ( "ExampleSpeechToText" , "WordData - word: {0} | sounds like: {1} | display as: {2}" , word . word , word . sounds_like , word . display_as ) ;
416
+ }
417
+ else
418
+ {
419
+ Log . Debug ( "ExampleSpeechToText" , "No custom words found!" ) ;
420
+ }
421
+ }
422
+ else
423
+ {
424
+ Log . Debug ( "ExampleSpeechToText" , "Failed to get custom words!" ) ;
425
+ }
426
+ }
427
+
428
+ private void OnAddCustomWords ( bool success , string customData )
429
+ {
430
+ if ( ! string . IsNullOrEmpty ( customData ) )
431
+ Log . Debug ( "ExampleSpeechToText" , "custom data: {0}" , customData ) ;
432
+
433
+ if ( success )
434
+ {
435
+ Log . Debug ( "ExampleSpeechToText" , "AddCustomWOrds() succeeded!" ) ;
436
+
437
+ }
438
+ else
439
+ {
440
+ Log . Debug ( "ExampleSpeechToText" , "Failed to add custom words!" ) ;
441
+ }
442
+ }
443
+
444
+ private void OnDeleteCustomWord ( bool success , string customData )
445
+ {
446
+ if ( ! string . IsNullOrEmpty ( customData ) )
447
+ Log . Debug ( "ExampleSpeechToText" , "custom data: {0}" , customData ) ;
448
+
449
+ if ( success )
450
+ {
451
+ Log . Debug ( "ExampleSpeechToText" , "DeleteCustomWord() succeeded!" ) ;
452
+
453
+ }
454
+ else
455
+ {
456
+ Log . Debug ( "ExampleSpeechToText" , "Failed to delete custom word!" ) ;
457
+ }
458
+ }
459
+
460
+ private void OnGetCustomWord ( WordData word , string customData )
461
+ {
462
+ if ( ! string . IsNullOrEmpty ( customData ) )
463
+ Log . Debug ( "ExampleSpeechToText" , "custom data: {0}" , customData ) ;
464
+
465
+ if ( word != null )
466
+ Log . Debug ( "ExampleSpeechToText" , "WordData - word: {0} | sounds like: {1} | display as: {2}" , word . word , word . sounds_like , word . display_as ) ;
467
+ }
372
468
}
0 commit comments