def _first_tagger_before_answer_span(self, question):
"""Get the first tagger before answer span
- Args:
question(string): string of current question
- Returns:
tagger(string): tagger of first term before span
"""
index = 0
text = nltk.word_tokenize(question)
post = nltk.pos_tag(text)
for idx, t in enumerate(post):
if t[0] == "_____":
index = idx - 1
break
try:
return post[index][1]
except IndexError:
return 'dummy'
feature_construction.py 文件源码
python
阅读 31
收藏 0
点赞 0
评论 0
评论列表
文章目录