mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
init KeyWordExt.cpp/h
This commit is contained in:
parent
c7a1f0ac6e
commit
0841b45d67
38
src/KeyWordExt.cpp
Normal file
38
src/KeyWordExt.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "KeyWordExt.h"
|
||||
|
||||
|
||||
namespace CppJieba
|
||||
{
|
||||
|
||||
KeyWordExt::KeyWordExt()
|
||||
{
|
||||
}
|
||||
|
||||
KeyWordExt::~KeyWordExt()
|
||||
{
|
||||
}
|
||||
|
||||
bool KeyWordExt::init(const char * const filePath)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool KeyWordExt::destroy()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef KEYWORDEXT_UT
|
||||
|
||||
using namespace CppJieba;
|
||||
|
||||
int main()
|
||||
{
|
||||
KeyWordExt ext;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
22
src/KeyWordExt.h
Normal file
22
src/KeyWordExt.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef CPPJIEBA_KEYWORDEXT_H
|
||||
#define CPPJIEBA_KEYWORDEXT_H
|
||||
|
||||
#include "Segment.h"
|
||||
|
||||
namespace CppJieba
|
||||
{
|
||||
class KeyWordExt
|
||||
{
|
||||
private:
|
||||
Segment _segment;
|
||||
public:
|
||||
KeyWordExt();
|
||||
~KeyWordExt();
|
||||
bool init(const char * const filePath);
|
||||
bool destroy();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -41,7 +41,10 @@ Trie.ut: Trie.cpp Trie.h globals.h $(CMLIB)
|
||||
$(CC) -o $@ $< -DTRIE_UT $(CMLIB)
|
||||
|
||||
Segment.ut: Segment.cpp Trie.cpp Segment.h Trie.h globals.h $(CMLIB)
|
||||
$(CC) -o $@ Segment.cpp Trie.cpp -DSEGMENT_UT $(CMLIB)
|
||||
$(CC) -o $@ Segment.cpp Trie.cpp -DSEGMENT_UT $(CMLIB) -liconv
|
||||
|
||||
KeyWordExt.ut: KeyWordExt.cpp KeyWordExt.h Segment.h Trie.h globals.h $(CMLIB)
|
||||
$(CC) -o $@ KeyWordExt.cpp Segment.cpp Trie.cpp -DKEYWORDEXT_UT $(CMLIB) -liconv
|
||||
|
||||
clean:
|
||||
rm -f *.o *.d *.ut $(LIBA)
|
||||
|
@ -366,19 +366,19 @@ int main()
|
||||
string title;
|
||||
title = "我来到北京清华大学";
|
||||
res.clear();
|
||||
segment.extract(title, res);
|
||||
segment.extract(title, res, 5);
|
||||
|
||||
title = "特价!camel骆驼 柔软舒适头层牛皮平底凉鞋女 休闲平跟妈妈鞋夏";
|
||||
res.clear();
|
||||
segment.extract(title, res);
|
||||
segment.extract(title, res, 5);
|
||||
|
||||
title = "包邮拉菲草18cm大檐进口草帽子超强遮阳防晒欧美日韩新款夏天 女";
|
||||
res.clear();
|
||||
segment.extract(title, res);
|
||||
segment.extract(title, res, 5);
|
||||
|
||||
title = "2013新款19CM超大檐帽 遮阳草帽子 沙滩帽防晒大檐欧美新款夏天女";
|
||||
res.clear();
|
||||
segment.extract(title, res);
|
||||
segment.extract(title, res, 5);
|
||||
|
||||
segment.destroy();
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user