def _identify_pronoun2(self, sentence):
"""Calculate percentage of pronouns in the sentence that are in the answer
- Args:
sentence(str): question sentence
- Returns:
pronoun_in_sentence(list): pronouns in sentence
sentence_len(int): length of current sentence
"""
text = nltk.word_tokenize(sentence)
post = nltk.pos_tag(text)
pronoun_list = ['PRP', 'PRP$', 'WP', 'WP$']
pronoun_in_sentence = []
sentence_len = len(post)
for k, v in post:
if v in pronoun_list:
pronoun_in_sentence.append(k)
return pronoun_in_sentence, sentence_len
feature_construction.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录