本文整理汇总了Golang中github.com/kljensen/snowball/snowballword.SnowballWord.ReplaceSuffix方法的典型用法代码示例。如果您正苦于以下问题:Golang SnowballWord.ReplaceSuffix方法的具体用法?Golang SnowballWord.ReplaceSuffix怎么用?Golang SnowballWord.ReplaceSuffix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/kljensen/snowball/snowballword.SnowballWord
的用法示例。
在下文中一共展示了SnowballWord.ReplaceSuffix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: step5
// Step 5 is the stemming of "e" and "l" sufficies
// found in R2.
//
func step5(w *snowballword.SnowballWord) bool {
// Last rune index = `lri`
lri := len(w.RS) - 1
// If R1 is emtpy, R2 is also empty, and we
// need not do anything in step 5.
//
if w.R1start > lri {
return false
}
if w.RS[lri] == 101 {
// The word ends with "e", which is unicode code point 101.
// Delete "e" suffix if in R2, or in R1 and not preceded
// by a short syllable.
if w.R2start <= lri || !endsShortSyllable(w, lri) {
w.ReplaceSuffix("e", "", true)
return true
}
return false
} else if w.R2start <= lri && w.RS[lri] == 108 && lri-1 >= 0 && w.RS[lri-1] == 108 {
// The word ends in double "l", and the final "l" is
// in R2. (Note, the unicode code point for "l" is 108.)
// Delete the second "l".
w.ReplaceSuffix("l", "", true)
return true
}
return false
}