Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"IndexError: list assignment index out of range" "when using "--words-mistach remove" #181

Open
facilitas opened this issue Oct 16, 2024 · 2 comments

Comments

@facilitas
Copy link

Describe the bug
Phonemizer reports "IndexError: list assignment index out of range" "when using "--words-mistach remove" to generate IPAs

Phonemizer version

phonemizer-3.3.0
available backends: espeak-ng-1.51, segments-2.2.1
uninstalled backends: espeak-mbrola, festival

System
WSL Debian 12 guest on Windows 10 host
Python 3.11.2

To reproduce

user@DESKTOP:~/phonemizer$ cat ~/ipa/ch2.txt | phonemize -q -o ~/ipa/phones.txt -l en-gb-x-rp -b espeak --preserve-punctuation --strip --words-mismatch remove
Traceback (most recent call last):
  File "/home/user/.local/bin/phonemize", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/.local/pipx/venvs/phonemizer/lib/python3.11/site-packages/phonemizer/main.py", line 48, in __call__
    self.function()
  File "/home/user/.local/pipx/venvs/phonemizer/lib/python3.11/site-packages/phonemizer/main.py", line 400, in main
    out = phonemize(
          ^^^^^^^^^^
  File "/home/user/.local/pipx/venvs/phonemizer/lib/python3.11/site-packages/phonemizer/phonemize.py", line 227, in phonemize
    return _phonemize(phonemizer, text, separator, strip, njobs, prepend_text, preserve_empty_lines)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/pipx/venvs/phonemizer/lib/python3.11/site-packages/phonemizer/phonemize.py", line 310, in _phonemize
    phonemized = backend.phonemize(
                 ^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/pipx/venvs/phonemizer/lib/python3.11/site-packages/phonemizer/backend/base.py", line 207, in phonemize
    return self._phonemize_postprocess(phonemized, punctuation_marks, separator, strip)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/pipx/venvs/phonemizer/lib/python3.11/site-packages/phonemizer/backend/espeak/espeak.py", line 157, in _phonemize_postprocess
    return self._words_mismatch.process(phonemized)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/pipx/venvs/phonemizer/lib/python3.11/site-packages/phonemizer/backend/espeak/words_mismatch.py", line 151, in process
    text[index] = ''
    ~~~~^^^^^^^
IndexError: list assignment index out of range

Expected behavior
No errors on running the commands, and that the merged words are separated in the output as what the --words-mismatch option is supposed to do

@mmmaat
Copy link
Collaborator

mmmaat commented Oct 16, 2024

Hi, this is indeed a bug in phonemizer. Please can you extract the problematic line in your ~/ipa/ch2.txt and send it here? Need an example to dig on.

@facilitas
Copy link
Author

Hi, this is indeed a bug in phonemizer. Please can you extract the problematic line in your ~/ipa/ch2.txt and send it here? Need an example to dig on.

Hello @mmmaat, thank you for the reply. The input file is here because the Github client says error uploading the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants