add TrieNodeInfo's toString()

This commit is contained in:
wyy 2013-09-13 14:43:52 +08:00
parent dc41068d58
commit 8e3c4eccbb

View File

@ -26,6 +26,12 @@ namespace CppJieba
TrieNodeInfo(const Unicode& _word):word(_word),freq(0),logFreq(MIN_DOUBLE) TrieNodeInfo(const Unicode& _word):word(_word),freq(0),logFreq(MIN_DOUBLE)
{ {
} }
string toString()const
{
string tmp;
TransCode::encode(word, tmp);
return string_format("{word:%s,freq:%d, logFreq:%lf}", tmp.c_str(), freq, logFreq);
}
}; };
typedef unordered_map<uint, const TrieNodeInfo*> DagType; typedef unordered_map<uint, const TrieNodeInfo*> DagType;