mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
modify test
This commit is contained in:
parent
1e29d25855
commit
f3e0df12f7
@ -25,7 +25,7 @@ make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
#### 验证
|
||||
#### 测试
|
||||
|
||||
```sh
|
||||
/usr/bin/cjseg.sh ../test/testlines.utf8
|
||||
@ -41,7 +41,7 @@ sudo /etc/init.d/cjserver start
|
||||
sudo /etc/init.d/cjserver stop
|
||||
```
|
||||
|
||||
#### 验证服务
|
||||
#### 测试服务
|
||||
|
||||
然后用chrome浏览器打开`http://127.0.0.1:11200/?key=南京市长江大桥`
|
||||
(用chrome的原因是chrome的默认编码就是utf-8)
|
||||
|
2
test/Makefile
Executable file → Normal file
2
test/Makefile
Executable file → Normal file
@ -2,4 +2,4 @@ all: testp demo
|
||||
testp:
|
||||
g++ -o test_performance test_performance.cpp -std=c++0x -O3
|
||||
demo:
|
||||
g++ -o segment.demo segment.cpp -std=c++0x -L/usr/lib/CppJieba -lcppjieba
|
||||
g++ -o segment.demo segment.cpp -std=c++0x
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <CppJieba/Limonp/ArgvContext.hpp>
|
||||
#include <CppJieba/MPSegment.h>
|
||||
#include <CppJieba/HMMSegment.h>
|
||||
#include <CppJieba/MixSegment.h>
|
||||
#include "../src/Limonp/ArgvContext.hpp"
|
||||
#include "../src/MPSegment.hpp"
|
||||
#include "../src/HMMSegment.hpp"
|
||||
#include "../src/MixSegment.hpp"
|
||||
|
||||
using namespace CppJieba;
|
||||
|
||||
@ -27,8 +27,8 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
//demo
|
||||
{
|
||||
HMMSegment seg;
|
||||
if(!seg.init("../dicts/hmm_model.utf8"))
|
||||
HMMSegment seg("../dicts/hmm_model.utf8");
|
||||
if(!seg.init())
|
||||
{
|
||||
cout<<"seg init failed."<<endl;
|
||||
return EXIT_FAILURE;
|
||||
@ -37,8 +37,8 @@ int main(int argc, char ** argv)
|
||||
seg.dispose();
|
||||
}
|
||||
{
|
||||
MixSegment seg;
|
||||
if(!seg.init("../dicts/jieba.dict.utf8", "../dicts/hmm_model.utf8"))
|
||||
MixSegment seg("../dicts/jieba.dict.utf8", "../dicts/hmm_model.utf8");
|
||||
if(!seg.init())
|
||||
{
|
||||
cout<<"seg init failed."<<endl;
|
||||
return EXIT_FAILURE;
|
||||
@ -47,8 +47,8 @@ int main(int argc, char ** argv)
|
||||
seg.dispose();
|
||||
}
|
||||
{
|
||||
MPSegment seg;
|
||||
if(!seg.init("../dicts/jieba.dict.utf8"))
|
||||
MPSegment seg("../dicts/jieba.dict.utf8");
|
||||
if(!seg.init())
|
||||
{
|
||||
cout<<"seg init failed."<<endl;
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user