Jul-04-2018, 04:19 PM
No, it will provide a list of all words in most used order. You can match this to your list simply:
untested and unfinished code:
untested and unfinished code:
from collections import Counter ... # If not already a list: delimiter = '|' # Or whatever it is data_list = result_details.strip().split(delimiter) most_common_list = Counter(data_list).most_common() mc_dict = dict((x, y) for x, y in most_common) print(mc_dict) matches = [] for idx, word in enumerate(MC): try: count = mc_dict[word] matches.append(result_id[idx], word, count) except: continue print(matches)matches will contain a list of all your MC entries that were found with corresponding id and a count of the number of times occurred.