medianeuroscience / emfdscore

Fast, flexible extraction of moral information from textual input data.
GNU General Public License v3.0
102 stars 28 forks source link

ValueError: [E966] #5

Closed Sunhaha520 closed 3 years ago

Sunhaha520 commented 3 years ago

HI

When I run it,I have this problem. What should I do?Thank you very much!

Running eMFDscore
Total number of input texts to be scored: 500
Traceback (most recent call last):
  File "/home/sunzhenyu/anaconda3/bin/emfdscore", line 67, in <module>
    df = score_docs(csv,DICT_TYPE,PROB_MAP,SCORE_METHOD,OUT_METRICS,num_docs)
  File "/home/sunzhenyu/anaconda3/lib/python3.8/site-packages/emfdscore/scoring.py", line 326, in score_docs
    nlp.add_pipe(tokenizer, name="mfd_tokenizer")
  File "/home/sunzhenyu/anaconda3/lib/python3.8/site-packages/spacy/language.py", line 748, in add_pipe
    raise ValueError(err)
ValueError: [E966] `nlp.add_pipe` now takes the string name of the registered component factory, not a callable component. Expected string, but got <function tokenizer at 0x7f361009ff70> (name: 'mfd_tokenizer').

- If you created your component with `nlp.create_pipe('name')`: remove nlp.create_pipe and call `nlp.add_pipe('name')` instead.

- If you passed in a component like `TextCategorizer()`: call `nlp.add_pipe` with the string name instead, e.g. `nlp.add_pipe('textcat')`.

- If you're using a custom component: Add the decorator `@Language.component` (for function components) or `@Language.factory` (for class components / factories) to your custom component and assign it a name, e.g. `@Language.component('your_name')`. You can then run `nlp.add_pipe('your_name')` to add it to the pipeline.
fhopp commented 3 years ago

Hi there, thanks for the notice. This error was caused by spacy's latest updates to language components. Should be resolved now and work smoothly. Please reinstall emfdscore (ideally in a virtual environment as described in the install instructions). Let me know if you have further issues. Thanks

Sunhaha520 commented 3 years ago

Hi there,

thanks for the notice. This error was caused by spacy's latest updates to language components.

Should be resolved now and work smoothly. Please reinstall emfdscore (ideally in a virtual environment as described in the install instructions).

Let me know if you have further issues.

Thanks

Thank you very much! Problem solved!