From b51ae37771812e084d0267c4203d074f63113e06 Mon Sep 17 00:00:00 2001 From: Wang Bin Date: Mon, 11 Aug 2014 16:44:26 +0800 Subject: [PATCH] fixed the bug cause random testing failure, the Less() function was wrong --- posseg/viterbi.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/posseg/viterbi.go b/posseg/viterbi.go index 745ae73..8a75750 100644 --- a/posseg/viterbi.go +++ b/posseg/viterbi.go @@ -37,13 +37,10 @@ func (pss ProbStates) Len() int { func (pss ProbStates) Less(i, j int) bool { if pss[i].Prob == pss[j].Prob { - if pss[i].ST.Tag < pss[j].ST.Tag { - return true - } else if pss[i].ST.State < pss[j].ST.State { - return true - } else { - return false + if pss[i].ST.State == pss[j].ST.State { + return pss[i].ST.Tag < pss[j].ST.Tag } + return pss[i].ST.State < pss[j].ST.State } return pss[i].Prob < pss[j].Prob }