GithubHelp home page GithubHelp logo

alphacep / vosk-api Goto Github PK

View Code? Open in Web Editor NEW
7.1K 114.0 1.0K 14.05 MB

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node

License: Apache License 2.0

C++ 2.99% Java 1.36% Shell 0.99% JavaScript 0.60% Python 1.08% Makefile 0.10% C# 0.52% C 0.65% Swift 0.21% Objective-C 0.01% Go 0.17% CMake 0.01% Ruby 0.02% Jupyter Notebook 88.85% Kotlin 2.43%
speech-recognition asr voice-recognition speech-to-text android ios raspberry-pi deep-learning deep-neural-networks speech-to-text-android

vosk-api's Introduction

Vosk Speech Recognition Toolkit

Vosk is an offline open source speech recognition toolkit. It enables speech recognition for 20+ languages and dialects - English, Indian English, German, French, Spanish, Portuguese, Chinese, Russian, Turkish, Vietnamese, Italian, Dutch, Catalan, Arabic, Greek, Farsi, Filipino, Ukrainian, Kazakh, Swedish, Japanese, Esperanto, Hindi, Czech, Polish. More to come.

Vosk models are small (50 Mb) but provide continuous large vocabulary transcription, zero-latency response with streaming API, reconfigurable vocabulary and speaker identification.

Speech recognition bindings implemented for various programming languages like Python, Java, Node.JS, C#, C++, Rust, Go and others.

Vosk supplies speech recognition for chatbots, smart home appliances, virtual assistants. It can also create subtitles for movies, transcription for lectures and interviews.

Vosk scales from small devices like Raspberry Pi or Android smartphone to big clusters.

Documentation

For installation instructions, examples and documentation visit Vosk Website.

vosk-api's People

Contributors

acro5piano avatar camillem avatar doomsdayrs avatar gauthiersornet avatar gmat avatar hviana avatar jbaber avatar jethrodaniel avatar johngebbie avatar jsbxyyx avatar kercre123 avatar lkiesow avatar mason-acronode avatar mmende avatar msqr1 avatar nalbion avatar nicodato avatar nnkalita avatar nshmyrev avatar peterkronenberg avatar proger avatar rbernon avatar sadrasabouri avatar scroot avatar sharcoux avatar sn4kebyte avatar sskorol avatar ththoma avatar tomymehdi avatar vadimdddd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vosk-api's Issues

Lookahead model only recognizes words from word list

I was able to get the lookahead model working, but it seems to recognize only words from the wordlist, for example, lets say I pass "one two three" and the person speaks my name is alpha and I can count to one two three, it produces wrong results because the words prior to one two three are also recognized as one two three. I wanted to implement a phrase hint system for example, perform normal asr but put more weight on words passed through a list.

Model conversion for lookahead?

Do we need to convert models trained for example using aspire, librispeech recipes to allow them to work with passing word list to lookahead

https://github.com/alphacep/vosk-api/blob/master/python/example/test_local_words.py

I have several tdnn models that I want to use with these api.

咨询

请问基于什么数据库训练的模型,是中文的语音识别模型么?

where is kaldi_recognizer_wrap.cc

CMakeLIsts.txt need the file named kaldi_recognizer_wrap.cc ,but i cant find it.

add_library( kaldi_jni SHARED
build/generated-src/cpp/kaldi_recognizer_wrap.cc
${API_SOURCES}
)

Cannot setup python package on Linux (Ubuntu 18.04)

Thank you for a great lib!
But I didn't get a chance to try it, because I can't install python module.

There were some errors during installation:

  1. During Kaldi installation, the command helps to install all necessary dependencies before "make -j 10".
    ./kaldi/tools./extras/check_dependencies.sh

  2. I had to install CMake 3.10.1 or higher.
    https://askubuntu.com/questions/829310/how-to-upgrade-cmake-in-ubuntu

  3. I tried to run sudo python3 setup.py install but got an error:

fatal error: Python.h: No such file or directory

I've added to CMakeLists.txt 2 lines and it worked for me.

find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})

*from here https://stackoverflow.com/questions/11041299/python-h-no-such-file-or-directory

  1. After that I installed required OpenFST as described here:
    https://aghriss.github.io/posts/2018/01/01/OpenFSTubuntu.html

  2. And a step with hack:
    copied folders from kaldi/src/ to vosk-api/src/.
    I am not sure, how to do it corect, but it helped me to move further.

  3. Now I have a lot of errors. The first is:
    /usr/bin/c++

-D_vosk_EXPORTS -I/usr/include/python3.5m -I/home/smartly/tmp/vosk-api/python/../src -I/src -I/tools/openfst/include -O3 -DFST_NO_DYNAMIC_LINKING -O3 -DNDEBUG -fPIC -o CMakeFiles/_vosk.dir/voskPYTHON_wrap.cxx.o -c /home/smartly/tmp/vosk-api/python/build/temp.linux-x86_64-3.5/voskPYTHON_wrap.cxx
In file included from /usr/include/c++/5/cstdint:35:0,
from /usr/local/include/fst/types.h:19,
from /home/smartly/tmp/vosk-api/python/../src/base/kaldi-types.h:44,
from /home/smartly/tmp/vosk-api/python/../src/base/kaldi-error.h:34,
from /home/smartly/tmp/vosk-api/python/../src/base/kaldi-common.h:35,
from /home/smartly/tmp/vosk-api/python/../src/kaldi_recognizer.h:1,
from /home/smartly/tmp/vosk-api/python/build/temp.linux-x86_64-3.5/voskPYTHON_wrap.cxx:3121:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support
^
In file included from /home/smartly/tmp/vosk-api/python/../src/base/kaldi-types.h:44:0,
from /home/smartly/tmp/vosk-api/python/../src/base/kaldi-error.h:34,
from /home/smartly/tmp/vosk-api/python/../src/base/kaldi-common.h:35,
from /home/smartly/tmp/vosk-api/python/../src/kaldi_recognizer.h:1,
from /home/smartly/tmp/vosk-api/python/build/temp.linux-x86_64-3.5/voskPYTHON_wrap.cxx:3121:
/usr/local/include/fst/types.h:24:7: error: expected nested-name-specifier before ‘int8’
using int8 = int8_t;
^
/usr/local/include/fst/types.h:25:7: error: expected nested-name-specifier before ‘int16’
using int16 = int16_t;

Can you please help me to fix it?

you may not have installed OpenFst. See ../tools/INSTALL ***

After the installation OK with OpenBLAS, errors comes when unzip and install fst. The error message is below:

Install OK!
make[1]: Leaving directory '/home/liuyi/Documents/VoiceAssist/vosk-api/android/build/kaldi_arm_64/OpenBLAS'
make: Leaving directory '/home/liuyi/Documents/VoiceAssist/vosk-api/android/build/kaldi_arm_64/OpenBLAS'

  • cd /home/liuyi/Documents/VoiceAssist/vosk-api/android/build/kaldi_arm_64

  • wget -c -T 10 -t 1 http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.6.7.tar.gz
    --2020-01-03 15:00:45-- http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.6.7.tar.gz
    Resolving www.openfst.org (www.openfst.org)... 206.196.111.47
    Connecting to www.openfst.org (www.openfst.org)|206.196.111.47|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1230836 (1.2M) [application/x-gzip]
    Saving to: ‘openfst-1.6.7.tar.gz’

    0K .......... .......... .......... .......... .......... 4% 571K 2s
    50K .......... .......... .......... .......... .......... 8% 1010K 2s
    100K .......... .......... .......... .......... .......... 12% 11.5M 1s
    150K .......... .......... .......... .......... .......... 16% 865K 1s
    200K .......... .......... .......... .......... .......... 20% 10.9M 1s
    250K .......... .......... .......... .......... .......... 24% 11.6M 1s
    300K .......... .......... .......... .......... .......... 29% 25.1K 5s
    350K .......... .......... .......... .......... .......... 33% 163M 4s
    400K ...... 33% 413 =17s

2020-01-03 15:01:13 (23.6 KB/s) - Read error at byte 415799/1230836 (Connection timed out). Giving up.

  • wget -c -T 10 -t 3 http://www.openslr.org/resources/2/openfst-1.6.7.tar.gz
    --2020-01-03 15:01:13-- http://www.openslr.org/resources/2/openfst-1.6.7.tar.gz
    Resolving www.openslr.org (www.openslr.org)... 46.101.158.64
    Connecting to www.openslr.org (www.openslr.org)|46.101.158.64|:80... connected.
    HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

  • tar -zxvf openfst-1.6.7.tar.gz
    openfst-1.6.7/
    openfst-1.6.7/ltmain.sh
    openfst-1.6.7/install-sh
    openfst-1.6.7/aclocal.m4
    openfst-1.6.7/missing
    openfst-1.6.7/ar-lib
    openfst-1.6.7/INSTALL
    openfst-1.6.7/COPYING
    openfst-1.6.7/README
    openfst-1.6.7/m4/
    openfst-1.6.7/m4/ltversion.m4
    openfst-1.6.7/m4/libtool.m4
    openfst-1.6.7/m4/ltoptions.m4
    openfst-1.6.7/m4/lt~obsolete.m4
    openfst-1.6.7/m4/ltsugar.m4
    openfst-1.6.7/m4/ac_python_devel.m4
    openfst-1.6.7/compile
    openfst-1.6.7/depcomp
    openfst-1.6.7/AUTHORS
    openfst-1.6.7/NEWS
    openfst-1.6.7/Makefile.in
    openfst-1.6.7/config.h.in
    openfst-1.6.7/configure.ac
    openfst-1.6.7/config.guess
    openfst-1.6.7/test-driver
    openfst-1.6.7/src/
    openfst-1.6.7/src/bin/
    openfst-1.6.7/src/bin/fstshortestpath-main.cc
    openfst-1.6.7/src/bin/fstprint.cc
    openfst-1.6.7/src/bin/fstcompile-main.cc
    openfst-1.6.7/src/bin/fstisomorphic.cc
    openfst-1.6.7/src/bin/fstcompose-main.cc
    openfst-1.6.7/src/bin/fstconnect-main.cc
    openfst-1.6.7/src/bin/fstprune.cc
    openfst-1.6.7/src/bin/fstinfo.cc
    openfst-1.6.7/src/bin/fstdraw.cc
    openfst-1.6.7/src/bin/fstprint-main.cc
    openfst-1.6.7/src/bin/fstunion.cc
    openfst-1.6.7/src/bin/fstrandgen-main.cc
    openfst-1.6.7/src/bin/fstrandgen.cc
    openfst-1.6.7/src/bin/fstsymbols-main.cc
    openfst-1.6.7/src/bin/fstepsnormalize-main.cc
    openfst-1.6.7/src/bin/fstpush.cc
    openfst-1.6.7/src/bin/fstconcat-main.cc
    openfst-1.6.7/src/bin/fstdeterminize-main.cc
    openfst-1.6.7/src/bin/fstencode-main.cc
    openfst-1.6.7/src/bin/fstmap.cc
    openfst-1.6.7/src/bin/fstisomorphic-main.cc
    openfst-1.6.7/src/bin/fstminimize-main.cc
    openfst-1.6.7/src/bin/fstreweight-main.cc
    openfst-1.6.7/src/bin/fstreplace-main.cc
    openfst-1.6.7/src/bin/fstarcsort-main.cc
    openfst-1.6.7/src/bin/fstdifference-main.cc
    openfst-1.6.7/src/bin/fstpush-main.cc
    openfst-1.6.7/src/bin/Makefile.in
    openfst-1.6.7/src/bin/fstsymbols.cc
    openfst-1.6.7/src/bin/fstepsnormalize.cc
    openfst-1.6.7/src/bin/fstconvert.cc
    openfst-1.6.7/src/bin/fstintersect-main.cc
    openfst-1.6.7/src/bin/fstshortestpath.cc
    openfst-1.6.7/src/bin/fstdifference.cc
    openfst-1.6.7/src/bin/fstconnect.cc
    openfst-1.6.7/src/bin/fstinvert-main.cc
    openfst-1.6.7/src/bin/fstequivalent-main.cc
    openfst-1.6.7/src/bin/fstequal-main.cc
    openfst-1.6.7/src/bin/fstclosure.cc
    openfst-1.6.7/src/bin/fstunion-main.cc
    openfst-1.6.7/src/bin/fstencode.cc
    openfst-1.6.7/src/bin/fstcompose.cc
    openfst-1.6.7/src/bin/fstprune-main.cc
    openfst-1.6.7/src/bin/fstminimize.cc
    openfst-1.6.7/src/bin/fsttopsort.cc
    openfst-1.6.7/src/bin/fstinvert.cc
    openfst-1.6.7/src/bin/fstproject-main.cc
    openfst-1.6.7/src/bin/fstintersect.cc
    openfst-1.6.7/src/bin/fstinfo-main.cc
    openfst-1.6.7/src/bin/fstreweight.cc
    openfst-1.6.7/src/bin/fstclosure-main.cc
    openfst-1.6.7/src/bin/fsttopsort-main.cc
    openfst-1.6.7/src/bin/fstcompile.cc
    openfst-1.6.7/src/bin/fstreplace.cc
    openfst-1.6.7/src/bin/fstconcat.cc
    openfst-1.6.7/src/bin/fstdisambiguate-main.cc
    openfst-1.6.7/src/bin/fstreverse-main.cc
    openfst-1.6.7/src/bin/fstproject.cc
    openfst-1.6.7/src/bin/fstsynchronize-main.cc
    openfst-1.6.7/src/bin/fstequivalent.cc
    openfst-1.6.7/src/bin/fstdraw-main.cc
    openfst-1.6.7/src/bin/fstrelabel.cc
    openfst-1.6.7/src/bin/fstarcsort.cc
    openfst-1.6.7/src/bin/fstdeterminize.cc
    openfst-1.6.7/src/bin/Makefile.am
    openfst-1.6.7/src/bin/fstconvert-main.cc
    openfst-1.6.7/src/bin/fstrelabel-main.cc
    openfst-1.6.7/src/bin/fstreverse.cc
    openfst-1.6.7/src/bin/fstdisambiguate.cc
    openfst-1.6.7/src/bin/fstshortestdistance.cc
    openfst-1.6.7/src/bin/fstshortestdistance-main.cc
    openfst-1.6.7/src/bin/fstequal.cc
    openfst-1.6.7/src/bin/fstrmepsilon.cc
    openfst-1.6.7/src/bin/fstsynchronize.cc
    openfst-1.6.7/src/bin/fstmap-main.cc
    openfst-1.6.7/src/bin/fstrmepsilon-main.cc
    openfst-1.6.7/src/Makefile.in
    openfst-1.6.7/src/include/
    openfst-1.6.7/src/include/Makefile.in
    openfst-1.6.7/src/include/Makefile.am
    openfst-1.6.7/src/include/fst/
    openfst-1.6.7/src/include/fst/reweight.h
    openfst-1.6.7/src/include/fst/union.h
    openfst-1.6.7/src/include/fst/replace-util.h
    openfst-1.6.7/src/include/fst/visit.h
    openfst-1.6.7/src/include/fst/pair-weight.h
    openfst-1.6.7/src/include/fst/generic-register.h
    openfst-1.6.7/src/include/fst/flags.h
    openfst-1.6.7/src/include/fst/weight.h
    openfst-1.6.7/src/include/fst/compose.h
    openfst-1.6.7/src/include/fst/randequivalent.h
    openfst-1.6.7/src/include/fst/expanded-fst.h
    openfst-1.6.7/src/include/fst/set-weight.h
    openfst-1.6.7/src/include/fst/arc-map.h
    openfst-1.6.7/src/include/fst/determinize.h
    openfst-1.6.7/src/include/fst/types.h
    openfst-1.6.7/src/include/fst/config.h
    openfst-1.6.7/src/include/fst/lookahead-matcher.h
    openfst-1.6.7/src/include/fst/statesort.h
    openfst-1.6.7/src/include/fst/prune.h
    openfst-1.6.7/src/include/fst/verify.h
    openfst-1.6.7/src/include/fst/rmfinalepsilon.h
    openfst-1.6.7/src/include/fst/register.h
    openfst-1.6.7/src/include/fst/state-map.h
    openfst-1.6.7/src/include/fst/state-table.h
    openfst-1.6.7/src/include/fst/properties.h
    openfst-1.6.7/src/include/fst/replace.h
    openfst-1.6.7/src/include/fst/edit-fst.h
    openfst-1.6.7/src/include/fst/map.h
    openfst-1.6.7/src/include/fst/arcfilter.h
    openfst-1.6.7/src/include/fst/matcher.h
    openfst-1.6.7/src/include/fst/union-weight.h
    openfst-1.6.7/src/include/fst/product-weight.h
    openfst-1.6.7/src/include/fst/label-reachable.h
    openfst-1.6.7/src/include/fst/icu.h
    openfst-1.6.7/src/include/fst/symbol-table.h
    openfst-1.6.7/src/include/fst/const-fst.h
    openfst-1.6.7/src/include/fst/equivalent.h
    openfst-1.6.7/src/include/fst/util.h
    openfst-1.6.7/src/include/fst/filter-state.h
    openfst-1.6.7/src/include/fst/union-find.h
    openfst-1.6.7/src/include/fst/complement.h
    openfst-1.6.7/src/include/fst/dfs-visit.h
    openfst-1.6.7/src/include/fst/relabel.h
    openfst-1.6.7/src/include/fst/sparse-power-weight.h
    openfst-1.6.7/src/include/fst/float-weight.h
    openfst-1.6.7/src/include/fst/epsnormalize.h
    openfst-1.6.7/src/include/fst/push.h
    openfst-1.6.7/src/include/fst/rational.h
    openfst-1.6.7/src/include/fst/config.h.in
    openfst-1.6.7/src/include/fst/compact-fst.h
    openfst-1.6.7/src/include/fst/fst-decl.h
    openfst-1.6.7/src/include/fst/symbol-table-ops.h
    openfst-1.6.7/src/include/fst/lock.h
    openfst-1.6.7/src/include/fst/mapped-file.h
    openfst-1.6.7/src/include/fst/matcher-fst.h
    openfst-1.6.7/src/include/fst/arc-arena.h
    openfst-1.6.7/src/include/fst/synchronize.h
    openfst-1.6.7/src/include/fst/project.h
    openfst-1.6.7/src/include/fst/state-reachable.h
    openfst-1.6.7/src/include/fst/vector-fst.h
    openfst-1.6.7/src/include/fst/sparse-tuple-weight.h
    openfst-1.6.7/src/include/fst/heap.h
    openfst-1.6.7/src/include/fst/memory.h

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

  • cd openfst-1.6.7
  • CXX=aarch64-linux-android21-clang++
  • CXXFLAGS=' -O3 -DFST_NO_DYNAMIC_LINKING'
  • ./configure --prefix=/home/liuyi/Documents/VoiceAssist/vosk-api/android/build/kaldi_arm_64/local --enable-shared --enable-static --with-pic --disable-bin --enable-lookahead-fsts --enable-ngram-fsts --host=aarch64-linux-android --build=x86-linux-gnu
    ./build-kaldi.sh: line 82: ./configure: No such file or directory
  • make -j 8
    make: *** No targets specified and no makefile found. Stop.
  • make install
    make: *** No rule to make target 'install'. Stop.
  • cd /home/liuyi/Documents/VoiceAssist/vosk-api/android/build/kaldi_arm_64
  • git clone -b android-mix --single-branch https://github.com/alphacep/kaldi
    Cloning into 'kaldi'...
  • cd /home/liuyi/Documents/VoiceAssist/vosk-api/android/build/kaldi_arm_64/kaldi/src
  • CXX=aarch64-linux-android21-clang++
  • CXXFLAGS=' -O3 -DFST_NO_DYNAMIC_LINKING'
  • ./configure --use-cuda=no --mathlib=OPENBLAS --shared --android-incdir=/home/liuyi/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --host=aarch64-linux-android --openblas-root=/home/liuyi/Documents/VoiceAssist/vosk-api/android/build/kaldi_arm_64/local --fst-root=/home/liuyi/Documents/VoiceAssist/vosk-api/android/build/kaldi_arm_64/local --fst-version=1.6.7
    Configuring KALDI to use OPENBLAS.
    Checking compiler aarch64-linux-android21-clang++ ...
    Checking OpenFst library in /home/liuyi/Documents/VoiceAssist/vosk-api/android/build/kaldi_arm_64/local ...
    ***configure failed: Could not find file /home/liuyi/Documents/VoiceAssist/vosk-api/android/build/kaldi_arm_64/local/include/fst/fst.h:
    you may not have installed OpenFst. See ../tools/INSTALL ***
  • make -j 8 depend
    Makefile:30: kaldi.mk: No such file or directory
    kaldi.mk does not exist; you have to run ./configure
    Makefile:90: recipe for target 'kaldi.mk' failed
    make: *** [kaldi.mk] Error 1
  • make -j 8 online2
    Makefile:30: kaldi.mk: No such file or directory
    kaldi.mk does not exist; you have to run ./configure
    Makefile:90: recipe for target 'kaldi.mk' failed
    make: *** [kaldi.mk] Error 1

Task :kaldi FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':kaldi'.
    Process 'command './build-kaldi.sh'' finished with non-zero exit value 2

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 8m 57s
1 actionable task: 1 executed

Python build problem: mmand '['make', 'VERBOSE=1', '_vosk']' returned non-zero exit status 2.

I run into following issue when doing "python3 setup.py install". Kaldi indeed is cloned from lookahead-branch.

:~/vosk-api/python# python3 setup.py install                       running install
running bdist_egg
running egg_info
writing vosk.egg-info/PKG-INFO
writing dependency_links to vosk.egg-info/dependency_links.txt
writing top-level names to vosk.egg-info/top_level.txt
reading manifest file 'vosk.egg-info/SOURCES.txt'
writing manifest file 'vosk.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
CMake Warning at CMakeLists.txt:6 (find_package):
  By not providing "FindPython.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Python", but
  CMake did not find one.

  Could not find a package configuration file provided by "Python" with any
  of the following names:

    PythonConfig.cmake
    python-config.cmake

  Add the installation prefix of "Python" to CMAKE_PREFIX_PATH or set
  "Python_DIR" to a directory containing one of the above files.  If "Python"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring done
-- Generating done
-- Build files have been written to: /root/vosk-api/python/build/temp.linux-x86_64-3.6
/usr/bin/cmake -H/root/vosk-api/python -B/root/vosk-api/python/build/temp.linux-x86_64-3.6 --check-build-system CMakeFiles/Makefile.cmake 0
make -f CMakeFiles/Makefile2 _vosk
make[1]: Entering directory '/root/vosk-api/python/build/temp.linux-x86_64-3.6'
/usr/bin/cmake -H/root/vosk-api/python -B/root/vosk-api/python/build/temp.linux-x86_64-3.6 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /root/vosk-api/python/build/temp.linux-x86_64-3.6/CMakeFiles 6
make -f CMakeFiles/Makefile2 CMakeFiles/_vosk.dir/all
make[2]: Entering directory '/root/vosk-api/python/build/temp.linux-x86_64-3.6'
make -f CMakeFiles/_vosk.dir/build.make CMakeFiles/_vosk.dir/depend
make[3]: Entering directory '/root/vosk-api/python/build/temp.linux-x86_64-3.6'
cd /root/vosk-api/python/build/temp.linux-x86_64-3.6 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/vosk-api/python /root/vosk-api/python /root/vosk-api/python/build/temp.linux-x86_64-3.6 /root/vosk-api/python/build/temp.linux-x86_64-3.6 /root/vosk-api/python/build/temp.linux-x86_64-3.6/CMakeFiles/_vosk.dir/DependInfo.cmake --color=
make[3]: Leaving directory '/root/vosk-api/python/build/temp.linux-x86_64-3.6'
make -f CMakeFiles/_vosk.dir/build.make CMakeFiles/_vosk.dir/build
make[3]: Entering directory '/root/vosk-api/python/build/temp.linux-x86_64-3.6'
[ 16%] Building CXX object CMakeFiles/_vosk.dir/voskPYTHON_wrap.cxx.o
/usr/bin/c++  -D_vosk_EXPORTS -I/root/vosk-api/python/../src -I/root/kaldi/src -I/root/kaldi/tools/openfst/include  -std=c++11 -O3 -DFST_NO_DYNAMIC_LINKING  -O3 -DNDEBUG -fPIC   -o CMakeFiles/_vosk.dir/voskPYTHON_wrap.cxx.o -c /root/vosk-api/python/build/temp.linux-x86_64-3.6/voskPYTHON_wrap.cxx
/root/vosk-api/python/build/temp.linux-x86_64-3.6/voskPYTHON_wrap.cxx:173:11: fatal error: Python.h: No such file or directory
 # include <Python.h>
           ^~~~~~~~~~
compilation terminated.
CMakeFiles/_vosk.dir/build.make:71: recipe for target 'CMakeFiles/_vosk.dir/voskPYTHON_wrap.cxx.o' failed
make[3]: *** [CMakeFiles/_vosk.dir/voskPYTHON_wrap.cxx.o] Error 1
make[3]: Leaving directory '/root/vosk-api/python/build/temp.linux-x86_64-3.6'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/_vosk.dir/all' failed
make[2]: *** [CMakeFiles/_vosk.dir/all] Error 2
make[2]: Leaving directory '/root/vosk-api/python/build/temp.linux-x86_64-3.6'
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/_vosk.dir/rule' failed
make[1]: *** [CMakeFiles/_vosk.dir/rule] Error 2
make[1]: Leaving directory '/root/vosk-api/python/build/temp.linux-x86_64-3.6'
Makefile:118: recipe for target '_vosk' failed
make: *** [_vosk] Error 2
Traceback (most recent call last):
  File "setup.py", line 28, in <module>
    python_requires='>=3.4',
  File "/usr/local/lib/python3.6/dist-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.6/dist-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/usr/local/lib/python3.6/dist-packages/setuptools/command/install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.6/dist-packages/setuptools/command/bdist_egg.py", line 172, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/usr/local/lib/python3.6/dist-packages/setuptools/command/bdist_egg.py", line 158, in call_command
    self.run_command(cmdname)
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.6/dist-packages/setuptools/command/install_lib.py", line 11, in run
    self.build()
  File "/usr/lib/python3.6/distutils/command/install_lib.py", line 107, in build
    self.run_command('build_py')
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/root/vosk-api/python/cmake.py", line 73, in run
    self.run_command("build_ext")
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.6/dist-packages/setuptools/command/build_ext.py", line 87, in run
    _build_ext.run(self)
  File "/usr/local/lib/python3.6/dist-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/usr/lib/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/usr/local/lib/python3.6/dist-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions
    self.build_extension(ext)
  File "/root/vosk-api/python/cmake.py", line 64, in build_extension
    env=env)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', 'VERBOSE=1', '_vosk']' returned non-zero exit status 2.

Vosk cannot find HCLG.fst on Raspbian (RPi 4)

Hello again

I try to load a model with an HCLG.fst instead of an HCLr.fst and another Gr.fst separated graphs, as happens to be in your C++ code, but the program seems not to find it in the path...

vosk --min-active=200 --max-active=3000 --beam=10.0 --lattice-beam=2.0 --acoustic-scale=1.0 --frame-subsampling-factor=3 --endpoint.silence-phones=1:2:3:4:5:6:7:8:9:10 --endpoint.rule2.min-trailing-silence=0.5 --endpoint.rule3.min-trailing-silence=1.0 --endpoint.rule4.min-trailing-silence=2.0 
LOG (vosk[5.5.641-79319]:ComputeDerivedVars():ivector-extractor.cc:183) Computing derived variables for iVector extractor
LOG (vosk[5.5.641-79319]:ComputeDerivedVars():ivector-extractor.cc:204) Done.
LOG (vosk[5.5.641-79319]:RemoveOrphanNodes():nnet-nnet.cc:948) Removed 1 orphan nodes.
LOG (vosk[5.5.641-79319]:RemoveOrphanComponents():nnet-nnet.cc:847) Removing 2 orphan components.
LOG (vosk[5.5.641-79319]:Collapse():nnet-utils.cc:1472) Added 1 components, removed 2
LOG (vosk[5.5.641-79319]:CompileLooped():nnet-compile-looped.cc:345) Spent 0.146811 seconds in looped compilation.
ERROR: Fst::Read: Can't open file: model/HCLr.fst
ERROR: Fst::Read: Can't open file: model/Gr.fst
ERROR (vosk[5.5.641-79319]:KaldiRecognizer():src/kaldi_recognizer.cc:74) Can't create decoding graph

It may be my fault, but here are the files in the model folder:

model

Thanks for your time and quick responses,

Ander

Plan for the next release

Help is very much needed on all this, any contribution will be appreciated.

  • Convert C++ api to pure C api for improved interoperatbility (mingw, ios).
  • Windows build (pull request #28)
  • Mac build
  • Implement more pythonic API (#31)
  • Automatic download of the model (#11)
  • Basic unit tests
  • API documentation and samples
  • Merge websocket server
  • Implement gRPC server
  • Speaker identification
  • Spotting design (more lightweight acoustic model?)
  • Node module
  • Submit pull request to use Vosk api to major assistants - rhasspy, mycroft, susi, magicmirror, etc.
  • Put jars on bintray
  • Implement quantization (#140 )

PIP install on Raspberry Pi zero

Hi

I see armv6l version vosk-0.3.3-cp37-cp37m-linux_armv6l.whl available in PIP. Should it works on Ras Pi Zero?

I recived SIGILL, Illegal instruction when I run python example on Pi zero. It seems the library were compiled for some other system.

Gdb output:

(gdb) r
Starting program: /usr/bin/python3 test_simple.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0xb65ecdd0 in fst::FstRegisterer<fst::VectorFst<fst::ArcTpl<fst::TropicalWeig
htTpl<float> >, fst::VectorState<fst::ArcTpl<fst::TropicalWeightTpl<float> >,
 std::allocator<fst::ArcTpl<fst::TropicalWeightTpl<float> > > > > >::FstRegis
terer() () from /home/pi/.local/lib/python3.7/site-packages/vosk/_vosk.so

And cat /proc/cpuinfo

processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 9000c1
Serial          : 0000000081d02f5e
Model           : Raspberry Pi Zero W Rev 1.1

Task :lint FAILED

I tried the android build. gradle build does not work. The error message is as follows:

(base) liuyi@liuyi-HP:android$ gradle build
Starting a Gradle Daemon (subsequent builds will be faster)
Task :lint FAILED
FAILURE: Build failed with an exception.
What went wrong:
A problem was found with the configuration of task ':lint' (type 'LintGlobalTask').
No value has been specified for property 'lintClassPath'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5s
1 actionable task: 1 executed

I got a error when I installed on windows.

hi
I deployed the code on windows and used visual studio compile. My openfst is referencing the url :https://github.com/kkm000/openfst.
But I get the following error when I compile model.cc. Can you help me how to resolve it?
Many thanks.

model.obj: error LNK2019: Unresolved external symbol "public: unsigned __int64 __cdecl fst :: BitmapIndex :: Rank1 (unsigned __int64) const" (? Rank1 @ BitmapIndex @ fst @@ QEBA_K_K @ Z) in the function "public: class fst :: TropicalWeightTpl __cdecl fst :: internal :: NGramFstImpl <struct fst :: ArcTpl <class fst :: TropicalWeightTpl >> :: Final (int) const "(? Final @? $ NGramFstImpl @ U ? $ ArcTpl @ V? $ TropicalWeightTpl @ M @ fst @@@ fst @@@ internal @ fst @@ QEBA? AV? $ TropicalWeightTpl @ M @ 3 @ H @ Z) is referenced
model.obj: error LNK2019: unresolved external symbol "public: unsigned __int64 __cdecl fst :: BitmapIndex :: Select1 (unsigned __int64) const" (? Select1 @ BitmapIndex @ fst @@ QEBA_K_K @ Z) in function "public: virtual bool __cdecl fst :: NGramFstMatcher <struct fst :: ArcTpl <class fst :: TropicalWeightTpl >> :: Find (int) "(? Find @? $ NGramFstMatcher @ U? $ ArcTpl @ V? $ TropicalWeightTpl @ M @fst @@@ fst @@@ fst @@ UEAA_NH @ Z)
model.obj: error LNK2019: Unresolved external symbol "public: struct std :: pair <unsigned __int64, unsigned __int64> __cdecl fst :: BitmapIndex :: Select0s (unsigned __int64) const" (? Select0s @ BitmapIndex @ fst @@ QEBA? AU? $ Pair @ _K_K @ std @@ _ K @ Z) in the function "public: void __cdecl fst :: internal :: NGramFstImpl <struct fst :: ArcTpl <class fst :: TropicalWeightTpl > :: Init (char const *, bool, class fst :: MappedFile *) "(? Init @? $ NGramFstImpl @ U? $ ArcTpl @ V? $ TropicalWeightTpl @ M @ fst @@ fst @@@ internal @ fst @@ QEAAXPEBD_NPEAVMappedFile @ 3 @@ Z) is referenced
model.obj: error LNK2019: Unresolved external symbol "public: void __cdecl fst :: BitmapIndex :: BuildIndex (unsigned __int64 const *, unsigned __int64)" (? BuildIndex @ BitmapIndex @ fst @@ QEAAXPEB_K_K @ Z) in function "public: void __cdecl fst :: internal :: NGramFstImpl <struct fst :: ArcTpl <class fst :: TropicalWeightTpl >> :: Init (char const *, bool, class fst :: MappedFile *)" (? Init @? $ NGramFstImpl @ U? $ ArcTpl @ V? $ TropicalWeightTpl @ M @ fst @@@ fst @@@ internal @ fst @@ QEAAXPEBD_NPEAVMappedFile @ 3 @@ Z) is referenced
MSVCRTD.lib (exe_main.obj): error LNK2019: Unresolved external symbol main is referenced in function "int __cdecl invoke_main (void)" (? Invoke_main @@ YAHXZ)
C: \ Users \ celine \ kaldi \ kaldiwin_vs2017_OPENBLAS \ zzz_vosk_api \ x64 \ Debug \ zzz_vosk_api.exe: fatal error LNK1120: 5 unresolvable external symbols

Armv6 wheel

Board: Orange Pi zero.
OS: Ubuntu Bionic with Armbian Linux.

# uname -a
Linux orangepizero 4.19.62-sunxi #5.92 SMP Wed Jul 31 22:07:23 CEST 2019 armv7l armv7l armv7l GNU/Linux
# python3.7 -V
Python 3.7.5
# apt-cache policy libgfortran5 | grep Installed
  Installed: 8.3.0-6ubuntu1~18.04.1

vosk installed from pypi, result:

# python3.7 test_local.py test.wav 
vosk --min-active=200 --max-active=3000 --beam=10.0 --lattice-beam=2.0 --acoustic-scale=1.0 --frame-subsampling-factor=3 --endpoint.silence-phones=1:2:3:4:5:6:7:8:9:10 --endpoint.rule2.min-trailing-silence=0.5 --endpoint.rule3.min-trailing-silence=1.0 --endpoint.rule4.min-trailing-silence=2.0 
LOG (vosk[5.5.556~1-5ae69]:ComputeDerivedVars():ivector-extractor.cc:183) Computing derived variables for iVector extractor
LOG (vosk[5.5.556~1-5ae69]:ComputeDerivedVars():ivector-extractor.cc:204) Done.
LOG (vosk[5.5.556~1-5ae69]:RemoveOrphanNodes():nnet-nnet.cc:948) Removed 1 orphan nodes.
LOG (vosk[5.5.556~1-5ae69]:RemoveOrphanComponents():nnet-nnet.cc:847) Removing 2 orphan components.
LOG (vosk[5.5.556~1-5ae69]:Collapse():nnet-utils.cc:1472) Added 1 components, removed 2
LOG (vosk[5.5.556~1-5ae69]:CompileLooped():nnet-compile-looped.cc:345) Spent 0.521 seconds in looped compilation.
Illegal instruction

Always crashed on rec = KaldiRecognizer(model, 16000).

P.S.: x86_64 and self-builded aarch64 wheel work fine.

Support full GPU decoding

When I compile you app inside a docker container without GPU support everything works fine.

I have made a few changes so that Kaldi is compiled with GPU support and I am running the application inside a docker container with NVIDIA GPU support.

But when I run the GPU version I get the error below, do you have any idea what the problem might be?

server --min-active=200 --max-active=6000 --beam=13.0 --lattice-beam=6.0 --acoustic-scale=1.0 --frame-subsampling-factor=3 --endpoint.silence-phones=1:2:3:4:5:6:7:8:9:10 --endpoint.rule2.min-trailing-silence=0.5 --endpoint.rule3.min-trailing-silence=1.0 --endpoint.rule4.min-trailing-silence=2.0
LOG (server[5.5]:Model():model.cc:47) Sample rate is 8000
LOG (server[5.5]:ComputeDerivedVars():ivector-extractor.cc:183) Computing derived variables for iVector extractor
LOG (server[5.5]:ComputeDerivedVars():ivector-extractor.cc:204) Done.
LOG (server[5.5]:RemoveOrphanNodes():nnet-nnet.cc:948) Removed 1 orphan nodes.
LOG (server[5.5]:RemoveOrphanComponents():nnet-nnet.cc:847) Removing 2 orphan components.
LOG (server[5.5]:Collapse():nnet-utils.cc:1472) Added 1 components, removed 2
LOG (server[5.5]:CompileLooped():nnet-compile-looped.cc:345) Spent 0.0133111 seconds in looped compilation.
WARNING (server[5.5]:SelectGpuId():cu-device.cc:228) Not in compute-exclusive mode.  Suggestion: use 'nvidia-smi -c 3' to set compute exclusive mode
LOG (server[5.5]:SelectGpuIdAuto():cu-device.cc:408) Selecting from 1 GPUs
LOG (server[5.5]:SelectGpuIdAuto():cu-device.cc:423) cudaSetDevice(0): GeForce GTX 1070 free:8022M, used:97M, total:8119M, free/total:0.987992
LOG (server[5.5]:SelectGpuIdAuto():cu-device.cc:471) Device: 0, mem_ratio: 0.987992
LOG (server[5.5]:SelectGpuId():cu-device.cc:352) Trying to select device: 0
LOG (server[5.5]:SelectGpuIdAuto():cu-device.cc:481) Success selecting device 0 free mem ratio: 0.987992
LOG (server[5.5]:FinalizeActiveGpu():cu-device.cc:308) The active GPU is [0]: GeForce GTX 1070  free:7834M, used:285M, total:8119M, free/total:0.964838 version 6.1
ERROR (server[5.5]:CopyToMat():cu-matrix.cc:464) cudaError_t 700 : "an illegal memory access was encountered" returned from 'cudaMemcpy2DAsync(dst->Data(), dst_pitch, this->data_, src_pitch, width, this->num_rows_, cudaMemcpyDeviceToHost, cudaStreamPerThread)'

[ Stack-Trace: ]
/opt/kaldi-websocket/_kaldi_recognizer.so(kaldi::MessageLogger::LogMessage() const+0x82c) [0x7f852b86c2de]
/opt/kaldi-websocket/_kaldi_recognizer.so(kaldi::MessageLogger::LogAndThrow::operator=(kaldi::MessageLogger const&)+0x2e) [0x7f852b458f3c]
/opt/kaldi-websocket/_kaldi_recognizer.so(void kaldi::CuMatrixBase<float>::CopyToMat<float>(kaldi::MatrixBase<float>*, kaldi::MatrixTransposeType) const+0x1ea) [0x7f852b78bb52]
/opt/kaldi-websocket/_kaldi_recognizer.so(kaldi::CuMatrix<float>::Swap(kaldi::Matrix<float>*)+0x12f) [0x7f852b78cba5]
/opt/kaldi-websocket/_kaldi_recognizer.so(kaldi::Matrix<float>::Swap(kaldi::CuMatrix<float>*)+0x12) [0x7f852b78cc24]
/opt/kaldi-websocket/_kaldi_recognizer.so(kaldi::nnet3::DecodableNnetLoopedOnlineBase::AdvanceChunk()+0x5a3) [0x7f852b5bbe6f]
/opt/kaldi-websocket/_kaldi_recognizer.so(kaldi::nnet3::DecodableAmNnetLoopedOnline::LogLikelihood(int, int)+0x51) [0x7f852b5bc047]
/opt/kaldi-websocket/_kaldi_recognizer.so(kaldi::LatticeFasterDecoderTpl<fst::VectorFst<fst::ArcTpl<fst::TropicalWeightTpl<float> >, fst::VectorState<fst::ArcTpl<fst::TropicalWeightTpl<float> >, std::allocator<fst::ArcTpl<fst::TropicalWeightTpl<float> > > > >, kaldi::decoder::BackpointerToken>::ProcessEmitting(kaldi::DecodableInterface*)+0x22b) [0x7f852b4c2173]
/opt/kaldi-websocket/_kaldi_recognizer.so(kaldi::LatticeFasterDecoderTpl<fst::VectorFst<fst::ArcTpl<fst::TropicalWeightTpl<float> >, fst::VectorState<fst::ArcTpl<fst::TropicalWeightTpl<float> >, std::allocator<fst::ArcTpl<fst::TropicalWeightTpl<float> > > > >, kaldi::decoder::BackpointerToken>::AdvanceDecoding(kaldi::DecodableInterface*, int)+0x97) [0x7f852b4c2575]
/opt/kaldi-websocket/_kaldi_recognizer.so(kaldi::LatticeFasterDecoderTpl<fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > >, kaldi::decoder::BackpointerToken>::AdvanceDecoding(kaldi::DecodableInterface*, int)+0x74) [0x7f852b4c30c8]
/opt/kaldi-websocket/_kaldi_recognizer.so(kaldi::SingleUtteranceNnet3DecoderTpl<fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > >::AdvanceDecoding()+0x19) [0x7f852b4a1e8f]
/opt/kaldi-websocket/_kaldi_recognizer.so(KaldiRecognizer::AcceptWaveform(char const*, int)+0x10a) [0x7f852b457d8a]
/opt/kaldi-websocket/_kaldi_recognizer.so(+0x2c29c4) [0x7f852b4909c4]
python3(PyCFunction_Call+0x4f) [0x4e12df]
python3(PyEval_EvalFrameEx+0x614) [0x530b94]
python3(PyEval_EvalFrameEx+0x4b64) [0x5350e4]
python3(PyEval_EvalCodeEx+0x13b) [0x53a81b]
python3() [0x4e3537]
python3(PyObject_Call+0x47) [0x5c3bd7]
python3(PyEval_EvalFrameEx+0x24a2) [0x532a22]
python3(PyEval_EvalFrameEx+0x4b64) [0x5350e4]
python3(PyEval_EvalCodeEx+0x13b) [0x53a81b]
python3() [0x4e3537]
python3(PyObject_Call+0x47) [0x5c3bd7]
python3(PyEval_EvalFrameEx+0x24a2) [0x532a22]
python3(PyEval_EvalFrameEx+0x4b64) [0x5350e4]
python3(PyEval_EvalFrameEx+0x4b64) [0x5350e4]
python3(PyEval_EvalCodeEx+0x13b) [0x53a81b]
python3() [0x4e3423]
python3(PyObject_Call+0x47) [0x5c3bd7]
python3() [0x4f08be]
python3(PyObject_Call+0x47) [0x5c3bd7]
python3(PyEval_CallObjectWithKeywords+0x30) [0x525d00]
python3() [0x626bb2]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f852f8816ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f852f5b741d]

terminate called after throwing an instance of 'kaldi::KaldiFatalError'

Automatic download of the models, hugginface style

Ubuntu 16.04, installed with "pip3 install vosk"

python3.5 test-vosk.py test.wav
vosk --min-active=200 --max-active=3000 --beam=10.0 --lattice-beam=2.0 --acoustic-scale=1.0 --frame-subsampling-factor=3 --endpoint.silence-phones=1:2:3:4:5:6:7:8:9:10 --endpoint.rule2.min-trailing-silence=0.5 --endpoint.rule3.min-trailing-silence=1.0 --endpoint.rule4.min-trailing-silence=2.0
ERROR (vosk[5.5.599~1-11bed]:ReadConfigFile():parse-options.cc:462) Cannot open config file: model/mfcc.conf

C++ exceptions crash Python interpreter

Related to #18 , using the same code, note how the C++ exception is not handled and causes Python to abort.

Perhaps it would be possible to let Python code handle exceptions thrown from C++?

I'd like to help, but it would take me some time to learn C++ and SWIG :)

from vosk import Model, KaldiRecognizer

try:
  model = Model('fr')
  rec = KaldiRecognizer(model, 8000)
  data = b'\x00' * 1000
  print(rec.AcceptWaveform(data))
except Exception as e:
  print('Exception!', e)
  raise e

print('OK')

Problem building Python module

I'm having an error similar to #17 here. I've compiled kaldi from git and try to build the python module. I don't do that with python3 setup.py install, because that needs super-user rights on my system and will fail because KALDI_ROOT is only exported for the current user. I do python3 setup.py build. But get the error:

[ 80%] Building CXX object CMakeFiles/_vosk.dir/home/magic/vosk-api/src/model.cc.o
/usr/bin/c++ -D_vosk_EXPORTS -I/home/magic/vosk-api/python/../src -I/home/magic/kaldi/src -I/home/magic/kaldi/tools/openfst/include -I/usr/include/python3.7m -O3 -DFST_NO_DYNAMIC_LINKING -O3 -DNDEBUG -fPIC -o CMakeFiles/_vosk.dir/home/magic/vosk-api/src/model.cc.o -c /home/magic/vosk-api/src/model.cc
make[3]: *** Keine Regel vorhanden, um das Ziel „/home/magic/kaldi/src/online2/kaldi-online2.a“,
benötigt von „../lib.linux-x86_64-3.7/vosk/_vosk.so“, zu erstellen. Schluss.

Any hints on what the error is and hints on installing afterwards?

LookaheadComposeFst symbol not found

Hi,
I cant seem to find 'LookaheadComposeFst', I am trying to build your wrapper classes on mac.

Any pointers as to what file I need to include?

SpkModel reference

I just tried to build the android module and got an error when generating the jni file gradle build:

/vosk-api/android/build/generated-src/cpp/vosk_wrap.cc:439: error: undefined reference to 'SpkModel::SpkModel(char const*)' clang++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed.

is this a swig problem finding the spk_model.h in the root src folder?

vosk-api python module build error

Hi.
While trying python3 setup.py install

[ 40%] Building CXX object CMakeFiles/_vosk.dir/voskPYTHON_wrap.cxx.o
/usr/bin/c++ -D_vosk_EXPORTS -I/opt/vosk/vosk-api/python/../src -I/opt/vosk/kaldi/src -I/opt/vosk/kaldi/tools/openfst/include -I/usr/include/python3.5m -O3 -DFST_NO_DYNAMIC_LINKING -std=c++11 -O3 -DNDEBUG -fPIC -o CMakeFiles/vosk.dir/voskPYTHON_wrap.cxx.o -c /opt/vosk/vosk-api/python/build/temp.linux-x86_64-3.5/voskPYTHON_wrap.cxx
In file included from /opt/vosk/vosk-api/python/build/temp.linux-x86_64-3.5/voskPYTHON_wrap.cxx:3119:0:
/opt/vosk/vosk-api/python/../src/kaldi_recognizer.h:35:14: error: ‘LookaheadFst’ in namespace ‘fst’ does not name a template type
fst::LookaheadFst<fst::StdArc, int32> *decode_fst
;
^~~~~~~~~~~~
CMakeFiles/_vosk.dir/build.make:62: recipe for target 'CMakeFiles/_vosk.dir/voskPYTHON_wrap.cxx.o' failed
make[3]: *** [CMakeFiles/_vosk.dir/voskPYTHON_wrap.cxx.o] Error 1
make[3]: Leaving directory '/opt/vosk/vosk-api/python/build/temp.linux-x86_64-3.5'
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/_vosk.dir/all' failed
make[2]: *** [CMakeFiles/_vosk.dir/all] Error 2
make[2]: Leaving directory '/opt/vosk/vosk-api/python/build/temp.linux-x86_64-3.5'
CMakeFiles/Makefile2:116: recipe for target 'CMakeFiles/_vosk.dir/rule' failed
make[1]: *** [CMakeFiles/_vosk.dir/rule] Error 2
make[1]: Leaving directory '/opt/vosk/vosk-api/python/build/temp.linux-x86_64-3.5'
Makefile:131: recipe for target '_vosk' failed
make: *** [_vosk] Error 2

Cannot install version 0.3.1 on Raspbian

Hello

First of all, thanks for this repository.

I am trying to install Vosk on Raspbian on a 4GB Raspberry Pi 4 but it cannot install version 0.3.1.

Pip (20.0.2) says that wouldn't find a version 0.3.1 and installs the 0.3. When installing whl files none of them are compatible. I am trying to avoid installing the whole Kaldi in the Raspberry since it will take a lot of free space.

I want to install this version since I cannot pass a list of words to a KaldiRecognizer in version 0.3.

Also, the model seems not to find a HCLG.fst file and requires a HCLr.fst and a Gr.fst separatedly, at least in version 0.3, when passing a model folder made by us.

Thanks for your time,

Ander

error message: swig FAILED

when I run "gradle build", I got the error message:


> Task :swig FAILED
Unable to open file build/generated-src/cpp/kaldi_recognizer_wrap.cc: No such file or directory

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':swig'.
> Process 'command 'swig'' finished with non-zero exit value 1

I installed swig from https://github.com/swig/swig.git. Is there anything else I missed? Thanks.

repeated results

Some audio files repeat the final result

{"partial" : ""}
{"partial" : ""}
{"partial" : ""}
{"partial" : ""}
{"partial" : "are you"}
{"partial" : "i usually"}
{"partial" : "i usually get"}
{"partial" : "i usually get up"}
{"partial" : "i usually get up at"}
{"partial" : "i usually get up at a turk leave"}
{"partial" : "i usually get up at eight o'clock"}
{"partial" : "i usually get up at eight o'clock"}
{"result" : [ {"word": "i", "start" : 1.59, "end" : 1.83, "conf" : 1},
{"word": "usually", "start" : 1.83, "end" : 2.55, "conf" : 1},
{"word": "get", "start" : 2.64, "end" : 2.94, "conf" : 1},
{"word": "up", "start" : 2.94, "end" : 3.27, "conf" : 1},
{"word": "at", "start" : 3.51, "end" : 3.87, "conf" : 1},
{"word": "eight", "start" : 3.96, "end" : 4.28829, "conf" : 0.585446},
{"word": "o'clock", "start" : 4.29, "end" : 5.04, "conf" : 0.574342}
 ], "text" : "i usually get up at eight o'clock" }
{"result" : [ {"word": "i", "start" : 1.59, "end" : 1.83, "conf" : 1},
{"word": "usually", "start" : 1.83, "end" : 2.55, "conf" : 1},
{"word": "get", "start" : 2.64, "end" : 2.94, "conf" : 1},
{"word": "up", "start" : 2.94, "end" : 3.27, "conf" : 1},
{"word": "at", "start" : 3.51, "end" : 3.87, "conf" : 1},
{"word": "eight", "start" : 3.96, "end" : 4.28829, "conf" : 0.585446},
{"word": "o'clock", "start" : 4.29, "end" : 5.04, "conf" : 0.574342}
 ], "text" : "i usually get up at eight o'clock" }

Do you know what could cause this?

"Illegal Instruction" on test with Raspbian

On a Raspberry Pi Zero W with Raspbian 10 buster.

sudo apt-get install libgfortran-6-dev
pip3 install --user vosk
cd vosk-api/python/example
wget https://github.com/alphacep/kaldi-android-demo/releases/download/2020-01/alphacep-model-android-en-us-0.3.tar.gz
tar xf alphacep-model-android-en-us-0.3.tar.gz
mv alphacep-model-android-en-us-0.3 model-en
python3 ./test_simple.py test.wav
Illegal instruction

"nspc"?

I am randomly getting the prefix "nspc " in the recognized text. Even with German text. "nspc wann nudeln begünstigen". What is this about? :)

Can't find python.h during building

In python/CMakeLists.txt Line 6, seems cannot find python.h.

find_package (Python COMPONENTS Interpreter Development)

I'm using anaconda3 for compilation.
I need to hardcode my lib and include path like this:

set(Python_INCLUDE_DIR "/opt/anaconda3/envs/python37/include/python3.7m")
set(Python_LIBRARY "/opt/anaconda3/envs/python37/lib/python3.7")

Is there a way to fix it?
Cmake version is 3.16.4 btw.

model without ivector problem

Hi
I want to know whether this kaldi-android-demo support a model which is not trained with ivector feature. My model works well in this demo, but its size only for the ivector directory is 20M, so I want to test a new model without ivector.

Error building Java bindings

Peppermint Linux 10

stefan@stefan-HP-255-G7-Notebook-PC ~/dev/vosk-api-master/java $ KALDI_ROOT=/home/stefan/dev/kaldi-master make
g++ -shared -o libvosk_jni.so -I/home/stefan/dev/jdk-13/include -I/home/stefan/dev/jdk-13/include/linux -I/home/stefan/dev/kaldi-master/src -I/home/stefan/dev/kaldi-master/tools/openfst/include -I../src -g -O2 -DPIC -fPIC -Wno-unused-function vosk_wrap.cc ../src/kaldi_recognizer.cc ../src/kaldi_recognizer.h ../src/model.cc ../src/model.h /home/stefan/dev/kaldi-master/src/online2/kaldi-online2.a /home/stefan/dev/kaldi-master/src/decoder/kaldi-decoder.a /home/stefan/dev/kaldi-master/src/ivector/kaldi-ivector.a /home/stefan/dev/kaldi-master/src/gmm/kaldi-gmm.a /home/stefan/dev/kaldi-master/src/nnet3/kaldi-nnet3.a /home/stefan/dev/kaldi-master/src/tree/kaldi-tree.a /home/stefan/dev/kaldi-master/src/feat/kaldi-feat.a /home/stefan/dev/kaldi-master/src/lat/kaldi-lat.a /home/stefan/dev/kaldi-master/src/hmm/kaldi-hmm.a /home/stefan/dev/kaldi-master/src/transform/kaldi-transform.a /home/stefan/dev/kaldi-master/src/cudamatrix/kaldi-cudamatrix.a /home/stefan/dev/kaldi-master/src/matrix/kaldi-matrix.a /home/stefan/dev/kaldi-master/src/fstext/kaldi-fstext.a /home/stefan/dev/kaldi-master/src/util/kaldi-util.a /home/stefan/dev/kaldi-master/src/base/kaldi-base.a /home/stefan/dev/kaldi-master/tools/openfst/lib/libfst.a /home/stefan/dev/kaldi-master/tools/openfst/lib/libfstngram.a /home/stefan/dev/kaldi-master/tools/OpenBLAS/libopenblas.a -lgfortran
In file included from vosk_wrap.cc:236:0:
../src/kaldi_recognizer.h:50:14: error: ‘LookaheadFst’ in namespace ‘fst’ does not name a template type
         fst::LookaheadFst<fst::StdArc, int32> *decode_fst_;
              ^~~~~~~~~~~~
In file included from ../src/kaldi_recognizer.cc:15:0:
../src/kaldi_recognizer.h:50:14: error: ‘LookaheadFst’ in namespace ‘fst’ does not name a template type
         fst::LookaheadFst<fst::StdArc, int32> *decode_fst_;
              ^~~~~~~~~~~~
../src/kaldi_recognizer.cc: In constructor ‘KaldiRecognizer::KaldiRecognizer(Model&, float)’:
../src/kaldi_recognizer.cc:28:5: error: ‘decode_fst_’ was not declared in this scope
     decode_fst_ = NULL;
     ^~~~~~~~~~~
../src/kaldi_recognizer.cc:28:5: note: suggested alternative: ‘decoder_’
     decode_fst_ = NULL;
     ^~~~~~~~~~~
     decoder_
../src/kaldi_recognizer.cc:32:27: error: ‘LookaheadComposeFst’ was not declared in this scope
             decode_fst_ = LookaheadComposeFst(*model_.hcl_fst_, *model_.g_fst_, model_.disambig_);
                           ^~~~~~~~~~~~~~~~~~~
../src/kaldi_recognizer.cc: In constructor ‘KaldiRecognizer::KaldiRecognizer(Model&, float, const char*)’:
../src/kaldi_recognizer.cc:70:9: error: ‘decode_fst_’ was not declared in this scope
         decode_fst_ = LookaheadComposeFst(*model_.hcl_fst_, g_fst_, model_.disambig_);
         ^~~~~~~~~~~
../src/kaldi_recognizer.cc:70:9: note: suggested alternative: ‘decoder_’
         decode_fst_ = LookaheadComposeFst(*model_.hcl_fst_, g_fst_, model_.disambig_);
         ^~~~~~~~~~~
         decoder_
../src/kaldi_recognizer.cc:70:23: error: ‘LookaheadComposeFst’ was not declared in this scope
         decode_fst_ = LookaheadComposeFst(*model_.hcl_fst_, g_fst_, model_.disambig_);
                       ^~~~~~~~~~~~~~~~~~~
../src/kaldi_recognizer.cc:72:9: error: ‘decode_fst_’ was not declared in this scope
         decode_fst_ = NULL;
         ^~~~~~~~~~~
../src/kaldi_recognizer.cc:72:9: note: suggested alternative: ‘decoder_’
         decode_fst_ = NULL;
         ^~~~~~~~~~~
         decoder_
../src/kaldi_recognizer.cc:79:52: error: ‘decode_fst_’ was not declared in this scope
             model_.hclg_fst_ ? *model.hclg_fst_ : *decode_fst_,
                                                    ^~~~~~~~~~~
../src/kaldi_recognizer.cc:79:52: note: suggested alternative: ‘decoder_’
             model_.hclg_fst_ ? *model.hclg_fst_ : *decode_fst_,
                                                    ^~~~~~~~~~~
                                                    decoder_
../src/kaldi_recognizer.cc: In destructor ‘KaldiRecognizer::~KaldiRecognizer()’:
../src/kaldi_recognizer.cc:90:12: error: ‘decode_fst_’ was not declared in this scope
     delete decode_fst_;
            ^~~~~~~~~~~
../src/kaldi_recognizer.cc:90:12: note: suggested alternative: ‘decoder_’
     delete decode_fst_;
            ^~~~~~~~~~~
            decoder_
../src/kaldi_recognizer.h:50:14: error: ‘LookaheadFst’ in namespace ‘fst’ does not name a template type
         fst::LookaheadFst<fst::StdArc, int32> *decode_fst_;
              ^~~~~~~~~~~~
Makefile:31: recipe for target 'libvosk_jni.so' failed
make: *** [libvosk_jni.so] Error 1

nBest List

I was wondering is it possible to get nBest list from ASR result instead of only 1?
For example:
['look for movies directed by Terren Tina',
'look for movies directed by Darren Tina',
'look for movies directed by Tarantino',
'look for movies directed by tear and tea no',
'look for movies directed by Terren teen']

Sampling frequency mismatch - consider adding --allow_{upsample,downsample}

Using the fr model from kaldi-android-demo with vosk 0.3, running the following code crashes the Python interpreter.

from vosk import Model, KaldiRecognizer

try:
  model = Model('fr')
  rec = KaldiRecognizer(model, 8000)
  data = b'\x00' * 1000
  print(rec.AcceptWaveform(data))
except Exception as e:
  print('Exception!', e)
  raise e

print('OK')
root@77cd514bb1ec:/models# python3 /server/bug_repro.py 
vosk --min-active=200 --max-active=3000 --beam=10.0 --lattice-beam=2.0 --acoustic-scale=1.0 --frame-subsampling-factor=3 --endpoint.silence-phones=1:2:3:4:5:6:7:8:9:10 --endpoint.rule2.min-trailing-silence=0.5 --endpoint.rule3.min-trailing-silence=1.0 --endpoint.rule4.min-trailing-silence=2.0
LOG (vosk[5.5.599~1-11bed]:ComputeDerivedVars():ivector-extractor.cc:183) Computing derived variables for iVector extractor
LOG (vosk[5.5.599~1-11bed]:ComputeDerivedVars():ivector-extractor.cc:204) Done.
LOG (vosk[5.5.599~1-11bed]:RemoveOrphanNodes():nnet-nnet.cc:948) Removed 1 orphan nodes.
LOG (vosk[5.5.599~1-11bed]:RemoveOrphanComponents():nnet-nnet.cc:847) Removing 2 orphan components.
LOG (vosk[5.5.599~1-11bed]:Collapse():nnet-utils.cc:1472) Added 1 components, removed 2
LOG (vosk[5.5.599~1-11bed]:CompileLooped():nnet-compile-looped.cc:345) Spent 0.0316849 seconds in looped compilation.
ERROR (vosk[5.5.599~1-11bed]:MaybeCreateResampler():online-feature.cc:99) Sampling frequency mismatch, expected 16000, got 8000
Perhaps you want to use the options --allow_{upsample,downsample}

[ Stack-Trace: ]
/usr/local/lib/python3.7/site-packages/vosk/_vosk.so(kaldi::MessageLogger::LogMessage() const+0x7a6) [0x7f1b546ba6ae]
/usr/local/lib/python3.7/site-packages/vosk/_vosk.so(kaldi::MessageLogger::LogAndThrow::operator=(kaldi::MessageLogger const&)+0x13) [0x7f1b5435cd43]
/usr/local/lib/python3.7/site-packages/vosk/_vosk.so(kaldi::OnlineGenericBaseFeature<kaldi::MfccComputer>::MaybeCreateResampler(float)+0x23a) [0x7f1b5456baa2]
/usr/local/lib/python3.7/site-packages/vosk/_vosk.so(kaldi::OnlineGenericBaseFeature<kaldi::MfccComputer>::AcceptWaveform(float, kaldi::VectorBase<float> const&)+0x55) [0x7f1b5456c477]       
/usr/local/lib/python3.7/site-packages/vosk/_vosk.so(kaldi::OnlineNnet2FeaturePipeline::AcceptWaveform(float, kaldi::VectorBase<float> const&)+0x1c) [0x7f1b543adc2a]
/usr/local/lib/python3.7/site-packages/vosk/_vosk.so(KaldiRecognizer::AcceptWaveform(kaldi::Vector<float>&)+0x1c) [0x7f1b5435742c]
/usr/local/lib/python3.7/site-packages/vosk/_vosk.so(KaldiRecognizer::AcceptWaveform(char const*, int)+0x17e) [0x7f1b543575ee]
/usr/local/lib/python3.7/site-packages/vosk/_vosk.so(+0x21fe56) [0x7f1b54354e56]
/usr/local/lib/libpython3.7m.so.1.0(_PyMethodDef_RawFastCallKeywords+0x155) [0x7f1b555a64c5]
/usr/local/lib/libpython3.7m.so.1.0(_PyCFunction_FastCallKeywords+0x20) [0x7f1b555a6350]
/usr/local/lib/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x4525) [0x7f1b5561bb95]
/usr/local/lib/libpython3.7m.so.1.0(_PyFunction_FastCallKeywords+0xfa) [0x7f1b555a748a]
/usr/local/lib/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x672) [0x7f1b55617ce2]
/usr/local/lib/libpython3.7m.so.1.0(_PyEval_EvalCodeWithName+0x2f1) [0x7f1b55616b71]
/usr/local/lib/libpython3.7m.so.1.0(PyEval_EvalCodeEx+0x39) [0x7f1b55616879]
/usr/local/lib/libpython3.7m.so.1.0(PyEval_EvalCode+0x1b) [0x7f1b5561683b]
/usr/local/lib/libpython3.7m.so.1.0(+0x20b97e) [0x7f1b5569a97e]
/usr/local/lib/libpython3.7m.so.1.0(PyRun_FileExFlags+0x97) [0x7f1b55699d37]
/usr/local/lib/libpython3.7m.so.1.0(PyRun_SimpleFileExFlags+0x18e) [0x7f1b55699b5e]
/usr/local/lib/libpython3.7m.so.1.0(+0x210108) [0x7f1b5569f108]
/usr/local/lib/libpython3.7m.so.1.0(_Py_UnixMain+0x2e) [0x7f1b5569edfe]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7f1b5510809b]
python3(_start+0x2a) [0x55f3e267308a]

terminate called after throwing an instance of 'kaldi::KaldiFatalError'
  what():  kaldi::KaldiFatalError
Aborted

error: no template named 'LookaheadFst' in namespace 'fst'

I am following this blog(https://medium.com/swlh/compile-kaldi-for-64-bit-android-on-ubuntu-18-70967eb3a308) to build kaldi for android. In the step Compile libkaldi_jni.so, this blog used this repo to build libkaldi_jni.so using the gradle build command. However, I am wondering if anyone can help out, the following error message showed up:

In file included from /home/liuyi/Documents/VoiceAssist/kaldi-jni/build/generated-src/cpp/kaldi_recognizer_wrap.cc:236:
../../../../src/main/cpp/kaldi_recognizer.h:35:14: error: no template named 'LookaheadFst' in namespace 'fst'
fst::LookaheadFst<fst::StdArc, int32> *decode_fst_;
~~~~~^
1 error generated.

The entire message is shown below:

> Task :externalNativeBuildDebug
Build kaldi_jni_arm64-v8a
[1/4] /home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dkaldi_jni_EXPORTS -I../../../../src/main/cpp -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/src -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/tools/openfst-1.6.8/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O3 -DFST_NO_DYNAMIC_LINKING -O0 -fno-limit-debug-info -fno-experimental-isel -fPIC -MD -MT CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o -MF CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o.d -o CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o -c /home/liuyi/Documents/VoiceAssist/kaldi-jni/build/generated-src/cpp/kaldi_recognizer_wrap.cc
[2/4] /home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dkaldi_jni_EXPORTS -I../../../../src/main/cpp -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/src -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/tools/openfst-1.6.8/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O3 -DFST_NO_DYNAMIC_LINKING -O0 -fno-limit-debug-info -fno-experimental-isel -fPIC -MD -MT CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o -MF CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o.d -o CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o -c /home/liuyi/Documents/VoiceAssist/kaldi-jni/src/main/cpp/kaldi_recognizer.cc
[3/4] /home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dkaldi_jni_EXPORTS -I../../../../src/main/cpp -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/src -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/tools/openfst-1.6.8/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O3 -DFST_NO_DYNAMIC_LINKING -O0 -fno-limit-debug-info -fno-experimental-isel -fPIC -MD -MT CMakeFiles/kaldi_jni.dir/src/main/cpp/model.cc.o -MF CMakeFiles/kaldi_jni.dir/src/main/cpp/model.cc.o.d -o CMakeFiles/kaldi_jni.dir/src/main/cpp/model.cc.o -c /home/liuyi/Documents/VoiceAssist/kaldi-jni/src/main/cpp/model.cc
FAILED: /home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dkaldi_jni_EXPORTS -I../../../../src/main/cpp -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/src -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/tools/openfst-1.6.8/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O3 -DFST_NO_DYNAMIC_LINKING -O0 -fno-limit-debug-info -fno-experimental-isel -fPIC -MD -MT CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o -MF CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o.d -o CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o -c /home/liuyi/Documents/VoiceAssist/kaldi-jni/build/generated-src/cpp/kaldi_recognizer_wrap.cc
In file included from /home/liuyi/Documents/VoiceAssist/kaldi-jni/build/generated-src/cpp/kaldi_recognizer_wrap.cc:236:
../../../../src/main/cpp/kaldi_recognizer.h:35:14: error: no template named 'LookaheadFst' in namespace 'fst'
fst::LookaheadFst<fst::StdArc, int32> *decode_fst_;
~~~~~^
1 error generated.
FAILED: /home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dkaldi_jni_EXPORTS -I../../../../src/main/cpp -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/src -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/tools/openfst-1.6.8/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O3 -DFST_NO_DYNAMIC_LINKING -O0 -fno-limit-debug-info -fno-experimental-isel -fPIC -MD -MT CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o -MF CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o.d -o CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o -c /home/liuyi/Documents/VoiceAssist/kaldi-jni/src/main/cpp/kaldi_recognizer.cc
In file included from /home/liuyi/Documents/VoiceAssist/kaldi-jni/src/main/cpp/kaldi_recognizer.cc:1:
../../../../src/main/cpp/kaldi_recognizer.h:35:14: error: no template named 'LookaheadFst' in namespace 'fst'
fst::LookaheadFst<fst::StdArc, int32> *decode_fst_;
~~~~~^
/home/liuyi/Documents/VoiceAssist/kaldi-jni/src/main/cpp/kaldi_recognizer.cc:14:19: error: use of undeclared identifier 'LookaheadComposeFst'
decode_fst_ = LookaheadComposeFst(*model_.hcl_fst_, *model_.g_fst_, model_.disambig_);
^
2 errors generated.
ninja: build stopped: subcommand failed.
> Task :externalNativeBuildDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':externalNativeBuildDebug'.
> Build command failed.
Error while executing process /home/liuyi/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/liuyi/Documents/VoiceAssist/kaldi-jni/.cxx/cmake/debug/arm64-v8a --target kaldi_jni}
[1/4] /home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dkaldi_jni_EXPORTS -I../../../../src/main/cpp -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/src -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/tools/openfst-1.6.8/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O3 -DFST_NO_DYNAMIC_LINKING -O0 -fno-limit-debug-info -fno-experimental-isel -fPIC -MD -MT CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o -MF CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o.d -o CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o -c /home/liuyi/Documents/VoiceAssist/kaldi-jni/build/generated-src/cpp/kaldi_recognizer_wrap.cc
[2/4] /home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dkaldi_jni_EXPORTS -I../../../../src/main/cpp -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/src -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/tools/openfst-1.6.8/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O3 -DFST_NO_DYNAMIC_LINKING -O0 -fno-limit-debug-info -fno-experimental-isel -fPIC -MD -MT CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o -MF CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o.d -o CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o -c /home/liuyi/Documents/VoiceAssist/kaldi-jni/src/main/cpp/kaldi_recognizer.cc
[3/4] /home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dkaldi_jni_EXPORTS -I../../../../src/main/cpp -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/src -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/tools/openfst-1.6.8/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O3 -DFST_NO_DYNAMIC_LINKING -O0 -fno-limit-debug-info -fno-experimental-isel -fPIC -MD -MT CMakeFiles/kaldi_jni.dir/src/main/cpp/model.cc.o -MF CMakeFiles/kaldi_jni.dir/src/main/cpp/model.cc.o.d -o CMakeFiles/kaldi_jni.dir/src/main/cpp/model.cc.o -c /home/liuyi/Documents/VoiceAssist/kaldi-jni/src/main/cpp/model.cc
FAILED: /home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dkaldi_jni_EXPORTS -I../../../../src/main/cpp -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/src -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/tools/openfst-1.6.8/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O3 -DFST_NO_DYNAMIC_LINKING -O0 -fno-limit-debug-info -fno-experimental-isel -fPIC -MD -MT CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o -MF CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o.d -o CMakeFiles/kaldi_jni.dir/build/generated-src/cpp/kaldi_recognizer_wrap.cc.o -c /home/liuyi/Documents/VoiceAssist/kaldi-jni/build/generated-src/cpp/kaldi_recognizer_wrap.cc
In file included from /home/liuyi/Documents/VoiceAssist/kaldi-jni/build/generated-src/cpp/kaldi_recognizer_wrap.cc:236:
../../../../src/main/cpp/kaldi_recognizer.h:35:14: error: no template named 'LookaheadFst' in namespace 'fst'
fst::LookaheadFst<fst::StdArc, int32> *decode_fst_;
~~~~~^
1 error generated.
FAILED: /home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/liuyi/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dkaldi_jni_EXPORTS -I../../../../src/main/cpp -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/src -I/home/liuyi/Documents/VoiceAssist/kaldi-android-renew/tools/openfst-1.6.8/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O3 -DFST_NO_DYNAMIC_LINKING -O0 -fno-limit-debug-info -fno-experimental-isel -fPIC -MD -MT CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o -MF CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o.d -o CMakeFiles/kaldi_jni.dir/src/main/cpp/kaldi_recognizer.cc.o -c /home/liuyi/Documents/VoiceAssist/kaldi-jni/src/main/cpp/kaldi_recognizer.cc
In file included from /home/liuyi/Documents/VoiceAssist/kaldi-jni/src/main/cpp/kaldi_recognizer.cc:1:
../../../../src/main/cpp/kaldi_recognizer.h:35:14: error: no template named 'LookaheadFst' in namespace 'fst'
fst::LookaheadFst<fst::StdArc, int32> *decode_fst_;
~~~~~^
/home/liuyi/Documents/VoiceAssist/kaldi-jni/src/main/cpp/kaldi_recognizer.cc:14:19: error: use of undeclared identifier 'LookaheadComposeFst'
decode_fst_ = LookaheadComposeFst(*model_.hcl_fst_, *model_.g_fst_, model_.disambig_);
^
2 errors generated.
ninja: build stopped: subcommand failed.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 13s
22 actionable tasks: 3 executed, 19 up-to-date

Please let me know if there are any confusions in my explanation here.

Pythonic API design

@nshmyrev this is my idea of "pythonic" api.

import vosk

# print available models
print(vosk.list_models())

# auto downloads the model if not found in local
asr = vosk.load("en-us")

# word_list is optional
# if stream=True, will return iterator for partial results
# if stream=False will return final result
# default stream = False
result = asr.recognize('wav_file_path', word_list, stream=True)

let me know if this is ok or any changes required.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.