bak befor replace unicode with utf8

This commit is contained in:
gwdwyy 2013-07-05 00:04:35 +08:00
parent 140ce134b6
commit 3da92a2e1a
2 changed files with 4 additions and 2 deletions

View File

@ -188,7 +188,7 @@ int main()
//ChUnicode chUniStr[16]; //ChUnicode chUniStr[16];
//int uniLen = utf8ToUnicode(utf, sizeof(utf), chUniStr); //int uniLen = utf8ToUnicode(utf, sizeof(utf), chUniStr);
//cout<<trie.find(chUniStr, uniLen)<<endl; //cout<<trie.find(chUniStr, uniLen)<<endl;
char utf[1024] = "我来到北京清华大学"; char utf[1024] = "我来到北京清华大学3D电视";
char buf[1024]; char buf[1024];
ChUnicode chUniStr[1024]; ChUnicode chUniStr[1024];
//cout<<sizeof(utf)<<endl; //cout<<sizeof(utf)<<endl;

4
Trie.h
View File

@ -19,10 +19,11 @@ namespace CppJieba
typedef uint16_t ChUnicode; typedef uint16_t ChUnicode;
typedef map<ChUnicode, struct TrieNode*> TrieNodeHashMap; typedef map<ChUnicode, struct TrieNode*> TrieNodeHashMap;
struct TrieNode struct TrieNode
{ {
TrieNodeHashMap hmap; TrieNodeHashMap hmap;
bool isLeaf; bool isLeaf;
unsigned int count; unsigned int count;
string tag; string tag;
TrieNode() TrieNode()
@ -79,6 +80,7 @@ namespace CppJieba
{ {
private: private:
TrieNode* _root; TrieNode* _root;
vector<TrieNode> _nodeVec;
public: public:
typedef TrieNodeIterator iterator; typedef TrieNodeIterator iterator;
public: public: