fix bug in cjseg.sh

This commit is contained in:
wyy 2013-11-23 07:58:26 -08:00
parent 7e4f14ec88
commit 0de5c3a73b
2 changed files with 18 additions and 17 deletions

View File

@ -17,11 +17,27 @@ unzip cppjieba-master.zip
cd cppjieba-master
mkdir build
cd build
cmake .. -Wno-dev
cmake ..
make
sudo make install
```
### 启动服务
```
#启动
/etc/init.d/CppJieba/start.sh
#停止
/etc/init.d/CppJieba/stop.sh
```
#### 验证服务
然后用chrome浏览器打开`http://127.0.0.1:11258/?key=南京市长江大桥`
(用chrome的原因是chrome的默认编码就是utf-8)
或者用命令 `curl "http://127.0.0.1:11258/?key=南京市长江大桥"` (ubuntu中的curl安装命令`sudo apt-get install curl`)
### 卸载
```sh
cd build/
@ -44,21 +60,6 @@ g++ -std=c++0x -o segment.demo segment.cpp -L/usr/lib/CppJieba/ -lcppjieba
若还有其他问题,欢迎`send mail`或者`open issue`。 :)
### 搭建服务
```
cd ./test
g++ -std=c++0x -o server server.cpp -L/usr/lib/CppJieba/ -L/usr/lib/CppJieba/Husky -lcppjieba -lhusky -lpthread
./server -n 4 -p 11258 -k start >> run.log 2>&1 #启动服务监听11258这个端口。
./server -n 4 -p 11258 -k stop #停止服务
```
#### 验证服务
然后用chrome浏览器打开`http://127.0.0.1:11258/?key=我来自北京邮电大学`
(用chrome的原因是chrome的默认编码就是utf-8)
或者用命令 `curl "http://127.0.0.1:11258/?key=我来自北京邮电大学"` (ubuntu中的curl安装命令`sudo apt-get install curl`)
## 分词效果

View File

@ -1,4 +1,4 @@
if [ $# -lt 2 ]; then
if [ $# -lt 1 ]; then
echo "usage: $0 <file>"
exit 1
fi