add keyword_demo into readme.md

This commit is contained in:
wyy 2014-02-10 11:30:38 +08:00
parent eff8d45267
commit b7c93f196c
2 changed files with 17 additions and 1 deletions

View File

@ -150,6 +150,22 @@ Full方法切出所有字典里的词语。
Query方法先使用Mix方法切词对于切出来的较长的词再使用Full方法。 Query方法先使用Mix方法切词对于切出来的较长的词再使用Full方法。
### 关键词抽取
```
make && ./test/keyword.demo
```
you will see:
```
我是蓝翔技工拖拉机学院手扶拖拉机专业的。不用多久我就会升职加薪当上总经理出任CEO迎娶白富美走上人生巅峰。
->
["CEO:11.7392", "蓝翔:11.7392", "白富美:11.7392", "升职:10.8562", "加薪:10.6426"]
```
关键词抽取的demo代码请见`test/keyword_demo.cpp`
## 模块详解 ## 模块详解

View File

@ -8,6 +8,6 @@ int main(int argc, char ** argv)
vector<pair<string, double> > wordweights; vector<pair<string, double> > wordweights;
size_t topN = 5; size_t topN = 5;
extractor.extract(s, wordweights, topN); extractor.extract(s, wordweights, topN);
print(wordweights); cout<< s << "\n -> \n" << wordweights << endl;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }