dataclass_transform() got an unexpected keyword argument 'field_specifiers'

I am trying to work with this G2P package. But I am getting dataclass_transform() got an unexpected keyword argument 'field_specifiers' this error. I am trying to run their sample code that they have provided there after running !pip install g2p_en in my jupyter notebook. The sample code for which I am getting the error is attached below. Can someone please help me with the issue?

from g2p_en import G2p

texts = ["I have $250 in my pocket.", # number -> spell-out
         "popular pets, e.g. cats and dogs", # e.g. -> for example
         "I refuse to collect the refuse around here.", # homograph
         "I'm an activationist."] # newly coined word
g2p = G2p()
for text in texts:
    out = g2p(text)

>Solution :

Install the package from the anaconda base location (assuming you are using anaconda for jupyter notebook) with this command

conda install -c conda-forge g2p-en

Then simply import from g2p_en import G2p and run the example code. For me it did the job. There are various dependencies on anaconda base level which are not fully satisfied when you install the package from the jupyter lab only. You need to install from anaconda base location sometimes to make it work.

Leave a Reply