【发布时间】:2021-02-21 13:41:17
【问题描述】:
我需要返回一个包含关键字的文本。让我们考虑以下示例:
keyword = "configure"
texts = [
"The system configuration document should be uploaded to the repository. Please contact the dev team.",
"To do the system setup, please follow the instructions."
]
关键字configure 没有出现在任何文本中。但是类似的词configuration出现在第一句。因此预期的输出是:
The system configuration document should be uploaded to the repository. Please contact the dev team.
我知道可以计算[单词和文本之间的语义相似度][1]。但是,对于我的案例,它经常返回不准确的结果。
我正在评估的另一种方法是应用词干提取和词形还原。但是,configure 和 configuration 有不同的词干。
最后我还考虑了Word2Vec 模型...但是,在这种情况下,我不确定如何有效地使用这种方法。
import gensim.downloader as api
word_vectors = api.load("glove-wiki-gigaword-100")
word_vectors.similarity("configure","configuration")
是否有任何最先进的方法来处理我的任务? [1]:https://medium.com/@adriensieg/text-similarities-da019229c894
【问题讨论】:
标签: python nlp gensim word2vec