剑桥双解词典清洗过后并应用
import re
import pandas as pd
df = pd.read_csv(r'..\data\剑桥双解清洗OkGGGGGGG.csv',sep='\t',header=None )
fslip=df.to_dict('split')
# print(fslip)
alst=fslip['data']
#
# print(alst)
lst=[]
key=[]
for i in range(len(alst)):
# for i in range(3):
key.append(alst[i][0])
# print(alst[i][1])
lst.append(re.split(r'[■]+', alst[i][1]))
# print(key)
# print(lst)
data_values = {}
for k,v in zip(key,lst):
# print(k,v)
data_values[k] =v
print(data_values)
print(*data_values['perplex'],sep='\n')
评论已关闭