Skip to content

Commit

Permalink
Merge pull request #3416 from lissyx/pr-3414
Browse files Browse the repository at this point in the history
.NET Client Binding Fix
  • Loading branch information
lissyx authored Dec 8, 2020
2 parents b3b9e26 + 1be44c6 commit 3e10163
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
15 changes: 15 additions & 0 deletions native_client/dotnet/DeepSpeechConsole/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ static void Main(string[] args)
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"));
}

Expand All @@ -65,6 +67,19 @@ static void Main(string[] args)
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))
Expand Down
5 changes: 3 additions & 2 deletions taskcluster/tc-asserts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions taskcluster/tc-netframework-ds-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ DS_BINARY_FILE="DeepSpeechConsole.exe"
ensure_cuda_usage "$2"

run_netframework_inference_tests

run_hotword_tests

0 comments on commit 3e10163

Please sign in to comment.