|
|
@ -91,35 +91,35 @@ def filterPOS(content, aid):
|
|
|
|
startTime = time()
|
|
|
|
startTime = time()
|
|
|
|
cutted = []
|
|
|
|
cutted = []
|
|
|
|
for i in cuttedWithPOS:
|
|
|
|
for i in cuttedWithPOS:
|
|
|
|
if (i.flag[0] == 'n' or i.flag[0] == 'N'):
|
|
|
|
if (i['flag'][0] == 'n' or i['flag'][0] == 'N'):
|
|
|
|
if (pos['noun']):
|
|
|
|
if (pos['noun']):
|
|
|
|
cutted.append(i.word)
|
|
|
|
cutted.append(i['word'])
|
|
|
|
elif (i.flag[0] == 'v' or (i.flag[0] == 'V' and i.flag != 'Vi')):
|
|
|
|
elif (i['flag'][0] == 'v' or (i['flag'][0] == 'V' and i['flag'] != 'Vi')):
|
|
|
|
if (pos['verb']):
|
|
|
|
if (pos['verb']):
|
|
|
|
cutted.append(i.word)
|
|
|
|
cutted.append(i['word'])
|
|
|
|
elif (i.flag == 'Vi'):
|
|
|
|
elif (i['flag'] == 'Vi'):
|
|
|
|
if (pos['adj']):
|
|
|
|
if (pos['adj']):
|
|
|
|
cutted.append(i.word)
|
|
|
|
cutted.append(i['word'])
|
|
|
|
elif (i.flag == 'ADV'):
|
|
|
|
elif (i['flag'] == 'ADV'):
|
|
|
|
if (pos['adv']):
|
|
|
|
if (pos['adv']):
|
|
|
|
cutted.append(i.word)
|
|
|
|
cutted.append(i['word'])
|
|
|
|
elif (i.flag == 'r'):
|
|
|
|
elif (i['flag'] == 'r'):
|
|
|
|
if (pos['pron']):
|
|
|
|
if (pos['pron']):
|
|
|
|
cutted.append(i.word)
|
|
|
|
cutted.append(i['word'])
|
|
|
|
elif (i.flag == 'POST' or i.flag == 'T'):
|
|
|
|
elif (i['flag'] == 'POST' or i['flag'] == 'T'):
|
|
|
|
if (pos['aux']):
|
|
|
|
if (pos['aux']):
|
|
|
|
cutted.append(i.word)
|
|
|
|
cutted.append(i['word'])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if (pos['other']):
|
|
|
|
if (pos['other']):
|
|
|
|
if(i.flag != 'eng' and i.flag != 'x' and i.flag != 'm'):
|
|
|
|
if(i['flag'] != 'eng' and i['flag'] != 'x' and i['flag'] != 'm'):
|
|
|
|
cutted.append(i.word)
|
|
|
|
cutted.append(i['word'])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if (i.word == content['keyword']):
|
|
|
|
if (i['word'] == content['keyword']):
|
|
|
|
cutted.append(i.word)
|
|
|
|
cutted.append(i['word'])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
cuttedWithPOS = data.posseg(aid)
|
|
|
|
cuttedWithPOS = data.posseg(aid)
|
|
|
|
cutted = [i.word for i in cuttedWithPOS if (
|
|
|
|
cutted = [i['word'] for i in cuttedWithPOS if (
|
|
|
|
i.flag != 'eng' and i.flag != 'x' and i.flag != 'm')]
|
|
|
|
i['flag'] != 'eng' and i['flag'] != 'x' and i['flag'] != 'm')]
|
|
|
|
if('stopwords' in content):
|
|
|
|
if('stopwords' in content):
|
|
|
|
stopwords = content['stopwords']
|
|
|
|
stopwords = content['stopwords']
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|