fix hmmsegment's output bug

This commit is contained in:
gwdwyy 2013-09-05 20:04:48 +08:00
parent e3d840bb03
commit ef0739b0dc
2 changed files with 8 additions and 13 deletions

View File

@ -55,9 +55,9 @@ make;
Output:
```
我来到北京清华大学
我来/到/北京/清华大学
我来/到/北京/清华大学
他来到了网易杭研大厦
他来/到/了/到了网易/杭/研大厦
他来/到/了/网易/杭/研大厦
小明硕士毕业于中国科学院计算所,后在日本京都大学深造
小明/硕士/毕业于/中国/科学院/计算所//后/在/日/本/京/都/大/学/深/造
```

View File

@ -125,24 +125,19 @@ namespace CppJieba
LogError("viterbi failed.");
return false;
}
//cout<<vecToString(status)<<endl;
begin = unico.begin();
left = begin;
res.clear();
for(uint i =0; i< status.size(); i++)
{
switch(status[i])
if(status[i] % 2) //if(E == status[i] || S == status[i])
{
case E:
right = begin + i + 1;
res.push_back(TransCode::vecToStr(left, right));
left = right;
break;
case S:
res.push_back(TransCode::vecToStr(begin + i, begin + i +1));
break;
}
}
return true;