commit
3e10163ec8
@ -37,12 +37,14 @@ namespace CSharpExamples
|
|||||||
string model = null;
|
string model = null;
|
||||||
string scorer = null;
|
string scorer = null;
|
||||||
string audio = null;
|
string audio = null;
|
||||||
|
string hotwords = null;
|
||||||
bool extended = false;
|
bool extended = false;
|
||||||
if (args.Length > 0)
|
if (args.Length > 0)
|
||||||
{
|
{
|
||||||
model = GetArgument(args, "--model");
|
model = GetArgument(args, "--model");
|
||||||
scorer = GetArgument(args, "--scorer");
|
scorer = GetArgument(args, "--scorer");
|
||||||
audio = GetArgument(args, "--audio");
|
audio = GetArgument(args, "--audio");
|
||||||
|
hotwords = GetArgument(args, "--hot_words");
|
||||||
extended = !string.IsNullOrWhiteSpace(GetArgument(args, "--extended"));
|
extended = !string.IsNullOrWhiteSpace(GetArgument(args, "--extended"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +67,19 @@ namespace CSharpExamples
|
|||||||
sttClient.EnableExternalScorer(scorer ?? "kenlm.scorer");
|
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";
|
string audioFile = audio ?? "arctic_a0024.wav";
|
||||||
var waveBuffer = new WaveBuffer(File.ReadAllBytes(audioFile));
|
var waveBuffer = new WaveBuffer(File.ReadAllBytes(audioFile));
|
||||||
using (var waveInfo = new WaveFileReader(audioFile))
|
using (var waveInfo = new WaveFileReader(audioFile))
|
||||||
|
@ -526,11 +526,12 @@ run_multi_inference_tests()
|
|||||||
|
|
||||||
run_hotword_tests()
|
run_hotword_tests()
|
||||||
{
|
{
|
||||||
|
DS_BINARY_FILE=${DS_BINARY_FILE:-"deepspeech"}
|
||||||
set +e
|
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=$?
|
status=$?
|
||||||
set -e
|
set -e
|
||||||
assert_correct_ldc93s1_lm "${hotwords_decode}" "$status"
|
assert_working_ldc93s1_lm "${hotwords_decode}" "$status"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_android_hotword_tests()
|
run_android_hotword_tests()
|
||||||
|
@ -29,3 +29,5 @@ DS_BINARY_FILE="DeepSpeechConsole.exe"
|
|||||||
ensure_cuda_usage "$2"
|
ensure_cuda_usage "$2"
|
||||||
|
|
||||||
run_netframework_inference_tests
|
run_netframework_inference_tests
|
||||||
|
|
||||||
|
run_hotword_tests
|
Loading…
Reference in New Issue
Block a user