This commit is contained in:
Hai Liang Wang 2020-09-21 14:27:19 +08:00
parent 0dbe1ec7cd
commit ea92e8f68f
2 changed files with 4 additions and 4 deletions

View File

@ -68,9 +68,9 @@ synonyms.seg("中文近义词工具包")
```
import synonyms
print("人脸: %s" % (synonyms.nearby("人脸")))
print("识别: %s" % (synonyms.nearby("识别")))
print("NOT_EXIST: %s" % (synonyms.nearby("NOT_EXIST")))
print("人脸: ", synonyms.nearby("人脸"))
print("识别: ", synonyms.nearby("识别"))
print("NOT_EXIST: ", synonyms.nearby("NOT_EXIST"))
```
`synonyms.nearby(WORD [,SIZE])`返回一个元组,元组中包含两项:`([nearby_words], [nearby_words_score])``nearby_words`是 WORD 的近义词们,也以 list 的方式存储,并且按照距离的长度由近及远排列,`nearby_words_score`是`nearby_words`中**对应位置**的词的距离的分数,分数在(0-1)区间内,越接近于 1代表越相近`SIZE` 是返回词汇数量,默认 10。比如:

View File

@ -1 +1 @@
synonyms>=3.10
synonyms>=3.12