master
Zovjsra 5 years ago
commit d4c50b5147

1
.gitignore vendored

@ -1,3 +1,4 @@
.vscode/
nohup.out
data/
__pycache__

@ -126,4 +126,4 @@ def initPage():
if __name__ == "__main__":
app.run(debug=False, port=4980, host='0.0.0.0', threaded=True)
app.run(debug=True, port=4999, host='0.0.0.0', threaded=True)

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

Loading…
Cancel
Save