Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hailiang-wang committed Oct 21, 2017
1 parent 758f321 commit 6132372
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,36 @@ assert synonyms.compare(sen1, sen2) == 0.0, "the similarity should be zero"

返回值:[0-1],并且越接近于1代表两个句子越相似。

### synonyms#display
以友好的方式打印近义词,方便调试,```display```调用了 ```synonyms#nearby``` 方法。

```
>>> synonyms.display("飞机")
'飞机'近义词:
1. 架飞机:0.837399
2. 客机:0.764609
3. 直升机:0.762116
4. 民航机:0.750519
5. 航机:0.750116
6. 起飞:0.735736
7. 战机:0.734975
8. 飞行中:0.732649
9. 航空器:0.723945
10. 运输机:0.720578
>>> synonyms.display("航母")
'航母'近义词:
1. 航空母舰:0.916647
2. 航舰:0.860443
3. 舰艇:0.762755
4. 舰载机:0.758707
5. 舰:0.751264
6. 驱逐舰:0.74454
7. 战舰:0.742578
8. 巡洋舰:0.73104
9. 舰队:0.72761
10. 潜艇:0.726795
```

## PCA (主成分析)

![](assets/1.png)
Expand Down
1 change: 1 addition & 0 deletions synonyms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def display(word):
for k,v in enumerate(o[0]):
print(" %d. %s:%s" %(k+1, v, o[1][k]))


def main():
display("人脸")

Expand Down

0 comments on commit 6132372

Please sign in to comment.