Ich versuche, Naive Bayes-Algorithmus für die Sentiment-Analyse von News Paper Schlagzeilen zu implementieren. Ich verwende TextBlob für diesen Zweck und ich finde es schwierig, Stoppwörter wie ‚a‘, ‚der‘, ‚in‘ usw. Im Folgenden zu entfernen, ist der Ausschnitt aus meinem Code in Python:Welches ist der effiziente Weg, um Stoppwörter in Textblob für Sentiment-Analyse von Text zu entfernen?
from textblob.classifiers import NaiveBayesClassifier
from textblob import TextBlob
test = [
("11 bonded labourers saved from shoe firm", "pos"),
("Scientists greet Abdul Kalam after the successful launch of Agni on May 22, 1989","pos"),
("Heavy Winter Snow Storm Lashes Out In Northeast US", "neg"),
("Apparent Strike On Gaza Tunnels Kills 2 Palestinians", "neg")
]
with open('input.json', 'r') as fp:
cl = NaiveBayesClassifier(fp, format="json")
print(cl.classify("Oil ends year with biggest gain since 2009")) # "pos"
print(cl.classify("25 dead in Baghdad blasts")) # "neg"