基于词库的方法识别实体类别
import pandas as pdimport numpy as np
ciku_data = pd.read_csv('ciku.csv',header=None,names=['A','B'], encoding='utf-8')
A = ciku_data['A']
B = ciku_data['B']
dic = {"A":B,"A":B,"A":B,"A":B,"A":B,"A":B}
with open('example.txt','r',encoding='utf-8') as f:
word_list = []
for line in f:
for word in line.split():
word_list.append(word)
for i in range(len(word_list)):
for j in range(len(A)):
if word_list == A:
print(A,B)
页:
[1]