Python中两个字符串中的类似句子

2024-05-13 18:16:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我必须使用以下方法编写在“text1”和“text2”中查找类似句子的函数:

  1. Word overlap: What proportion of words from sentence 1 appear in sentence 2?
  2. Stopword removal: What proportion of words from sentence 1 appear in sentence 2 after you removed all the stopwords from the sentences?
  3. Stemming: What proportion of words from sentence 1 appear in sentence 2 when you compare the (approximated) stems?
  4. Lemmatizing: What proportion of words from sentence 1 appear in sentence 2 when you compare the lemmas?

我已经分别标记了句子和单词,去掉了标点和数字。 我知道如何执行'停止词删除','词干'和'柠檬化'。我只是没能以一种有效的方式设置我的程序来达到我的目标。你知道吗

我想把每一个单词从text1中的一个句子中提取出来,检查是否有可能在text2中的一个句子中找到它,并找出文本中相似句子的百分比。。。你知道吗


Tags: oftheinfromyouwhatsentence句子