portsample
portsample

Reputation: 2112

Creating a project specific Vosk dictionary

I am working on an application which uses Vosk for speech recognition. I would like to create a dictionary for the application which contains only the trigger words and spoken numbers needed by the application. Using command line instructions found here: www.alphacephei.com/vosk/adaptation I was able to install Kaldi on my laptop. These are,

export KALDI_ROOT=`pwd`/kaldi
git clone https://github.com/kaldi-asr/kaldi
cd kaldi/tools
make
extras/install_opengrm.sh

However, I am having a problem building a dictionary using the provided commands. These are,

export PATH=$KALDI_ROOT/tools/openfst/bin:$PATH
export LD_LIBRARY_PATH=$KALDI_ROOT/tools/openfst/lib/fst
cd model
fstsymbols --save_osymbols=words.txt Gr.fst > /dev/null
farcompilestrings --fst_type=compact --symbols=words.txt --keep_symbols text.txt | \
ngramcount | ngrammake | \
fstconvert --fst_type=ngram > Gr.new.fst
mv Gr.new.fst Gr.fst

The problem occurs at "cd model" because there is no /model directory in the directory structure created during the Kaldi installation. Checking in my Vosk project, I find /models, but no /model directory either.

I have tried creating /model in /kaldi/tools and then running the above commands with no success. Please let me know what I am missing here. Thanks in advance.

Upvotes: 1

Views: 1925

Answers (1)

Scotrraaj Gopal
Scotrraaj Gopal

Reputation: 114

The command cd model in the docs is actually incomplete. To run this you have to cd into the directory where Gr.fst exists. This file usually exists in the directory <any model with dynamic graph>/graph.

  1. Head to https://alphacephei.com/vosk/models, download a model that supports dynamic vocabulary reconfiguration (usually small models do, big models don't).
  2. Unzip the folder
  3. Prepare a .txt file with words that your project relates to.
  4. Proceed with the steps mentioned in your second code snippet (with a slight modification to the cd model part)

Upvotes: 2

Related Questions