clips / pattern

Web mining module for Python, with tools for scraping, natural language processing, machine learning, network analysis and visualization.
https://github.com/clips/pattern/wiki
BSD 3-Clause "New" or "Revised" License
8.72k stars 1.58k forks source link

[BUG] AttributeError: 'unicode' object has no attribute 'synonyms' #240

Open nhat2008 opened 6 years ago

nhat2008 commented 6 years ago

When i use

from pattern.text.en import sentiment sentiment('c-53')

the error: AttributeError: 'unicode' object has no attribute 'synonyms' shows up.

nvinayvarma189 commented 5 years ago

well, I'm getting this error: AttributeError: 'str' object has no attribute 'synonyms'. I'm getting this when I try to do these things:

>>> from pattern.text.en import sentiment >>> sentiment("a-00193480")

and

>>> from pattern.text.en import Sentiment >>> a = Sentiment() >>> a("a-00193480")

When the input string is of the form r"^[acdnrv][-_][0-9]+$", then this error occurs on line 2441 in text/__init__.py. The string that was passed will not have synonyms, id, or pos attributes. This is causing the error. I'm not sure where these attributes came from or what this line is intended to do. Knowing this will help us solve this issue. @markus-beuckelmann @tom-de-smedt .