本文整理匯總了Golang中github.com/kljensen/snowball/snowballword.SnowballWord.RemoveFirstSuffix方法的典型用法代碼示例。如果您正苦於以下問題:Golang SnowballWord.RemoveFirstSuffix方法的具體用法?Golang SnowballWord.RemoveFirstSuffix怎麽用?Golang SnowballWord.RemoveFirstSuffix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/kljensen/snowball/snowballword.SnowballWord
的用法示例。
在下文中一共展示了SnowballWord.RemoveFirstSuffix方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: step4
// Step 4 is the undoubling of double non-vowel endings
// and removal of superlative endings.
//
func step4(word *snowballword.SnowballWord) bool {
// (1) Undouble "н", or, 2) if the word ends with a SUPERLATIVE ending,
// (remove it and undouble н n), or 3) if the word ends ь (') (soft sign)
// remove it.
// Undouble "н"
if word.HasSuffixRunes([]rune("нн")) {
word.RemoveLastNRunes(1)
return true
}
// Remove superlative endings
suffix, _ := word.RemoveFirstSuffix("ейше", "ейш")
if suffix != "" {
// Undouble "н"
if word.HasSuffixRunes([]rune("нн")) {
word.RemoveLastNRunes(1)
}
return true
}
// Remove soft sign
if rsLen := len(word.RS); rsLen > 0 && word.RS[rsLen-1] == 'ь' {
word.RemoveLastNRunes(1)
return true
}
return false
}