# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# + deletable=true editable=true
import pandas as pd
import numpy as np
import itertools

# + deletable=true editable=true
data=pd.read_csv('savedrecs.txt',sep='\t',engine='python',index_col=False)


# + deletable=true editable=true
def getUniqueWords(allWords) :
    uniqueWords = [] 
    for j in allWords:
        if j in uniqueWords:
            pass
        else:
            uniqueWords.append(j)
    return uniqueWords


# -

lines = []
with open("country_list.txt") as file:
    for line in file:
        line = line.strip() #or someother preprocessing
        lines.append(line)
lines

# + deletable=true editable=true
df= data[data['C1'].notnull()]
df_new=df['C1']
print(df_new[2])

for i in df_new.index:
    p=df_new[i].split()
    countries=['USA','Germany','France','China','Japan','Australia','Canada','Brazil','Mexico','South Africa',
           'India','Korea','Israel','Turkey','Saudi Arabia','Iran','Spain','Netherlands','Sweden','Norway',
           'Poland','Indonesia','Brazil','Switzerland','Denmark','Singapore','Iceland','Hong Kong','New Zealand','Belgium',
           'Austria','Italy','Czech','Greece','Qatar','Portugal','Hungary','Argentina','Romania','England',
           'Taiwan','Lithuania','Finland','Russia','Kazakhstan','Afghanistan','Albania']
    count=[]
    for i in p:
        if i not in count:
            for j in countries:
                if (i==j or i==j+';'):
                    count.append(i)
    country_list=[]
    for i in count:
        for j in countries:
            if (i==j or i==j+';'):
                country_list.append(j)
    print(list(set(country_list)))
        


    


# + deletable=true editable=true
count=[]
countries=['France','USA','Japan','Sweden','Germany']
#print(countries)
for i in p:
    if i not in count:
        for j in countries:
            if (i==j or i==j+';'):
                count.append(i)
country_list=[]
for i in count:
    for j in countries:
        if (i==j or i==j+';'):
            country_list.append(j)
print(list(set(country_list)))
        




    


        
# -

country_list=[]
for i in count:
    for j in countries:
        if (i==j or i==j+';'):
            country_list.append(j)
print(list(set(country_list)))
        

# + deletable=true editable=true


# + deletable=true editable=true


StarcoderdataJupyterScriptsDedupFiltered