mirror of
https://github.com/fumiama/jieba.git
synced 2026-07-02 10:00:27 +08:00
fixed the bug cause random testing failure, the Less() function was wrong
This commit is contained in:
@@ -37,13 +37,10 @@ func (pss ProbStates) Len() int {
|
|||||||
|
|
||||||
func (pss ProbStates) Less(i, j int) bool {
|
func (pss ProbStates) Less(i, j int) bool {
|
||||||
if pss[i].Prob == pss[j].Prob {
|
if pss[i].Prob == pss[j].Prob {
|
||||||
if pss[i].ST.Tag < pss[j].ST.Tag {
|
if pss[i].ST.State == pss[j].ST.State {
|
||||||
return true
|
return pss[i].ST.Tag < pss[j].ST.Tag
|
||||||
} else if pss[i].ST.State < pss[j].ST.State {
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
return pss[i].ST.State < pss[j].ST.State
|
||||||
}
|
}
|
||||||
return pss[i].Prob < pss[j].Prob
|
return pss[i].Prob < pss[j].Prob
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user