def get_maxlens(train_data, test_data):
story_maxlen, question_maxlen = 0, 0
for stories, questions, _ in [train_data, test_data]:
for story in stories:
story_len = 0
for sent in story:
swords = nltk.word_tokenize(sent)
story_len += len(swords)
if story_len > story_maxlen:
story_maxlen = story_len
for question in questions:
question_len = len(nltk.word_tokenize(question))
if question_len > question_maxlen:
question_maxlen = question_len
return story_maxlen, question_maxlen
mem-network.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录