medianeuroscience / emfdscore

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

Check list before using eMFD #25

Open uless opened 6 months ago

uless commented 6 months ago
  1. SpaCy version should be 3.4.0. (as per my ticket 2 years ago) Otherwise you will see this: Pipeline component 'mfd_tokenizer' returned <class 'list'> instead of a Doc. If you're using a custom component, maybe you forgot to return the processed Doc?

  2. Pandas version should be lower than 2.0.0 (worked with version 1.5.3) Otherwise you will see this: `AttributeError: 'Series' object has no attribute 'iteritems' `

  3. Input dataframe should be heading-less. Just do it, make your input dataframe looks exactly like the template.

natashacarpcast commented 2 weeks ago

Hi @uless could you please share a screenshot of all your packages? I'm having compatibility issues

XintongYao0107 commented 1 week ago

@uless Hi, thanks for the sharing! I keep the version as you posted, but still faces the incompatibility between spacy and pydantic (I guess).

The log is shown as:

Traceback (most recent call last):
  File "emfd5.py", line 14, in <module>
    from emfdscore.scoring import score_docs 
  File "/opt/anaconda3/envs/new-emfd/lib/python3.8/site-packages/emfdscore/scoring.py", line 5, in <module>
    import spacy
  File "/opt/anaconda3/envs/new-emfd/lib/python3.8/site-packages/spacy/__init__.py", line 14, in <module>
    from . import pipeline  # noqa: F401
  File "/opt/anaconda3/envs/new-emfd/lib/python3.8/site-packages/spacy/pipeline/__init__.py", line 1, in <module>
    from .attributeruler import AttributeRuler
  File "/opt/anaconda3/envs/new-emfd/lib/python3.8/site-packages/spacy/pipeline/attributeruler.py", line 6, in <module>
    from .pipe import Pipe
  File "spacy/pipeline/pipe.pyx", line 1, in init spacy.pipeline.pipe
  File "spacy/vocab.pyx", line 1, in init spacy.vocab
  File "/opt/anaconda3/envs/new-emfd/lib/python3.8/site-packages/spacy/tokens/__init__.py", line 1, in <module>
    from .doc import Doc
  File "spacy/tokens/doc.pyx", line 36, in init spacy.tokens.doc
  File "/opt/anaconda3/envs/new-emfd/lib/python3.8/site-packages/spacy/schemas.py", line 222, in <module>
    class TokenPattern(BaseModel):
  File "pydantic/main.py", line 205, in pydantic.main.ModelMetaclass.__new__
  File "pydantic/fields.py", line 491, in pydantic.fields.ModelField.infer
  File "pydantic/fields.py", line 421, in pydantic.fields.ModelField.__init__
  File "pydantic/fields.py", line 537, in pydantic.fields.ModelField.prepare
  File "pydantic/fields.py", line 634, in pydantic.fields.ModelField._type_analysis
  File "pydantic/fields.py", line 641, in pydantic.fields.ModelField._type_analysis
  File "/opt/anaconda3/envs/new-emfd/lib/python3.8/typing.py", line 774, in __subclasscheck__
    return issubclass(cls, self.__origin__)
TypeError: issubclass() arg 1 must be a class

As a reference, I am using Python 3.8 in conda in Mac. SpaCy 3.4.0 and Panda 1.5.3. I am using 1.9.0 for pydantic.

Any suggestions/comments will be appreciated!!