有没有办法找到一个单词与NLTK最常见的同义词?我想使用每个单词的最常见同义词来简化句子.
如果句子中使用的单词已经是同义词组中最常用的单词,则不应更改.
让我们说"嗨"比"你好"更常见; "亲爱的"比"有价值"更常见; 而"朋友"已经是其组同义词中最常见的词.
Input: "Hello my valued friend"
Return: "Hi my dear friend"
Run Code Online (Sandbox Code Playgroud) 我已经将以下行添加到我的bash中,但是mkproject继续在虚拟环境中创建python 2.7文件夹,因此我仍然需要使用-p python3,我不想这样做.
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
export VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
source /usr/local/bin/virtualenvwrapper_lazy.sh
Run Code Online (Sandbox Code Playgroud) 就像是
sentence.replace(*, "newword")
(这不起作用,顺便说一句)
让我们说吧
sentence = "hello world"
return sentence.replace(*, "newworld")
应该返回"newword newword"