本文整理匯總了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
}