Adding words to calculate the sentiment

46 views
Skip to first unread message

Ensar C

unread,
Nov 16, 2015, 6:49:10 PM11/16/15
to Pattern
Greetings,

So I have been using Pattern (nl) for quite a time now. It's great and really helps me, but every now and then I see that it does not reconize some words.
I thought about adding them myself in pattern-2.6\pattern\text\nl\nl-sentiment.xml and give them a polarity, but after saving that and trying it out again, it gives the same results as before. Even if I adjust the polarity of words that already excisted, I still get the same score as it used to be.

Did I miss something or is it just not possible to adjust the sentiment list?


punforgettable

unread,
May 24, 2017, 11:36:44 AM5/24/17
to Pattern
So this is verrryyyy late but maybe you still need help. Here is Tom's advice which helped me in your situation:
--------------------
It is not difficult to extend Pattern's lexicon with your own scores: 

from pattern.en import sentiment 
sentiment.annotate("wicked party", polarity=0.7) 
sentiment.annotate("nice job stupid", polarity=-0.9) 
print sentiment("wicked party this weekend!") 

Have a look at the Sentiment.annotate() method in pattern/text/__init__.py 
------------------

Best of luck!
Reply all
Reply to author
Forward
0 new messages