本文整理匯總了Golang中github.com/kljensen/snowball/snowballword.SnowballWord.RemoveFirstSuffixIn方法的典型用法代碼示例。如果您正苦於以下問題:Golang SnowballWord.RemoveFirstSuffixIn方法的具體用法?Golang SnowballWord.RemoveFirstSuffixIn怎麽用?Golang SnowballWord.RemoveFirstSuffixIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/kljensen/snowball/snowballword.SnowballWord
的用法示例。
在下文中一共展示了SnowballWord.RemoveFirstSuffixIn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: removeAdjectivalEnding
// Remove adjectival endings and return true if one was removed.
//
func removeAdjectivalEnding(word *snowballword.SnowballWord) bool {
// Remove adjectival endings. Start by looking for
// an adjective ending.
//
suffix, _ := word.RemoveFirstSuffixIn(word.RVstart,
"ими", "ыми", "его", "ого", "ему", "ому", "ее", "ие",
"ые", "ое", "ей", "ий", "ый", "ой", "ем", "им", "ым",
"ом", "их", "ых", "ую", "юю", "ая", "яя", "ою", "ею",
)
if suffix != "" {
// We found an adjective ending. Remove optional participle endings.
//
newSuffix, newSuffixRunes := word.FirstSuffixIn(word.RVstart, len(word.RS),
"ивш", "ывш", "ующ",
"ем", "нн", "вш", "ющ", "щ",
)
switch newSuffix {
case "ем", "нн", "вш", "ющ", "щ":
// These are "Group 1" participle endings.
// Group 1 endings must follow а (a) or я (ia) in RV.
if precededByARinRV(word, len(newSuffixRunes)) == false {
newSuffix = ""
}
}
if newSuffix != "" {
word.RemoveLastNRunes(len(newSuffixRunes))
}
return true
}
return false
}
示例2: step2
// Step 2 is the removal of the "и" suffix.
//
func step2(word *snowballword.SnowballWord) bool {
suffix, _ := word.RemoveFirstSuffixIn(word.RVstart, "и")
if suffix != "" {
return true
}
return false
}
示例3: step3
// Step 3 is the removal of the derivational suffix.
//
func step3(word *snowballword.SnowballWord) bool {
// Search for a DERIVATIONAL ending in R2 (i.e. the entire
// ending must lie in R2), and if one is found, remove it.
suffix, _ := word.RemoveFirstSuffixIn(word.R2start, "ост", "ость")
if suffix != "" {
return true
}
return false
}
示例4: step1
// Step 1 is the removal of standard suffixes, all of which must
// occur in RV.
//
//
// Search for a PERFECTIVE GERUND ending. If one is found remove it, and
// that is then the end of step 1. Otherwise try and remove a REFLEXIVE
// ending, and then search in turn for (1) an ADJECTIVAL, (2) a VERB or
// (3) a NOUN ending. As soon as one of the endings (1) to (3) is found
// remove it, and terminate step 1.
//
func step1(word *snowballword.SnowballWord) bool {
// `stop` will be used to signal early termination
var stop bool
// Search for a PERFECTIVE GERUND ending
stop = removePerfectiveGerundEnding(word)
if stop {
return true
}
// Next remove reflexive endings
word.RemoveFirstSuffixIn(word.RVstart, "ся", "сь")
// Next remove adjectival endings
stop = removeAdjectivalEnding(word)
if stop {
return true
}
// Next remove verb endings
stop = removeVerbEnding(word)
if stop {
return true
}
// Next remove noun endings
suffix, _ := word.RemoveFirstSuffixIn(word.RVstart,
"иями", "ями", "иях", "иям", "ием", "ией", "ами", "ях",
"ям", "ья", "ью", "ье", "ом", "ой", "ов", "ия", "ию",
"ий", "ии", "ие", "ем", "ей", "еи", "ев", "ах", "ам",
"я", "ю", "ь", "ы", "у", "о", "й", "и", "е", "а",
)
if suffix != "" {
return true
}
return false
}