mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
rename dicts -> dict
This commit is contained in:
parent
657aee0fda
commit
418b18db55
@ -9,7 +9,7 @@ IF (DEFINED ENC)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
#ADD_DEFINITIONS(-DNO_FILTER)
|
#ADD_DEFINITIONS(-DNO_FILTER)
|
||||||
ADD_SUBDIRECTORY(src)
|
ADD_SUBDIRECTORY(src)
|
||||||
ADD_SUBDIRECTORY(dicts)
|
ADD_SUBDIRECTORY(dict)
|
||||||
ADD_SUBDIRECTORY(scripts)
|
ADD_SUBDIRECTORY(scripts)
|
||||||
ADD_SUBDIRECTORY(conf)
|
ADD_SUBDIRECTORY(conf)
|
||||||
ADD_SUBDIRECTORY(test)
|
ADD_SUBDIRECTORY(test)
|
||||||
|
@ -10,10 +10,10 @@ thread_num=4
|
|||||||
daemonize=true
|
daemonize=true
|
||||||
|
|
||||||
#dict path
|
#dict path
|
||||||
dict_path=/usr/share/CppJieba/dicts/jieba.dict.utf8
|
dict_path=/usr/share/CppJieba/dict/jieba.dict.utf8
|
||||||
|
|
||||||
#model path
|
#model path
|
||||||
model_path=/usr/share/CppJieba/dicts/hmm_model.utf8
|
model_path=/usr/share/CppJieba/dict/hmm_model.utf8
|
||||||
|
|
||||||
#pid file
|
#pid file
|
||||||
pid_file=/var/run/CppJieba/cjserver.pid
|
pid_file=/var/run/CppJieba/cjserver.pid
|
||||||
|
@ -2,4 +2,4 @@ if [ $# -lt 1 ]; then
|
|||||||
echo "usage: $0 <file>"
|
echo "usage: $0 <file>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cjsegment --dictpath /usr/share/CppJieba/dicts/jieba.dict.utf8 --modelpath /usr/share/CppJieba/dicts/hmm_model.utf8 $1
|
cjsegment --dictpath /usr/share/CppJieba/dict/jieba.dict.utf8 --modelpath /usr/share/CppJieba/dict/hmm_model.utf8 $1
|
||||||
|
@ -45,11 +45,11 @@ int main(int argc, char ** argv)
|
|||||||
<<"\t--modelpath\tsee example\n"
|
<<"\t--modelpath\tsee example\n"
|
||||||
<<"\t--maxlen\tspecify the granularity of cut used in cutQuery. \n\t\t\tIf not specified, the default is 3\n"
|
<<"\t--maxlen\tspecify the granularity of cut used in cutQuery. \n\t\t\tIf not specified, the default is 3\n"
|
||||||
<<"example:\n"
|
<<"example:\n"
|
||||||
<<"\t"<<argv[0]<<" ../test/testdata/testlines.utf8 --dictpath ../dicts/jieba.dict.utf8 --algorithm cutDAG\n"
|
<<"\t"<<argv[0]<<" ../test/testdata/testlines.utf8 --dictpath ../dict/jieba.dict.utf8 --algorithm cutDAG\n"
|
||||||
<<"\t"<<argv[0]<<" ../test/testdata/testlines.utf8 --dictpath ../dicts/jieba.dict.utf8 --algorithm cutFull\n"
|
<<"\t"<<argv[0]<<" ../test/testdata/testlines.utf8 --dictpath ../dict/jieba.dict.utf8 --algorithm cutFull\n"
|
||||||
<<"\t"<<argv[0]<<" ../test/testdata/testlines.utf8 --modelpath ../dicts/hmm_model.utf8 --algorithm cutHMM\n"
|
<<"\t"<<argv[0]<<" ../test/testdata/testlines.utf8 --modelpath ../dict/hmm_model.utf8 --algorithm cutHMM\n"
|
||||||
<<"\t"<<argv[0]<<" ../test/testdata/testlines.utf8 --dictpath ../dicts/jieba.dict.utf8 --modelpath ../dicts/hmm_model.utf8 --algorithm cutMix\n"
|
<<"\t"<<argv[0]<<" ../test/testdata/testlines.utf8 --dictpath ../dict/jieba.dict.utf8 --modelpath ../dict/hmm_model.utf8 --algorithm cutMix\n"
|
||||||
<<"\t"<<argv[0]<<" ../test/testdata/testlines.utf8 --dictpath ../dicts/jieba.dict.utf8 --modelpath ../dicts/hmm_model.utf8 --algorithm cutQuery --maxlen 3\n"
|
<<"\t"<<argv[0]<<" ../test/testdata/testlines.utf8 --dictpath ../dict/jieba.dict.utf8 --modelpath ../dict/hmm_model.utf8 --algorithm cutQuery --maxlen 3\n"
|
||||||
<<endl;
|
<<endl;
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -22,28 +22,19 @@ void cut(const ISegment * seg, const char * const filePath, size_t times = 10)
|
|||||||
for(uint i = 0; i < times; i ++)
|
for(uint i = 0; i < times; i ++)
|
||||||
{
|
{
|
||||||
LogInfo("times[%u]", i);
|
LogInfo("times[%u]", i);
|
||||||
//ifile.seekg(0);
|
res.clear();
|
||||||
//while(getline(ifile, line))
|
seg->cut(doc, res);
|
||||||
//{
|
|
||||||
// if(!line.empty())
|
|
||||||
// {
|
|
||||||
res.clear();
|
|
||||||
seg->cut(doc, res);
|
|
||||||
//print(res);
|
|
||||||
//cout<<join(res.begin(), res.end(),"/")<<endl;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char ** argv)
|
int main(int argc, char ** argv)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
MixSegment seg("../dicts/jieba.dict.utf8", "../dicts/hmm_model.utf8");
|
MixSegment seg("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8");
|
||||||
if(!seg)
|
if(!seg)
|
||||||
{
|
{
|
||||||
cout<<"seg init failed."<<endl;
|
cout<<"seg init failed."<<endl;
|
||||||
return false;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
cut(&seg, "../test/testdata/weicheng.utf8");
|
cut(&seg, "../test/testdata/weicheng.utf8");
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ void cut(const ISegment * seg, const char * const filePath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char * const TEST_FILE = "../test/testdata/testlines.utf8";
|
const char * const TEST_FILE = "../test/testdata/testlines.utf8";
|
||||||
const char * const JIEBA_DICT_FILE = "../dicts/jieba.dict.utf8";
|
const char * const JIEBA_DICT_FILE = "../dict/jieba.dict.utf8";
|
||||||
const char * const HMM_DICT_FILE = "../dicts/hmm_model.utf8";
|
const char * const HMM_DICT_FILE = "../dict/hmm_model.utf8";
|
||||||
|
|
||||||
int main(int argc, char ** argv)
|
int main(int argc, char ** argv)
|
||||||
{
|
{
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
using namespace Husky;
|
using namespace Husky;
|
||||||
using namespace CppJieba;
|
using namespace CppJieba;
|
||||||
|
|
||||||
const char * const DEFAULT_DICTPATH = "../dicts/jieba.dict.utf8";
|
const char * const DEFAULT_DICTPATH = "../dict/jieba.dict.utf8";
|
||||||
const char * const DEFAULT_MODELPATH = "../dicts/hmm_model.utf8";
|
const char * const DEFAULT_MODELPATH = "../dict/hmm_model.utf8";
|
||||||
|
|
||||||
class ServerDemo: public IRequestHandler
|
class ServerDemo: public IRequestHandler
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ using namespace CppJieba;
|
|||||||
|
|
||||||
TEST(FullSegment, Test1)
|
TEST(FullSegment, Test1)
|
||||||
{
|
{
|
||||||
FullSegment segment("../dicts/jieba.dict.utf8");
|
FullSegment segment("../dict/jieba.dict.utf8");
|
||||||
const char* str = "我来自北京邮电大学。。。 学号 123456";
|
const char* str = "我来自北京邮电大学。。。 学号 123456";
|
||||||
const char* res[] = {"我", "来自", "北京", "北京邮电", "北京邮电大学", "邮电", "邮电大学", "电大", "大学", "。", "。", "。", " ", "学号", " 123456"};
|
const char* res[] = {"我", "来自", "北京", "北京邮电", "北京邮电大学", "邮电", "邮电大学", "电大", "大学", "。", "。", "。", " ", "学号", " 123456"};
|
||||||
vector<string> words;
|
vector<string> words;
|
||||||
|
@ -5,7 +5,7 @@ using namespace CppJieba;
|
|||||||
|
|
||||||
TEST(HMMSegmentTest, Test1)
|
TEST(HMMSegmentTest, Test1)
|
||||||
{
|
{
|
||||||
HMMSegment segment("../dicts/hmm_model.utf8");;
|
HMMSegment segment("../dict/hmm_model.utf8");;
|
||||||
const char* str = "我来自北京邮电大学。。。 学号 123456";
|
const char* str = "我来自北京邮电大学。。。 学号 123456";
|
||||||
const char* res[] = {"我来", "自北京", "邮电大学", "。", "。", "。", " ", "学号", " 123456"};
|
const char* res[] = {"我来", "自北京", "邮电大学", "。", "。", "。", " ", "学号", " 123456"};
|
||||||
//string s;
|
//string s;
|
||||||
|
@ -5,7 +5,7 @@ using namespace CppJieba;
|
|||||||
|
|
||||||
TEST(MPSegmentTest, Test1)
|
TEST(MPSegmentTest, Test1)
|
||||||
{
|
{
|
||||||
MPSegment segment("../dicts/jieba.dict.utf8");;
|
MPSegment segment("../dict/jieba.dict.utf8");;
|
||||||
const char* str = "我来自北京邮电大学。。。 学号 123456";
|
const char* str = "我来自北京邮电大学。。。 学号 123456";
|
||||||
const char* res[] = {"我", "来自", "北京邮电大学", "。","。","。"," ","学","号", " 123456"};
|
const char* res[] = {"我", "来自", "北京邮电大学", "。","。","。"," ","学","号", " 123456"};
|
||||||
vector<string> words;
|
vector<string> words;
|
||||||
|
@ -5,7 +5,7 @@ using namespace CppJieba;
|
|||||||
|
|
||||||
TEST(MixSegmentTest, Test1)
|
TEST(MixSegmentTest, Test1)
|
||||||
{
|
{
|
||||||
MixSegment segment("../dicts/jieba.dict.utf8", "../dicts/hmm_model.utf8");;
|
MixSegment segment("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8");;
|
||||||
const char* str = "我来自北京邮电大学。。。 学号 123456";
|
const char* str = "我来自北京邮电大学。。。 学号 123456";
|
||||||
const char* res[] = {"我", "来自", "北京邮电大学", "。","。","。"," ","学号", " 123456"};
|
const char* res[] = {"我", "来自", "北京邮电大学", "。","。","。"," ","学号", " 123456"};
|
||||||
vector<string> words;
|
vector<string> words;
|
||||||
|
@ -5,7 +5,7 @@ using namespace CppJieba;
|
|||||||
|
|
||||||
TEST(QuerySegment, Test1)
|
TEST(QuerySegment, Test1)
|
||||||
{
|
{
|
||||||
QuerySegment segment("../dicts/jieba.dict.utf8", "../dicts/hmm_model.utf8", 3);
|
QuerySegment segment("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8", 3);
|
||||||
const char* str = "小明硕士毕业于中国科学院计算所,后在日本京都大学深造";
|
const char* str = "小明硕士毕业于中国科学院计算所,后在日本京都大学深造";
|
||||||
const char* res[] = {"小明", "硕士", "毕业", "于", "中国", "中国科学院", "科学", "科学院", "学院", "计算所", ",", "后", "在", "日本", "日本京都大学", "京都", "京都大学", "大学", "深造"};
|
const char* res[] = {"小明", "硕士", "毕业", "于", "中国", "中国科学院", "科学", "科学院", "学院", "计算所", ",", "后", "在", "日本", "日本京都大学", "京都", "京都大学", "大学", "深造"};
|
||||||
vector<string> words;
|
vector<string> words;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
using namespace CppJieba;
|
using namespace CppJieba;
|
||||||
|
|
||||||
static const char* const DICT_FILE = "../dicts/jieba.dict.utf8";
|
static const char* const DICT_FILE = "../dict/jieba.dict.utf8";
|
||||||
|
|
||||||
TEST(TrieTest, Test1)
|
TEST(TrieTest, Test1)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user