alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.73k stars 1.08k forks source link

module 'phonetisaurus' has no attribute 'predict' #1270

Open MI35 opened 1 year ago

MI35 commented 1 year ago

Dear all, running "compile-graph.sh" in kaldi-container get following error:

AttributeError: module 'phonetisaurus' has no attribute 'predict'

# bash compile-graph.sh
+ rm -rf data/extra.lm.gz data/lang_local data/dict data/lang data/lang_test data/lang_test_rescore
+ rm -rf exp/lgraph
+ rm -rf exp/graph
+ mkdir -p data/dict
+ cp db/phone/extra_questions.txt db/phone/nonsilence_phones.txt db/phone/optional_silence.txt db/phone/silence_phones.txt data/dict
+ ./dict.py
Traceback (most recent call last):
  File "./dict.py", line 25, in <module>
      for w, phones in phonetisaurus.predict(new_words, "db/g2p/de.fst"):
AttributeError: module 'phonetisaurus' has no attribute 'predict'
+ ngram-count -wbdiscount -order 4 -text db/extra.txt -lm data/extra.lm.gz
+ ngram -order 4 -lm db/de.lm.gz -mix-lm data/extra.lm.gz -lambda 0.95 -write-lm data/de-mix.lm.gz
[...]

"for w, phones in phonetisaurus.predict" is in your(?) "dict.py". Is it still up to date? My env variables and paths seem to be set correctly -> module 'phonetisaurus' can be found. Many thanks in advance

nshmyrev commented 1 year ago

it is here https://github.com/rhasspy/phonetisaurus-pypi/blob/master/phonetisaurus/__init__.py#L29

MI35 commented 1 year ago

thanks a lot for your quick reply, it works now.

I had already installed phonetisaurus from https://github.com/AdolfVonKleist/Phonetisaurus

so when:

pip3 install phonetisaurus

Requirement already satisfied: phonetisaurus in /usr/local/lib/python3.7/dist-packages/phonetisaurus-0.3-py3.7.egg (0.3)

here was following content (incl. phonetisaurus-0.3-py3.7.egg)

pwd
/usr/local/lib/python3.7/dist-packages
ls
Phonetisaurus.so            argparse-1.4.0-py3.7.egg       easy-install.pth             pybindgen
PyBindGen-0.22.1.dist-info  bottle-0.12.23-py3.7.egg       phonetisaurus-0.3-py3.7.egg

and after reinstalling:

pip3 uninstall phonetisaurus
pip3 install phonetisaurus

got new content (incl. phonetisaurus and phonetisaurus-0.3.0.dist-info)

pwd
/usr/local/lib/python3.7/dist-packages
ls
Phonetisaurus.so            argparse-1.4.0-py3.7.egg  easy-install.pth  phonetisaurus-0.3.0.dist-info
PyBindGen-0.22.1.dist-info  bottle-0.12.23-py3.7.egg   phonetisaurus     pybindgen
nshmyrev commented 1 year ago

We need to move to seq2seq model one day