mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
add format=simple in server
This commit is contained in:
parent
467fcf8434
commit
d791859027
20
README.md
20
README.md
@ -57,7 +57,25 @@ sudo /etc/init.d/cjserver stop
|
||||
然后用chrome浏览器打开`http://127.0.0.1:11200/?key=南京市长江大桥`
|
||||
(用chrome的原因是chrome的默认编码就是utf-8)
|
||||
|
||||
或者用命令 `curl "http://127.0.0.1:11200/?key=南京市长江大桥"` (ubuntu中的curl安装命令`sudo apt-get install curl`)
|
||||
或者用命令 `curl "http://127.0.0.1:11200/?key=南京市长江大桥"` (ubuntu中的curl安装命令`sudo apt-get install curl`)
|
||||
|
||||
你可以看到返回的结果如下:(返回结果是json格式)
|
||||
|
||||
```
|
||||
["南京市", "长江大桥"]
|
||||
```
|
||||
|
||||
如果你使用如下调用方式:
|
||||
|
||||
```
|
||||
curl "http://127.0.0.1:11200/?key=南京市长江大桥&format=simple"
|
||||
```
|
||||
|
||||
则返回结果如下:(返回结果按空格隔开)
|
||||
|
||||
```
|
||||
南京市 长江大桥
|
||||
```
|
||||
|
||||
|
||||
### 卸载
|
||||
|
@ -26,6 +26,11 @@ class ReqHandler: public IRequestHandler
|
||||
httpReq.GET("key", tmp);
|
||||
URLDecode(tmp, sentence);
|
||||
_segment.cut(sentence, words);
|
||||
if(httpReq.GET("format", tmp) && tmp == "simple")
|
||||
{
|
||||
join(words.begin(), words.end(), strSnd, " ");
|
||||
return true;
|
||||
}
|
||||
strSnd << words;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user