with_stress=True generates "unexpected keyword argument" error
Closed this issue · 2 comments
Describe the bug
When launching the code
phonemized = backend.phonemize([to_print], separator=separator, with_stress=True)
I get the following error
TypeError: phonemize() got an unexpected keyword argument 'with_stress'
Phonemizer version
phonemizer-3.2.1
available backends: espeak-ng-1.50, segments-2.2.1
System
Linux mint Cinnamon, Python 3.9.2
To reproduce
from phonemizer.backend import EspeakBackend
from phonemizer.separator import Separator
backend = EspeakBackend('it')
separator = Separator(phone="-", word="|")
phonemized = backend.phonemize(["hello","world"], separator=separator, with_stress=True)
print(phonemized)
Expected behavior
I expect no error and output of the phones list with phones stresses.
Hi, the ẁith_stress` argument must be specified in the backend init, not the phonemize method:
In [3]: from phonemizer.backend import EspeakBackend
...: from phonemizer.separator import Separator
...: backend = EspeakBackend('it', with_stress=True)
...: separator = Separator(phone="-", word="|")
...: phonemized = backend.phonemize(["hello","world"], separator=separator)
See also here. The documentation should be clearer.
Yes, works great thanks. Forgive me, I occasionally code on python but I am not very expert on the OO part; so the docs are a bit complicated to me on occasions. Also I was very tired. So I don't know if the docs are ok or not.