1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-08-24 02:22:20 +00:00

Fixed sentiment-basic plugin that only retrieved Neutral sentiment. This closes senpy/senpy-plugins-community#6. Also added nltk download for some plugins.

This commit is contained in:
militarpancho
2017-04-17 13:57:27 +02:00
parent 85db4db01d
commit e341cc82fa
3 changed files with 6 additions and 19 deletions

View File

@@ -9,7 +9,6 @@ import string
import xml.etree.ElementTree as ET
from nltk.corpus import stopwords
from nltk.corpus import WordNetCorpusReader
from emotion import Emotion as Emo
from pattern.en import parse
from senpy.plugins import EmotionPlugin, SenpyPlugin, ShelfMixin
@@ -51,6 +50,8 @@ class EmotionTextPlugin(EmotionPlugin, ShelfMixin):
Emo.emotions[name] = Emo(name, elem.get("isa"))
def activate(self, *args, **kwargs):
nltk.download('stopwords')
self._stopwords = stopwords.words('english')
#local_path=os.path.dirname(os.path.abspath(__file__))
self._categories = {'anger': ['general-dislike',],
@@ -81,8 +82,6 @@ class EmotionTextPlugin(EmotionPlugin, ShelfMixin):
self._wn16 = self.sh['wn16']
def deactivate(self, *args, **kwargs):
self.save()