Hotword support for .NET client tests
This commit is contained in:
parent
b2920c7557
commit
948a232ae2
@ -37,12 +37,14 @@ namespace CSharpExamples
|
||||
string model = null;
|
||||
string scorer = null;
|
||||
string audio = null;
|
||||
string hotwords = null;
|
||||
bool extended = false;
|
||||
if (args.Length > 0)
|
||||
{
|
||||
model = GetArgument(args, "--model");
|
||||
scorer = GetArgument(args, "--scorer");
|
||||
audio = GetArgument(args, "--audio");
|
||||
hotwords = GetArgument(args, "--hot_words");
|
||||
extended = !string.IsNullOrWhiteSpace(GetArgument(args, "--extended"));
|
||||
}
|
||||
|
||||
@ -65,6 +67,19 @@ namespace CSharpExamples
|
||||
sttClient.EnableExternalScorer(scorer ?? "kenlm.scorer");
|
||||
}
|
||||
|
||||
if(hotwords != null)
|
||||
{
|
||||
Console.WriteLine($"Adding hot-words {hotwords}");
|
||||
char[] sep = {','};
|
||||
string[] word_boosts = hotwords.Split(sep);
|
||||
foreach(string word_boost in word_boosts)
|
||||
{
|
||||
char[] sep1 = {':'};
|
||||
string[] word = word_boost.Split(sep1);
|
||||
sttClient.AddHotWord(word[0], float.Parse(word[1]));
|
||||
}
|
||||
}
|
||||
|
||||
string audioFile = audio ?? "arctic_a0024.wav";
|
||||
var waveBuffer = new WaveBuffer(File.ReadAllBytes(audioFile));
|
||||
using (var waveInfo = new WaveFileReader(audioFile))
|
||||
|
@ -526,11 +526,12 @@ run_multi_inference_tests()
|
||||
|
||||
run_hotword_tests()
|
||||
{
|
||||
DS_BINARY_FILE=${DS_BINARY_FILE:-"deepspeech"}
|
||||
set +e
|
||||
hotwords_decode=$(${DS_BINARY_PREFIX}deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --scorer ${TASKCLUSTER_TMP_DIR}/kenlm.scorer --audio ${TASKCLUSTER_TMP_DIR}/${ldc93s1_sample_filename} --hot_words "foo:0.0,bar:-0.1" 2>${TASKCLUSTER_TMP_DIR}/stderr)
|
||||
hotwords_decode=$(${DS_BINARY_PREFIX}${DS_BINARY_FILE} --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --scorer ${TASKCLUSTER_TMP_DIR}/kenlm.scorer --audio ${TASKCLUSTER_TMP_DIR}/${ldc93s1_sample_filename} --hot_words "foo:0.0,bar:-0.1" 2>${TASKCLUSTER_TMP_DIR}/stderr)
|
||||
status=$?
|
||||
set -e
|
||||
assert_correct_ldc93s1_lm "${hotwords_decode}" "$status"
|
||||
assert_working_ldc93s1_lm "${hotwords_decode}" "$status"
|
||||
}
|
||||
|
||||
run_android_hotword_tests()
|
||||
|
@ -29,3 +29,5 @@ DS_BINARY_FILE="DeepSpeechConsole.exe"
|
||||
ensure_cuda_usage "$2"
|
||||
|
||||
run_netframework_inference_tests
|
||||
|
||||
run_hotword_tests
|
Loading…
Reference in New Issue
Block a user