markuskiller / textblob-de

German language support for TextBlob.
https://textblob-de.readthedocs.org
MIT License
104 stars 12 forks source link

Sentiment for space + period #4

Closed Hocdoc closed 10 years ago

Hocdoc commented 10 years ago

When I try TextBlobDE(u" .").sentiment I get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/textblob/decorators.py", line 24, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/lib/python2.7/site-packages/textblob_de/blob.py", line 629, in sentiment
    _polarity += s.polarity
  File "/usr/lib/python2.7/site-packages/textblob/decorators.py", line 24, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/lib/python2.7/site-packages/textblob_de/blob.py", line 395, in polarity
    return self.sentiment[0]
  File "/usr/lib/python2.7/site-packages/textblob/decorators.py", line 24, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/lib/python2.7/site-packages/textblob_de/blob.py", line 387, in sentiment
    return self.analyzer.analyze(self.raw)
  File "/usr/lib/python2.7/site-packages/textblob_de/sentiments.py", line 142, in analyze
    text = self._lemmatize(text)
  File "/usr/lib/python2.7/site-packages/textblob_de/sentiments.py", line 147, in _lemmatize
    _lemmas = self.lemmatizer.lemmatize(raw)
  File "/usr/lib/python2.7/site-packages/textblob_de/lemmatizers.py", line 62, in lemmatize
    if w[0].isupper() and i > 0:
IndexError: string index out of range
markuskiller commented 10 years ago

Thanks for the reports I'll try to make those methods more robust.

markuskiller commented 10 years ago

Latest release on PyPI (0.2.9) reflects the changes: https://pypi.python.org/pypi/textblob-de