tallied.append(tally/len(z)) elif tally<0: final ='NEG' tallied.append(tally/len(z)) elif tally==0: final ='NEU' tallied.append(tally) score.append(final) ftally.append(tally) """ add column to dataframe based on list """ train['New_Rating']=score train['Tally']=ftally train['Pct']=tallied train['Sentiment1']=APIsent train['Sentiment2']= Indisent train.to_csv('revised_NYC_comments_train.csv') """ text collection exploration """ """ reviewcollection.concordance("very") #word concordance for every review fdist1 = FreqDist(reviewcollection) #frequency distribution of text, indexed fdist1.most_common(10) #most frequent 10 words wdpairs = list(bigrams(reviewcollection)) #all pairs of words that occur together in the text reviewcollection.collocations() #returns most frequent pairs reviewcollection.findall(r"<very> <.*>") #find phrases in text with a specific pattern """