1 Star 0 Fork 0

sheeplu / kenlm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
predict.py 585 Bytes
一键复制 编辑 原始数据 按行查看 历史
yujishi 提交于 2017-10-23 20:35 . MOD:update
#coding:utf-8
import word2vec
def get_synonmys():
model = word2vec.load('./model.bin')
with open("./tf_dict") as f:
for w in f:
w = w.strip()
try:
indexes, metrics = model.cosine(w)
for i in zip(indexes, metrics):
word = model.vocab[i[0]]
sim = i[1]
if sim>0.85 and sim<0.95:
print("%s %s %f" % (w,word,sim))
except Exception as e:
continue
return
if __name__ == "__main__":
get_synonmys()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sheeplu/kenlm.git
git@gitee.com:sheeplu/kenlm.git
sheeplu
kenlm
kenlm
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891