How to iterate through each line of a text file and get the sentiment of those lines using python?
问题 Currently, I'm working on Sentiment Analysis part. For this I have preferred to use Standford Core NLP library using python. I'm able to get the sentiment for each sentence using the following code : from pycorenlp import StanfordCoreNLP nlp = StanfordCoreNLP('http://localhost:9000') res = nlp.annotate("I love you. I hate him. You are nice. He is dumb", properties={ 'annotators': 'sentiment', 'outputFormat': 'json', 'timeout': 1000, }) for s in res["sentences"]: print("%d: '%s': %s %s" % ( s[