dimanche 3 février 2019

Give values to a sentence from a dictionary

I have 2 inpouts, several tweets in a list ['tweet 1', 'tweet 2',...] and a dictionary with {'word1': value1;'word 2': value2;...}.

Imagine the first tweet is like:

'I love eating potatoes'

And from the 500 words in the dictionary there is a value for

{...;'love': 3;...;'potatoes': -1;...}.

The question is: how can I search in every row if there is/are a value/s for the sentence and give it a final score?

tweet=[]
values={}
    for list in tweet:
        divided_tweet=list.split()

I guess I have to start with this

Thank you all for the help

Aucun commentaire:

Enregistrer un commentaire