mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
Merge pull request #73 from bigelephant29/user-dict-tag-bug-fix
fix user dict tag bug : wrong buf index assigned
This commit is contained in:
commit
e3e5f93ca3
@ -4,7 +4,9 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <stdint.h>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
@ -108,10 +110,17 @@ class DictTrie {
|
||||
buf.clear();
|
||||
Split(line, buf, " ");
|
||||
DictUnit node_info;
|
||||
MakeNodeInfo(node_info,
|
||||
buf[0],
|
||||
user_word_default_weight_,
|
||||
(buf.size() == 2 ? buf[1] : UNKNOWN_TAG));
|
||||
if(buf.size() == 1){
|
||||
MakeNodeInfo(node_info,
|
||||
buf[0],
|
||||
user_word_default_weight_,
|
||||
UNKNOWN_TAG);
|
||||
} else {
|
||||
MakeNodeInfo(node_info,
|
||||
buf[0],
|
||||
(buf.size() == 2 ? atoi(buf[1].c_str()) : user_word_default_weight_),
|
||||
(buf.size() == 3 ? buf[2] : buf[1]));
|
||||
}
|
||||
static_node_infos_.push_back(node_info);
|
||||
if (node_info.word.size() == 1) {
|
||||
user_dict_single_chinese_word_.insert(node_info.word[0]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user