本文整理汇总了Golang中github.com/kljensen/snowball/snowballword.SnowballWord.FitsInR1方法的典型用法代码示例。如果您正苦于以下问题:Golang SnowballWord.FitsInR1方法的具体用法?Golang SnowballWord.FitsInR1怎么用?Golang SnowballWord.FitsInR1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/kljensen/snowball/snowballword.SnowballWord
的用法示例。
在下文中一共展示了SnowballWord.FitsInR1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: step1
//.........这里部分代码省略.........
// If preceded by "ic", delete if in R2, else replace by "iqU".
newSuffix, newSuffixRunes := word.FirstSuffix("ic")
if newSuffix != "" {
if word.FitsInR2(len(newSuffixRunes)) {
word.RemoveLastNRunes(len(newSuffixRunes))
} else {
word.ReplaceSuffixRunes(newSuffixRunes, []rune("iqU"), true)
}
}
return true
}
case "ement", "ements":
if isInRV {
// Delete if in RV
word.RemoveLastNRunes(len(suffixRunes))
// If preceded by "iv", delete if in R2
// (and if further preceded by "at", delete if in R2)
newSuffix, newSuffixRunes := word.RemoveFirstSuffixIfIn(word.R2start, "iv")
if newSuffix != "" {
word.RemoveFirstSuffixIfIn(word.R2start, "at")
return true
}
// If preceded by "eus", delete if in R2, else replace by "eux" if in R1
newSuffix, newSuffixRunes = word.FirstSuffix("eus")
if newSuffix != "" {
newSuffixLen := len(newSuffixRunes)
if word.FitsInR2(newSuffixLen) {
word.RemoveLastNRunes(newSuffixLen)
} else if word.FitsInR1(newSuffixLen) {
word.ReplaceSuffixRunes(newSuffixRunes, []rune("eux"), true)
}
return true
}
// If preceded by abl or iqU, delete if in R2, otherwise,
newSuffix, newSuffixRunes = word.FirstSuffix("abl", "iqU")
if newSuffix != "" {
newSuffixLen := len(newSuffixRunes)
if word.FitsInR2(newSuffixLen) {
word.RemoveLastNRunes(newSuffixLen)
}
return true
}
// If preceded by ièr or Ièr, replace by i if in RV
newSuffix, newSuffixRunes = word.FirstSuffix("ièr", "Ièr")
if newSuffix != "" {
if word.FitsInRV(len(newSuffixRunes)) {
word.ReplaceSuffixRunes(newSuffixRunes, []rune("i"), true)
}
return true
}
return true
}
case "ité", "ités":
if isInR2 {
// Delete if in R2