I am using
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
analyser = SentimentIntensityAnalyzer()
def parToSent(para):
mylst = sent_tokenize(para)
return mylst
def analyzr(txt):
mylst = parToSent(txt)
for i in mylst:
scr = analyser.polarity_scores(i)
print(scr, "\n")
and pass some paragraph to the below function:
analyzr(par)
The output comes in this format:
{'neg': 0.081, 'neu': 0.919, 'pos': 0.0, 'compound': -0.296}
I want to get this output into a dataframe like this:
neg neu pos compound
0.081 0.919 0.0 -0.269
how can it be done in a function?