MCPcopy Create free account
hub / github.com/clips/pattern / sentiment

Class sentiment

pattern/text/en/wordnet/__init__.py:431–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429# Older code may be using pattern.en.wordnet.sentiment[w],
430# which yields a (positive, negative, neutral)-tuple.
431class sentiment(object):
432
433 def load(self, **kwargs):
434 sentiwordnet.load(**kwargs)
435
436 def __getitem__(self, w):
437 p, s = sentiwordnet.get(w, (0.0, 0.0))
438 return p < 0 and (0.0, -p, 1.0-s) or (p, 0.0, 1.0-s)
439
440 def __contains__(self, w):
441 return w in sentiwordnet
442
443sentiment = sentiment()
444

Callers 10

07-sentiment.pyFile · 0.90
__init__.pyFile · 0.70
polarityFunction · 0.50
subjectivityFunction · 0.50
polarityFunction · 0.50
subjectivityFunction · 0.50
polarityFunction · 0.50
subjectivityFunction · 0.50
polarityFunction · 0.50
subjectivityFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…