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

with_stress=True generates "unexpected keyword argument" error #150

Closed
RiccaDS opened this issue Apr 10, 2023 · 2 comments
Closed

with_stress=True generates "unexpected keyword argument" error #150

RiccaDS opened this issue Apr 10, 2023 · 2 comments

Comments

@RiccaDS
Copy link

RiccaDS commented Apr 10, 2023

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.

@RiccaDS RiccaDS changed the title with_stree=True generates "unexpected keyword argument" error with_stress=True generates "unexpected keyword argument" error Apr 10, 2023
@mmmaat
Copy link
Collaborator

mmmaat commented Apr 11, 2023

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.

@RiccaDS
Copy link
Author

RiccaDS commented Apr 12, 2023

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.

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