Keyword . Score
fabulous 7.526
excellent 7.247
superb 7.199
alert 7.099
drop 6.922
#Tokenized tweets below
["b'just", 'saw', 'amazon', 'ticwatch', 'pro', '4g/lte', 'smartwatch', 'dual', 'displa', '...', 'mobvoi', '299.00']
["b'amazon", 'pricedrop', 'deal', '\\nprice', 'drop', 'alert', 'camelbak', 'eddy', 'kids', 'vacuum', 'insulated', 'stainless', 'steel', 'bottle', '12', 'oz', 'retro', 'floral\\navg', 'price', '16.00\\nnew', 'price', '12.17\\nprice', 'drop', '23.94', '\\nURL']
For each list i want to see a sum of score that matches a key word E.g
Tweet 1 - 12.22
Tweet 2 - 7
Is there any library which will allow me to find words like this? Any help in this front is appreciated
if you have dataframe of keyword and score, you can use zip function as
list_ = list(df['keyword'],df['score'])
list_ = [('fabulous',7.526),('excellent',7.247), ('super',7.199),('alert',7.099),('drop',6.922)]
tweet_token = [['fabulous', 'excellent','super','alert','drop'],['super', 'alert']]
sum_ = []
for j in range(len(tweet_token)):
sum_tweet = 0
for i in range(len(list_)):
for token in tweet_token[j]:
if token == list_[i][0]:
sum_tweet += list_[i][1]
sum_.append(sum_tweet)
#op
print(sum_)
[35.993, 14.298]