将嵌套列表中的单词词形还原

问题描述

如何将嵌套列表中的单词词形还原成一行?我尝试了几件事,我越来越接近了,但我想我的语法可能有问题?我该如何解决?

from nltk.stem import WordNetLemmatizer 
lemmatizer = WordNetLemmatizer()
word_list = [['test','exams','projects'],['math','exam','things']]
word_list # type list

Try #1: Does the lemmatization but in different format
for word in word_list:
    for e in word: 
        print(lemmatizer.lemmatize(e)) # not the result I need for 

Try #2: Looking for similar approach in one line to solve the problem. Not giving correct results. 
[[word for word in lemmatizer.lemmatize(str(doc))] for doc in word_list]

Output needed: 

[['test','project'],'thing']]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)