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
18
README.md
18
README.md
@ -59,6 +59,24 @@ sudo /etc/init.d/cjserver stop
|
|||||||
|
|
||||||
或者用命令 `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"
|
||||||
|
```
|
||||||
|
|
||||||
|
则返回结果如下:(返回结果按空格隔开)
|
||||||
|
|
||||||
|
```
|
||||||
|
南京市 长江大桥
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### 卸载
|
### 卸载
|
||||||
```sh
|
```sh
|
||||||
|
@ -26,6 +26,11 @@ class ReqHandler: public IRequestHandler
|
|||||||
httpReq.GET("key", tmp);
|
httpReq.GET("key", tmp);
|
||||||
URLDecode(tmp, sentence);
|
URLDecode(tmp, sentence);
|
||||||
_segment.cut(sentence, words);
|
_segment.cut(sentence, words);
|
||||||
|
if(httpReq.GET("format", tmp) && tmp == "simple")
|
||||||
|
{
|
||||||
|
join(words.begin(), words.end(), strSnd, " ");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
strSnd << words;
|
strSnd << words;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user