I have a dataframe which contains reviews, as well as two lists, one which stores nouns and the other storing verbs/adjectives.
Example code:
import pandas as pd
data = {'reviews':['Very professional operation. Room is very clean and comfortable',
'Daniel is the most amazing host! His place is extremely clean, and he provides everything you could possibly want (comfy bed, guidebooks & maps, mini-fridge, towels, even toiletries). He is extremely friendly and helpful.',
'The room is very quiet, and well decorated, very clean.',
'He provides the room with towels, tea, coffee and a wardrobe.',
'Daniel is a great host. Always recomendable.',
'My friend and I were very satisfied with our stay in his apartment.']}
df = pd.DataFrame(data)
nouns = ['place','Amsterdam','apartment','location','host','stay','city','room','everything','time','house',
'area','home','’','center','restaurants','centre','Great','tram','très','minutes','walk','space','neighborhood',
'à','station','bed','experience','hosts','Thank','bien']
verbs_adj = ['was','is','great','nice','had','clean','were','recommend','stay','are','good','perfect','comfortable',
'have','easy','be','quiet','helpful','get','beautiful',"'s",'has','est','located','un','amazing','wonderful',]
Using the dataframe and two lists, how can I create a function which returns a dictionary of dictionaries of the co-occurrences of verbs and adjectives for the nouns in each review? My ideal output would be:
Example review: 'A big restaurant served delicious food in big dishes'
>>> {‘restaurant’: {‘big’: 2, ‘served’:1, ‘delicious’:1}}