forked from gooberinc/goober
kill me
This commit is contained in:
parent
378aca4b0e
commit
6db0081fab
3 changed files with 14 additions and 13 deletions
|
@ -5,9 +5,7 @@ from modules.volta.main import _
|
|||
import spacy
|
||||
from spacy.tokens import Doc
|
||||
from spacytextblob.spacytextblob import SpacyTextBlob
|
||||
nlp = spacy.load("en_core_web_sm")
|
||||
nlp.add_pipe("spacytextblob")
|
||||
Doc.set_extension("polarity", getter=lambda doc: doc._.blob.polarity)
|
||||
|
||||
|
||||
def check_resources():
|
||||
try:
|
||||
|
@ -22,6 +20,10 @@ def check_resources():
|
|||
|
||||
check_resources()
|
||||
|
||||
nlp = spacy.load("en_core_web_sm")
|
||||
nlp.add_pipe("spacytextblob")
|
||||
Doc.set_extension("polarity", getter=lambda doc: doc._.blob.polarity)
|
||||
|
||||
def is_positive(sentence):
|
||||
doc = nlp(sentence)
|
||||
sentiment_score = doc._.polarity # from spacytextblob
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue