// Pluralize pluralizes words based on rules known
544922
func Pluralize(word string) string {
	if lingo.InStringSlice(word, unconvertable) {
		return word
	}

	for _, cp := range irregular {
		if cp.pattern.MatchString(word) {
			return cp.replacement
		}
	}

	for _, cp := range plural {
		if cp.pattern.MatchString(word) {
			// log.Printf("\t%q Matches %q", word, cp.pattern.String())
			return cp.pattern.ReplaceAllString(word, cp.replacement)
		}
	}
	return word
}
153771
func (po *Po) pluralForm(n int) int {
	po.RLock()
	defer po.RUnlock()

	// Failure fallback
	if po.pluralforms == nil {
		/* Use the Germanic plural rule.  */
		if n == 1 {
			return 0
		}
		return 1
	}
	return po.pluralforms.Eval(uint32(n))
}
266228
func (s bySpecificity) Less(i, j int) bool {
	return s[i].Specificity() >= s[j].Specificity()
}
1085197
func (ps *PluralSpec) Plural(number interface{}) (Plural, error) {
	ops, err := newOperands(number)
	if err != nil {
		return Invalid, err
	}
	return ps.PluralFunc(ops), nil
}
213498
function pluralize (value, word, options) {
  options = options || {}
  var output = ''
  var includeNumber = options.includeNumber != null ? options.includeNumber : false
  if(includeNumber === true) output += value + ' '
  if(!value && value !== 0 || !word) return output
  if(Array.isArray(word)) {
    output += word[value - 1] || word[word.length - 1]
  } else {
    output += word + (value === 1 ? '' : 's')
  }

  return output
}
681109
func pluralize(i int, singular, plural string) string {
	if i == 1 {
		return singular
	}
	return plural
}
765413
func (m charmResourceList) Less(i, j int) bool {
	return m[i].Name < m[j].Name
}
569447
func (t *SimpleTokenizer) Tokenize(sentence string) []string {
	// is the tokenizer really the best place to be making
	// everything lowercase? is this really a sanitizaion func?
	return strings.Split(strings.ToLower(sentence), t.SplitOn)
}
1274096
func (e *merryErr) Format(s fmt.State, verb rune) {
	switch verb {
	case 'v':
		if s.Flag('+') {
			io.WriteString(s, Details(e))
			return
		}
		fallthrough
	case 's':
		io.WriteString(s, e.Error())
	case 'q':
		fmt.Fprintf(s, "%q", e.Error())
	}
}
681485
func (n *normalizer) Normalize(un *unstructured.Unstructured) error {
	matched := make([]normalizerPatch, 0)
	for _, patch := range n.patches {
		groupKind := un.GroupVersionKind().GroupKind()
		if groupKind == patch.groupKind &&
			(patch.name == "" || patch.name == un.GetName()) &&
			(patch.namespace == "" || patch.namespace == un.GetNamespace()) {

			matched = append(matched, patch)
		}
	}
	if len(matched) == 0 {
		return nil
	}

	docData, err := json.Marshal(un)
	if err != nil {
		return err
	}

	for _, patch := range matched {
		patchedData, err := patch.patch.Apply(docData)
		if err != nil {
			// bug?
			if strings.HasPrefix(err.Error(), "Unable to remove nonexistent key") {
				continue
			}
			return err
		}
		docData = patchedData
	}

	err = json.Unmarshal(docData, un)
	if err != nil {
		return err
	}
	return nil
}
834500
func (s *Etcd) normalize(key string) string {
	key = store.Normalize(key)
	return strings.TrimPrefix(key, "/")
}
1194173
func (t *tree) parsePlural(tok item) ast.Node {
	const ctx = "plural"
	if !t.inmsg {
		t.unexpected(tok, "not in msg")
	}

	// plural and switch nodes have the same structure.
	// BUG: the location quoted the erorr messages will not be correct.
	var sw = t.parseSwitch(tok, itemPluralEnd).(*ast.SwitchNode)
	var defaultNode ast.ParentNode
	var cases []*ast.MsgPluralCaseNode
	for _, node := range sw.Cases {
		if len(node.Values) == 0 {
			defaultNode = node.Body.(ast.ParentNode)
		} else {
			var intNode, ok = node.Values[0].(*ast.IntNode)
			if !ok || len(node.Values) > 1 {
				t.errorf("plural case must be a single integer, got %v", node.Values)
			}
			cases = append(cases, &ast.MsgPluralCaseNode{node.Pos, int(intNode.Value), node.Body.(ast.ParentNode)})
		}
	}
	if defaultNode == nil {
		t.errorf("{default} case required")
	}
	return &ast.MsgPluralNode{sw.Pos, "", sw.Value, cases, defaultNode}
}
673204
func (mo *Mo) pluralForm(n int) int {
	mo.RLock()
	defer mo.RUnlock()

	// Failure fallback
	if mo.pluralforms == nil {
		/* Use the Germanic plural rule.  */
		if n == 1 {
			return 0
		}
		return 1

	}
	return mo.pluralforms.Eval(uint32(n))
}
462344
func colorize(msg string) string {
	var red = 31
	var colorEscape = fmt.Sprintf("\033[0;%dm", red)
	var colorResetEscape = "\033[0m"
	return colorEscape + msg + colorResetEscape
}
653390
func (v Vocabulary) Synonyms(w string) ([]string, error) {
  contents, err := makeReq(fmt.Sprintf(synonymsApiUrl, w))
  if err != nil {
    return []string{}, err
  }

  var glosbe Glosbe
  err = json.Unmarshal(contents, &glosbe)

  if err != nil || glosbe.Result != "ok" || len(glosbe.Tuc) < 2 {
    return []string{}, err
  }

  var result []string
  for _, tuc_raw := range glosbe.Tuc[1:] {
    var gp GlosbePhrase
    err = json.Unmarshal(tuc_raw, &gp)
    if err != nil {
      return []string{}, err
    }
    if gp.Thing.Text != "" {
      result = append(result, gp.Thing.Text)
    }
  }
  return result, nil
}
978660
func GetPlural() RegularSlice {
	plurals := make(RegularSlice, len(pluralInflections))
	copy(plurals, pluralInflections)
	return plurals
}
789371
func Less(s, t string) bool {
	return LessRunes([]rune(s), []rune(t))
}