bootphon / phonemizer

Simple text to phones converter for multiple languages
https://bootphon.github.io/phonemizer/
GNU General Public License v3.0
1.15k stars 163 forks source link

I'm not able to tell phonemizer where my festival is #134

Closed kylefoley76 closed 1 year ago

kylefoley76 commented 1 year ago

I'm using MACOS 10.14.4.
Phonemizer 3.2.1 I have festival downloaded but I can't figure out how to inform phonemizer where it is. I've down the recommendations listed here

https://github.com/bootphon/phonemizer/issues/20

but that does not help me. How do I tell phonemizer the path of festival?

kylefoley76 commented 1 year ago

I tried to hardcode the path of the festival file like so

_FESTIVAL_EXECUTABLE = '/applications/festival/src/main'

And this is in the festival.py file

but I am getting permission denied errors and this inspite of the fact that I have set all folders and files to read write execute

-rwxrwxrwx@  1 kylefoley  staff  3092 Apr  4  2001 Makefile
drwxrwxrwx@  4 kylefoley  staff   128 Aug 10 23:47 arch
drwxrwxrwx@ 12 kylefoley  staff   384 Aug 10 23:47 include
drwxrwxrwx@  3 kylefoley  staff    96 Aug 10 23:47 lib
drwxrwxrwx@  6 kylefoley  staff   192 Aug 10 23:47 main
drwxrwxrwx@ 21 kylefoley  staff   672 Aug 10 23:47 modules
drwxrwxrwx@ 10 kylefoley  staff   320 Aug 10 23:47 scripts
(venv4) Admins-MacBook-Pro-4:src kylefoley$ chmod 777 Makefile
(venv4) Admins-MacBook-Pro-4:src kylefoley$ ls -l
total 8
-rwxrwxrwx@  1 kylefoley  staff  3092 Apr  4  2001 Makefile
drwxrwxrwx@  4 kylefoley  staff   128 Aug 10 23:47 arch
drwxrwxrwx@ 12 kylefoley  staff   384 Aug 10 23:47 include
drwxrwxrwx@  3 kylefoley  staff    96 Aug 10 23:47 lib
drwxrwxrwx@  6 kylefoley  staff   192 Aug 10 23:47 main
drwxrwxrwx@ 21 kylefoley  staff   672 Aug 10 23:47 modules
drwxrwxrwx@ 10 kylefoley  staff   320 Aug 10 23:47 scripts
(venv4) Admins-MacBook-Pro-4:src kylefoley$ cd ..
(venv4) Admins-MacBook-Pro-4:festival kylefoley$ ls -l
total 400
-rwxrwxrwx@  1 kylefoley  staff   3610 Apr 19  2010 ACKNOWLEDGMENTS
-rwxrwxrwx@  1 kylefoley  staff   5555 Apr 16  2013 COPYING
-rwxrwxrwx@  1 kylefoley  staff  21893 Jul  1  2004 INSTALL
-rwxrwxrwx@  1 kylefoley  staff   4462 Jan 24  2003 Makefile
-rwxrwxrwx@  1 kylefoley  staff   8538 May 28  2001 NEWS
-rwxrwxrwx@  1 kylefoley  staff   2325 Jul  4  2013 README
drwxrwxrwx@  4 kylefoley  staff    128 Aug 10 23:47 bin
drwxrwxrwx@ 14 kylefoley  staff    448 Aug 10 23:47 config
-rwxrwxrwx@  1 kylefoley  staff  38536 Dec 28  2002 config.guess
-rwxrwxrwx@  1 kylefoley  staff  29121 Dec 28  2002 config.sub
-rwxrwxrwx@  1 kylefoley  staff  41026 Apr  4  2001 configure
-rwxrwxrwx@  1 kylefoley  staff   2633 Apr  4  2001 configure.in
drwxrwxrwx@ 20 kylefoley  staff    640 Aug 10 23:47 doc
drwxrwxrwx@ 35 kylefoley  staff   1120 Aug 10 23:47 examples
-rwxrwxrwx@  1 kylefoley  staff   5598 Apr  4  2001 install-sh
drwxrwxrwx@ 71 kylefoley  staff   2272 Aug 10 23:47 lib
-rwxrwxrwx@  1 kylefoley  staff   6283 Apr  4  2001 missing
-rwxrwxrwx@  1 kylefoley  staff    721 Apr  4  2001 mkinstalldirs
drwxrwxrwx@ 10 kylefoley  staff    320 Aug 11 00:11 src
drwxrwxrwx@ 12 kylefoley  staff    384 Aug 10 23:47 testsuite
kylefoley76 commented 1 year ago

Ok, I've made progress. I downloaded festival but didn't realize that I had to do more steps with it after I downloaded it. I used the instructions found here https://gist.github.com/laic/519deca91d50b1ed19307d0c80cb788e

Now when I run on command line

phenomize --version

I get espeak-1.48.3, festival-2.4, segments-2.2.1

However, when I run phenomize on the python IDE editor I'm getting the same error. When I run phenomize on command line which I don't want to do I get

Traceback (most recent call last):
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 431, in _process_worker
    r = call_item()
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 285, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 595, in __call__
    return self.func(*args, **kwargs)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/parallel.py", line 252, in __call__
    return [func(*args, **kwargs)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/parallel.py", line 252, in <listcomp>
    return [func(*args, **kwargs)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/backend/festival/festival.py", line 202, in _phonemize_aux
    text = self._process(text)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/backend/festival/festival.py", line 274, in _process
    return self._run_festival(cmd, fstderr)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/backend/festival/festival.py", line 297, in _run_festival
    raise RuntimeError(
RuntimeError: Command "/Applications/festival/src/main/festival -b /var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/tmpc930vdr_" returned exit status 255, output is:
-=-=-=-=-=- EST Error -=-=-=-=-=-
{FND} Feature Token_Method not defined

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
closing a file left open: /var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/tmpc930vdr_

"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/phonemize.py", line 227, in phonemize
    return _phonemize(phonemizer, text, separator, strip, njobs, prepend_text, preserve_empty_lines)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/phonemize.py", line 310, in _phonemize
    phonemized = backend.phonemize(
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/backend/base.py", line 198, in phonemize
    phonemized = joblib.Parallel(n_jobs=njobs)(
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/parallel.py", line 1042, in __call__
    self.retrieve()
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/parallel.py", line 921, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 542, in wrap_future_result
    return future.result(timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
RuntimeError: Command "/Applications/festival/src/main/festival -b /var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/tmpc930vdr_" returned exit status 255, output is:
-=-=-=-=-=- EST Error -=-=-=-=-=-
{FND} Feature Token_Method not defined

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
closing a file left open: /var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/tmpc930vdr_

>>>     url = ('https://gist.githubusercontent.com/CorentinJ/0bc27814d93510ae8b6fe4516dc6981d/raw/bb6e852b05f5bc918a9a3cb439afe7e2de570312/small_corpus.txt')
  File "<stdin>", line 1
    url = ('https://gist.githubusercontent.com/CorentinJ/0bc27814d93510ae8b6fe4516dc6981d/raw/bb6e852b05f5bc918a9a3cb439afe7e2de570312/small_corpus.txt')
    ^
IndentationError: unexpected indent
>>> url = ('https://gist.githubusercontent.com/CorentinJ/0bc27814d93510ae8b6fe4516dc6981d/raw/bb6e852b05f5bc918a9a3cb439afe7e2de570312/small_corpus.txt')
>>>     text = requests.get(url).content.decode()
  File "<stdin>", line 1
    text = requests.get(url).content.decode()
    ^
IndentationError: unexpected indent
>>>     text = [line.strip() for line in text.split('\n') if line]
  File "<stdin>", line 1
    text = [line.strip() for line in text.split('\n') if line]
    ^
IndentationError: unexpected indent
>>> text = requests.get(url).content.decode()
>>> text = [line.strip() for line in text.split('\n') if line]
>>> phn = phonemize(text,language='en-us',backend='festival',separator=Separator(phone=None, word=' ', syllable='|'),strip=True,preserve_punctuation=True,njobs=4)
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 431, in _process_worker
    r = call_item()
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 285, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 595, in __call__
    return self.func(*args, **kwargs)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/parallel.py", line 252, in __call__
    return [func(*args, **kwargs)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/parallel.py", line 252, in <listcomp>
    return [func(*args, **kwargs)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/backend/festival/festival.py", line 202, in _phonemize_aux
    text = self._process(text)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/backend/festival/festival.py", line 274, in _process
    return self._run_festival(cmd, fstderr)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/backend/festival/festival.py", line 297, in _run_festival
    raise RuntimeError(
RuntimeError: Command "/Applications/festival/src/main/festival -b /var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/tmp59if64v2" returned exit status 255, output is:
-=-=-=-=-=- EST Error -=-=-=-=-=-
{FND} Feature Token_Method not defined

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
closing a file left open: /var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/tmp59if64v2

"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/phonemize.py", line 227, in phonemize
    return _phonemize(phonemizer, text, separator, strip, njobs, prepend_text, preserve_empty_lines)
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/phonemize.py", line 310, in _phonemize
    phonemized = backend.phonemize(
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/phonemizer/backend/base.py", line 198, in phonemize
    phonemized = joblib.Parallel(n_jobs=njobs)(
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/parallel.py", line 1042, in __call__
    self.retrieve()
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/parallel.py", line 921, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/Users/kylefoley/Documents/pcode/venv4/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 542, in wrap_future_result
    return future.result(timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
RuntimeError: Command "/Applications/festival/src/main/festival -b /var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/tmp59if64v2" returned exit status 255, output is:
-=-=-=-=-=- EST Error -=-=-=-=-=-
{FND} Feature Token_Method not defined

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
closing a file left open: /var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/tmp59if64v2
kylefoley76 commented 1 year ago

I couldn't figure out how to get my shell environment variables and the python environment variables to be the same, so on line 127 in festival.py I hardcoded as follows:

os.environ['PATH'] += ':/applications/festival/bin'

I then got the same error as I did with command line. However, this is a new issue unrelated to the previous so I will have to start a new issue if I can't solve it.