Add hotwords support to .Net (#689)
This commit is contained in:
41
dotnet-examples/offline-decode-files/run-hotwords.sh
Executable file
41
dotnet-examples/offline-decode-files/run-hotwords.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [ ! -d ./sherpa-onnx-zipformer-en-2023-04-01 ]; then
|
||||
wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||
tar xvf sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||
rm sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||
fi
|
||||
|
||||
if [ ! -f ./sherpa-onnx-zipformer-en-2023-04-01/hotwords_en.txt ]; then
|
||||
cat >./sherpa-onnx-zipformer-en-2023-04-01/hotwords_en.txt <<EOF
|
||||
▁ QUA R TER S
|
||||
▁FOR E VER
|
||||
EOF
|
||||
fi
|
||||
|
||||
dotnet run \
|
||||
--tokens=./sherpa-onnx-zipformer-en-2023-04-01/tokens.txt \
|
||||
--encoder=./sherpa-onnx-zipformer-en-2023-04-01/encoder-epoch-99-avg-1.onnx \
|
||||
--decoder=./sherpa-onnx-zipformer-en-2023-04-01/decoder-epoch-99-avg-1.onnx \
|
||||
--joiner=./sherpa-onnx-zipformer-en-2023-04-01/joiner-epoch-99-avg-1.onnx \
|
||||
--num-threads=2 \
|
||||
--decoding-method=modified_beam_search \
|
||||
--files ./sherpa-onnx-zipformer-en-2023-04-01/test_wavs/0.wav \
|
||||
./sherpa-onnx-zipformer-en-2023-04-01/test_wavs/1.wav
|
||||
|
||||
dotnet run \
|
||||
--hotwords-file=./sherpa-onnx-zipformer-en-2023-04-01/hotwords_en.txt \
|
||||
--hotwords-score=2.0 \
|
||||
--tokens=./sherpa-onnx-zipformer-en-2023-04-01/tokens.txt \
|
||||
--encoder=./sherpa-onnx-zipformer-en-2023-04-01/encoder-epoch-99-avg-1.onnx \
|
||||
--decoder=./sherpa-onnx-zipformer-en-2023-04-01/decoder-epoch-99-avg-1.onnx \
|
||||
--joiner=./sherpa-onnx-zipformer-en-2023-04-01/joiner-epoch-99-avg-1.onnx \
|
||||
--num-threads=2 \
|
||||
--decoding-method=modified_beam_search \
|
||||
--files ./sherpa-onnx-zipformer-en-2023-04-01/test_wavs/0.wav \
|
||||
./sherpa-onnx-zipformer-en-2023-04-01/test_wavs/1.wav
|
||||
|
||||
# 0.wav: QUARTER -> QUARTERS
|
||||
# 1.wav: FOR EVER -> FOREVER
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [ ! -d ./sherpa-onnx-nemo-ctc-en-conformer-medium ]; then
|
||||
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-medium
|
||||
cd sherpa-onnx-nemo-ctc-en-conformer-medium
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [ ! -d ./sherpa-onnx-paraformer-zh-2023-03-28 ]; then
|
||||
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28
|
||||
cd sherpa-onnx-paraformer-zh-2023-03-28
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [ ! -d ./sherpa-onnx-tdnn-yesno ]; then
|
||||
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-tdnn-yesno
|
||||
cd sherpa-onnx-tdnn-yesno
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [ ! -d ./sherpa-onnx-whisper-tiny.en ]; then
|
||||
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-whisper-tiny.en
|
||||
cd sherpa-onnx-whisper-tiny.en
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
|
||||
set -ex
|
||||
|
||||
if [ ! -d ./sherpa-onnx-zipformer-en-2023-04-01 ]; then
|
||||
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-zipformer-en-2023-04-01
|
||||
cd sherpa-onnx-zipformer-en-2023-04-01
|
||||
git lfs pull --include "*.onnx"
|
||||
cd ..
|
||||
wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||
tar xvf sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||
rm sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
|
||||
fi
|
||||
|
||||
dotnet run \
|
||||
|
||||
Reference in New Issue
Block a user