本文整理汇总了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
}