// Stem returns a stemmed string word.
491422
func (stm germanStemmer) Stem(word string) string {
	word = strings.ToLower(word)
	word = strings.Replace(word, "ß", "ss", -1)

	s := []rune(word)

	for i, max := 1, len(s)-1; i < max; i++ { // interested only in runes between vowels, so we run from 1 to len-1
		if s[i] == 'y' && isVowel(s[i-1]) && isVowel(s[i+1]) {
			s[i] = 'Y'
		}
		if s[i] == 'u' && isVowel(s[i-1]) && isVowel(s[i+1]) {
			s[i] = 'U'
		}
	}

	r1, r2 := getR1R2(s)

	// step 1 group a
	i := suffixPos(s, []rune("ern"))
	if i == -1 {
		i = suffixPos(s, []rune("em"))
	}
	if i == -1 {
		i = suffixPos(s, []rune("er"))
	}
	if i >= r1 {
		s = s[:i]
		goto step2
	}

	// step 1 group b
	i = suffixPos(s, []rune("en"))
	if i == -1 {
		i = suffixPos(s, []rune("es"))
	}
	if i == -1 {
		i = suffixPos(s, []rune("e"))
	}
	if i >= r1 {
		s = s[:i]
		if x := suffixPos(s, []rune("niss")); x != -1 {
			s = s[:len(s)-1]
		}
		goto step2
	}

	// step 1 group c
	if i = suffixPos(s, []rune("s")); i >= r1 && hasValidSEnding(s[:len(s)-1]) { // only delete if preceded by valid s-ending
		s = s[:i]
		goto step2
	}

step2:
	// step 2 group a
	i = suffixPos(s, []rune("est"))
	if i == -1 {
		i = suffixPos(s, []rune("en"))
	}
	if i == -1 {
		i = suffixPos(s, []rune("er"))
	}
	if i >= r1 {
		s = s[:i]
		goto step3
	}

	// step 2 group b
	// st-ending itself must be preceded by at least 3 letters -> min 3 + st-end 1 + st 2 = 6 
	if i = suffixPos(s, []rune("st")); i >= r1 && hasValidStEnding(s[:len(s)-2]) && len(s) >= 6 {
		s = s[:i]
		goto step3
	}

step3:
	// step 3 end ung
	i = suffixPos(s, []rune("end"))
	if i == -1 {
		i = suffixPos(s, []rune("ung"))
	}
	if i >= r2 {
		s = s[:i]
		// if preceded by ig, delete if in R2 and not preceded by e
		if i = suffixPos(s, []rune("ig")); i >= r2 && suffixPos(s[:i], []rune("e")) == -1 {
			s = s[:i]
		}
		goto final
	}

	// step 3 ig ik isch
	i = suffixPos(s, []rune("ig"))
	if i == -1 {
		i = suffixPos(s, []rune("ik"))
	}
	if i == -1 {
		i = suffixPos(s, []rune("isch"))
	}
	if i >= r2 && suffixPos(s[:i], []rune("e")) == -1 {
		s = s[:i]
		goto final
	}

	// step 3 lich heit
	i = suffixPos(s, []rune("lich"))
	if i == -1 {
		i = suffixPos(s, []rune("heit"))
	}
	if i >= r2 {
		s = s[:i]
		// if preceded by er or en, delete if in R1 
		i = suffixPos(s, []rune("er"))
		if i == -1 {
			i = suffixPos(s, []rune("en"))
		}
		if i >= r1 {
			s = s[:i]
		}
		goto final
	}

	// step 3 keit
	i = suffixPos(s, []rune("keit"))
	if i >= r2 {
		s = s[:i]
		// if preceded by lich or ig, delete if in R2 
		i = suffixPos(s, []rune("lich"))
		if i == -1 {
			i = suffixPos(s, []rune("ig"))
		}
		if i >= r2 {
			s = s[:i]
		}
		goto final
	}

final:
	for i, max := 0, len(s); i < max; i++ {
		switch s[i] {
		case 'U':
			s[i] = 'u'
		case 'Y':
			s[i] = 'y'
		case 'ä':
			s[i] = 'a'
		case 'ö':
			s[i] = 'o'
		case 'ü':
			s[i] = 'u'
		}
	}

	return string(s)
}
184474
func (ref *ShapeRef) Docstring() string {
	if ref.Documentation != "" {
		return strings.Trim(ref.Documentation, "\n ")
	}
	return ref.Shape.Docstring()
}
1374445
func Tail(path string) string {
	parts := strings.Split(path, "/")
	return parts[len(parts)-1]
}
113112
func (s *set) Reduce(i *Term, f func(*Term, *Term) (*Term, error)) (*Term, error) {
	err := s.Iter(func(x *Term) error {
		var err error
		i, err = f(i, x)
		if err != nil {
			return err
		}
		return nil
	})
	return i, err
}
47277
func (t *Trainer) Stem(a string) (string, error) {
	if t.s == nil {
		return "", componentUnavailable("Stemmer")
	}
	return t.s.Stem(a)
}
435479
func (ck ClusteringKey) String() string {
	if ck.Descending {
		return ck.Name + " DESC"
	}
	return ck.Name + " ASC"
}
425152
func TypeString(str string) {
	cstr := C.CString(str)
	C.type_string(cstr)

	C.free(unsafe.Pointer(cstr))
}
1152328
func (t Type) String() string {
	return fmt.Sprintf("Type{%v %q %T %v}", t.Kind, t.Pkg, t.Node, pretty{t.Node})
}
439751
func (h *Strings) PopAll() []string {
	for n := h.Len(); n > 1; n-- {
		if h.less == nil {
			PopToLastF(n, h.list.Less, h.list.Swap)
		} else {
			PopToLastF(n, h.less, h.list.Swap)
		}
	}
	res := h.list
	h.list = nil
	return res
}
412069
func (stm englishStemmer) Stem(word string) string {
	word = strings.ToLower(word)
	// Is it exception?
	if rep, ex := exceptions1[word]; ex {
		return rep
	}
	s := []rune(word)
	if len(s) <= 2 {
		return word
	}
	if s[0] == '\'' {
		s = s[1:]
	}
	if s[0] == 'y' {
		s[0] = 'Y'
	}
	for i := 1; i < len(s); i++ {
		if isVowel(s[i-1]) && s[i] == 'y' {
			s[i] = 'Y'
		}
	}
	r1, r2 := getR1R2(s)

	// Step 0
	s = removeSuffix(s, []rune("'s'"))
	s = removeSuffix(s, []rune("'s"))
	s = removeSuffix(s, []rune("'"))

	// Step 1a
	if i := suffixPos(s, []rune("sses")); i != -1 {
		// sses
		// replace by ss
		s = append(s[:i], []rune("ss")...)
		goto step1b
	}
	{
		i := suffixPos(s, []rune("ied"))
		if i == -1 {
			i = suffixPos(s, []rune("ies"))
		}
		if i != -1 {
			// ied+   ies*
			// replace by i if preceded by more than one letter,
			// otherwise by ie (so ties -> tie, cries -> cri)
			s = s[:i]
			if len(s) > 1 {
				s = append(s, rune('i'))
			} else {
				s = append(s, []rune("ie")...)
			}
			goto step1b
		}
	}
	if suffixPos(s, []rune("us")) != -1 || suffixPos(s, []rune("ss")) != -1 {
		// do nothing
		goto step1b
	}

	if i := suffixPos(s, []rune("s")); i != -1 {
		if len(s) >= 3 && hasVowelBeforePos(s, len(s)-3) {
			s = s[:i]
		}
		goto step1b
	}

step1b:
	if _, ex := exceptions2[string(s)]; ex {
		return string(s)
	}
	// Step 1b
	for _, suf := range [][]rune{[]rune("eed"), []rune("eedly")} {
		if i := suffixPos(s, suf); i != -1 {
			if i >= r1 {
				s = append(s[:i], []rune("ee")...)
			}
			goto step1c
		}
	}

	for _, suf := range step1bWords {
		if suffixPos(s, suf) != -1 {
			if len(s) > len(suf) && hasVowelBeforePos(s, len(s)-len(suf)-1) {
				s = s[:len(s)-len(suf)]
			} else {
				goto step1c
			}
			if suffixPos(s, []rune("at")) != -1 || suffixPos(s, []rune("bl")) != -1 ||
				suffixPos(s, []rune("iz")) != -1 {
				s = append(s, rune('e'))
				goto step1c
			}
			if endsWithDouble(s) {
				s = s[:len(s)-1]
				goto step1c
			}
			if isShortWord(s) {
				s = append(s, rune('e'))
			}
			goto step1c
		}
	}
step1c:
	// replace suffix y or Y by i if preceded by a non-vowel which is
	// not the first letter of the word (so cry -> cri, by -> by, say -> say)
	if len(s) > 2 {
		switch s[len(s)-1] {
		case 'y', 'Y':
			if !isVowel(s[len(s)-2]) {
				s[len(s)-1] = 'i'
			}
		}
	}
	//step2:
	r1, r2 = getR1R2(s)
	// Search for the longest among the following suffixes, and,
	// if found and in R1, perform the action indicated
	for j, suf := range step2Words {
		if i := suffixPos(s, suf); i != -1 {
			if i >= r1 {
				s = append(s[:i], step2Reps[j]...)
			}
			goto step3
		}
	}
	if i := suffixPos(s, []rune("ogi")); i != -1 && i >= r1 {
		if s[i-1] == 'l' {
			s = append(s[:i], []rune("og")...)
		}
		goto step3
	}
	if i := suffixPos(s, []rune("li")); i != -1 && i >= r1 {
		// valid li-ending: c   d   e   g   h   k   m   n   r   t
		switch s[i-1] {
		case 'c', 'd', 'e', 'g', 'h', 'k', 'm', 'n', 'r', 't':
			s = s[:i]
		}
	}
step3:
	r1, r2 = getR1R2(s)
	for j, suf := range step3Words {
		if i := suffixPos(s, suf); i != -1 {
			if i >= r1 {
				s = append(s[:i], step3Reps[j]...)
			}
			goto step4
		}
	}
	if i := suffixPos(s, []rune("ative")); i != -1 && i >= r2 {
		s = s[:i]
		goto step4
	}

step4:
	r1, r2 = getR1R2(s)
	for _, suf := range step4Words {
		if i := suffixPos(s, suf); i != -1 {
			if i >= r2 {
				s = s[:i]
			}
			goto step5
		}
	}
	if i := suffixPos(s, []rune("ion")); i != -1 && i >= r2 {
		switch s[i-1] {
		case 's', 't':
			s = s[:i]
		}
	}

step5:
	r1, r2 = getR1R2(s)
	i := len(s) - 1
	if i > 0 && s[i] == 'e' {
		if i >= r2 {
			s = s[:i]
			goto final
		}
		if i >= r1 {
			// if not preceded by a short syllable
			if i < 3 {
				goto final
			}
			// N + v + N
			last := s[i-1]
			if !isVowel(s[i-3]) && isVowel(s[i-2]) && !isVowel(last) &&
				last != 'w' && last != 'x' && last != 'Y' {
				goto final
			}
			s = s[:i]
		}
		goto final
	}
	if i > 1 && i >= r2 && s[i] == 'l' && s[i-1] == 'l' {
		s = s[:i]
	}

final:
	for i, v := range s {
		if v == 'Y' {
			s[i] = 'y'
		}
	}
	return string(s)
}
318069
func (r Region) String() string {
	return fmt.Sprintf("(%d, %d)", r.From, r.To)
}
336194
func (t *Template) term() Node {
	switch token := t.nextNonSpace(); token.typ {
	case itemError:
		t.errorf("%s", token.val)
	case itemIdentifier:
		return t.newIdentifier(token.val, token.pos, t.lex.lineNumber())
	case itemNil:
		return t.newNil(token.pos)
	case itemField:
		return t.newField(token.pos, token.val)
	case itemBool:
		return t.newBool(token.pos, token.val == "true")
	case itemCharConstant, itemComplex, itemNumber:
		number, err := t.newNumber(token.pos, token.val, token.typ)
		if err != nil {
			t.error(err)
		}
		return number
	case itemLeftParen:
		pipe := t.expression("parenthesized expression")
		if token := t.next(); token.typ != itemRightParen {
			t.errorf("unclosed right paren: unexpected %s", token)
		}
		return pipe
	case itemString, itemRawString:
		s, err := unquote(token.val)
		if err != nil {
			t.error(err)
		}
		return t.newString(token.pos, token.val, s)
	}
	t.backup()
	return nil
}
993824
func lexItem(l *lexer) stateFn {
Loop:
	for {
		switch r := l.next(); {
		case r == '{':
			l.emit(itemLeftBrace)
		case r == '}':
			l.emit(itemRightBrace)
		case r == '[':
			l.emit(itemLeftBracket)
		case r == ']':
			l.emit(itemRightBracket)
		case r == '=':
			l.emit(itemEq)
		case r == ';':
			l.emit(itemSemi)
		case r == ',':
			l.emit(itemComma)
		case isNumber(r):
			l.backup()
			return lexNumber
		case r == '"':
			return lexString
		case isSpace(r):
			l.ignore()
		case isWord(r):
			l.backup()
			return lexWord
		case r == eof:
			l.emit(itemEOF)
			break Loop
		default:
			l.emit(itemChar)
		}
	}
	return nil
}
235877
func (stmt DropStmt) String() string {
	c, _ := stmt.Compile(&defaultDialect{}, Params())
	return c
}
1108367
func (c Caser) String(s string) string {
	components := []string{}
	for i, s := range c.From.SplitWords(s) {
		if i == 0 {
			components = append(components, c.To.InitialCase(s))
		} else {
			components = append(components, c.To.SubsequentCase(s))
		}
	}
	return c.To.Join(components)
}
1309214
func (t Section) String(k string) string {
	_, ok := t.values[k]
	if !ok {
		return ""
	}
	return t.values[k].StringValue()
}
347920
func (clnt *Client) String() string {
	if clnt.cluster != nil {
		return clnt.cluster.String()
	}
	return ""
}