Apr-14-2021, 08:10 AM
(Apr-14-2021, 07:38 AM)supuflounder Wrote: The code you are showing and the code that produced the error message are not the same code. For example, the error is shown on line 10, but that line is line 14 in the source you show. So there is no way to know what is going on. Make sure that the code and the output you get correspond.
As I read the code, you are using TextBlob-style operations on a string. This makes no sense. If you wanted to
inputSentence ['TextBlob_Subjectivity'] = inputSentence['inputSentence'].apply(getSubjectivity)then inputSentence must be a TextBlob, which it is not. The error message is correct. You are trying to subscript a string using an invalid subscript.
Yes, this code was written part by part in jupyter notebook, i had rearranged for it to post. for the record, Sentiment analysis definition is a separate code, which is throwing error when calling it at run time "sentiment_analysis(sentence)".