Suggest the preferred forms.

    source:     Richard Nordquist
    source_url: http://grammar.about.com/bio/Richard-Nordquist-22176.htm
771646
def check_nordquist(text):
    
    err = "redundancy.nordquist"
    msg = "Redundancy. Use '{}' instead of '{}'."

    redundancies = [
        ["essential",          ["absolutely essential"]],
        ["necessary",          ["absolutely necessary"]],
        ["a.m.",               ["a.m. in the morning"]],
        ["p.m.",               ["p.m. at night"]],
    ]
    return preferred_forms_check(text, redundancies, err, msg)
337400
private static String mapUDTagSetToKaf(final String postag) {
    if (postag.equalsIgnoreCase("ADV")) {
      return "A"; // adverb
    } else if (postag.equalsIgnoreCase("CONJ") || postag.equalsIgnoreCase("SCONJ")) {
      return "C"; // conjunction
    } else if (postag.equalsIgnoreCase("DET")) {
      return "D"; // det predeterminer
    } else if (postag.equalsIgnoreCase("ADJ")) {
      return "G"; // adjective
    } else if (postag.equalsIgnoreCase("NOUN")) {
      return "N"; // common noun
    } else if (postag.equalsIgnoreCase("PROPN")) {
      return "R"; // proper noun
    } else if (postag.equalsIgnoreCase("ADP")) {
      return "P"; // preposition
    } else if (postag.equalsIgnoreCase("PRON")) {
      return "Q"; // pronoun
    } else if (postag.startsWith("V")) {
      return "V"; // verb
    } else {
      return "O"; // other
    }
  }
318217
function choosePluralForm(text, locale, count){
    var ret, texts, chosenText;
    if (count != null && text) {
      texts = text.split(delimeter);
      chosenText = texts[pluralTypeIndex(locale, count)] || texts[0];
      ret = trim(chosenText);
    } else {
      ret = text;
    }
    return ret;
  }
1171885
function Ellipsis({ children, title, tag, ...other }) {
  const CustomTagEllipsis = StyledEllipsis.withComponent(tag);

  let textContent = null;

  if (title !== undefined) {
    textContent = title;
  } else if (typeof children === 'string') {
    textContent = children;
  }

  return (
    <CustomTagEllipsis title={textContent} {...other}>
      {children}
    </CustomTagEllipsis>
  );
}
1245722
private boolean isThereReflexivePronoun(
      final AnalyzedTokenReadings[] tokens, int i) {
    Pattern pPronomBuscat = null;
    // 1) es queixa, se li queixa, se li'n queixa
    if (matchPostagRegexp(tokens[i], VERB_INDSUBJ)) {
      pPronomBuscat = pronomPattern(tokens[i]);
      if (pPronomBuscat != null) {
        int j = 1;
        boolean keepCounting = true;
        while (i - j > 0 && j < 4 && keepCounting) {
          if (matchPostagRegexp(tokens[i - j], pPronomBuscat)
              && matchRegexp(tokens[i -j].getToken(), REFLEXIU_ANTEPOSAT))
            return true;
          keepCounting = matchPostagRegexp(tokens[i - j],
              PRONOM_FEBLE);
          j++;
        }
      }
    }
    // 2) queixa't, queixeu-vos-hi
    if (matchPostagRegexp(tokens[i], VERB_IMP)) {
      pPronomBuscat = pronomPattern(tokens[i]);
      if (pPronomBuscat != null) {
        if (i+1<tokens.length
            && matchPostagRegexp(tokens[i + 1], pPronomBuscat)
            && matchRegexp(tokens[i + 1].getToken(), REFLEXIU_POSPOSAT))
          return true; 
      }
    }
    // 3) s'ha queixat, se li ha queixat, se li n'ha queixat.
    if (matchPostagRegexp(tokens[i], VERB_PARTICIPI)) {
      if (tokens[i - 1].hasLemma("haver")) {
        if (matchPostagRegexp(tokens[i - 1], VERB_INDSUBJ)) {
          pPronomBuscat = pronomPattern(tokens[i - 1]);
          if (pPronomBuscat != null) {
            int j = 2;
            boolean keepCounting = true;
            while (i - j > 0 && j < 5 && keepCounting) {
              if (matchPostagRegexp(tokens[i - j], pPronomBuscat)
                  && matchRegexp(tokens[i - j].getToken(), REFLEXIU_ANTEPOSAT))
                return true;
              keepCounting = matchPostagRegexp(tokens[i - j], PRONOM_FEBLE);
              j++;
            }
          }
        }
        // es podria haver endut
        else if (matchPostagRegexp(tokens[i - 1], VERB_INF)
            && matchPostagRegexp(tokens[i - 2], VERB_INDSUBJ)) {
          pPronomBuscat = pronomPattern(tokens[i - 2]);
          if (pPronomBuscat != null) {
            int j = 3;
            boolean keepCounting = true;
            while (i - j > 0 && j < 5 && keepCounting) {
              if (matchPostagRegexp(tokens[i - j], pPronomBuscat)
                  && matchRegexp(tokens[i - j].getToken(), REFLEXIU_ANTEPOSAT))
                return true;
              keepCounting = matchPostagRegexp(tokens[i - j], PRONOM_FEBLE);
              j++;
            }
          }
        }
      }
      // *havent queixat, *haver queixat
//      else if (!(matchLemmaRegexp(tokens[i - 1], VERB_HAVER) && matchPostagRegexp(
//          tokens[i - 1], VERB_INFGER)))
//        return true;
    }
    // 4) em vaig queixar, se li va queixar, se li'n va queixar, vas
    // queixar-te'n,
    // em puc queixar, ens en podem queixar, podeu queixar-vos,
    // es va queixant, va queixant-se, comences queixant-te
    // 5) no t'has de queixar, no has de queixar-te, pareu de queixar-vos,
    // comenceu a queixar-vos
    // corre a queixar-se, corre a queixar-te, vés a queixar-te
    // no hauria pogut burlar-me
    // 6) no podeu deixar de queixar-vos, no us podeu deixar de queixar
    // en teniu prou amb queixar-vos, comenceu lentament a queixar-vos
    // 7) no es va poder emportar, va decidir suïcidar-se,
    // 8) Queixar-se, queixant-vos, podent abstenir-se
    if (matchPostagRegexp(tokens[i], VERB_INFGER)) {
      int k = 1;
      boolean keepCounting = true;
      boolean foundVerb = false;
      while (i - k > 0 && keepCounting && !foundVerb) {
        foundVerb = matchPostagRegexp(tokens[i - k], VERB_INDSUBJIMP);
        keepCounting = matchPostagRegexp(tokens[i - k],
            PREP_VERB_PRONOM);
        if (matchPostagRegexp(tokens[i-k],VERB_INDSUBJ)
            && matchPostagRegexp(tokens[i-k+1],VERB_INFGER))
          keepCounting=false;
        if (matchPostagRegexp(tokens[i - k], VERB_INFGER) //pertanyen a grups verbals diferents
            && matchPostagRegexp(tokens[i - k + 1], PRONOM_FEBLE)
            && !matchRegexp(tokens[i - k + 1].getToken(), PRONOMFEBLE_POSPOSAT)) {
          keepCounting=false;
        }
        k++;
      }
      if (foundVerb) {
        k--;
        pPronomBuscat = pronomPattern(tokens[i - k]);
        if (pPronomBuscat != null) {
          if (i+1< tokens.length
              && matchPostagRegexp(tokens[i + 1], pPronomBuscat)
              && matchRegexp(tokens[i + 1].getToken(), REFLEXIU_POSPOSAT))
            return true;
          int j = 1;
          keepCounting = true;
          while (i - j > 0 && keepCounting) {
            if (j==1 && matchPostagRegexp(tokens[i - j], pPronomBuscat))
              return true;
            if (j>1 && matchPostagRegexp(tokens[i - j], pPronomBuscat)
                && !(matchRegexp(tokens[i - j].getToken(), REFLEXIU_POSPOSAT) && j>k))
              return true;
            keepCounting = matchPostagRegexp(tokens[i - j], PREP_VERB_PRONOM)
                && !(j>k-1 && matchPostagRegexp(tokens[i - j], VERB_PARTICIPI))
                && !matchPostagRegexp(tokens[i - j], TRENCA_COMPTE2);
            if (tokens[i-j].getToken().equalsIgnoreCase("per")
                && tokens[i-j+1].getToken().equalsIgnoreCase("a")) {
              keepCounting=false;
            }
            if (matchPostagRegexp(tokens[i - j], VERB_INFGER) //pertanyen a grups verbals diferents
                && matchPostagRegexp(tokens[i - j + 1], PRONOM_FEBLE)
                && !matchRegexp(tokens[i - j + 1].getToken(), PRONOMFEBLE_POSPOSAT)) {
              keepCounting=false;
            }
            j++;
          }
        }
      } else {
        if (i+1<tokens.length
            && matchPostagRegexp(tokens[i + 1], PRONOM_REFLEXIU)
            && matchRegexp(tokens[i + 1].getToken(), REFLEXIU_POSPOSAT))
          return true;
        int j = 1;
        keepCounting = true;
        while (i - j > 0 && keepCounting) {
          if (matchPostagRegexp(tokens[i - j], PRONOM_REFLEXIU))
            return true;
          keepCounting = matchPostagRegexp(tokens[i - j],
              PREP_VERB_PRONOM);
          if (tokens[i-j].getToken().equalsIgnoreCase("per")
              && tokens[i-j+1].getToken().equalsIgnoreCase("a")) {
            keepCounting=false;
          }
          if (matchPostagRegexp(tokens[i - j], VERB_INFGER) //pertanyen a grups verbals diferents
              && matchPostagRegexp(tokens[i - j + 1], PRONOM_FEBLE)
              && !matchRegexp(tokens[i - j + 1].getToken(), PRONOMFEBLE_POSPOSAT)) {
            keepCounting=false;
          }
          j++;
        }
      }
    }
    return false;
  }
557195
def _irregular(singular, plural):
    
    def caseinsensitive(string):
        return ''.join('[' + char + char.upper() + ']' for char in string)

    if singular[0].upper() == plural[0].upper():
        PLURALS.insert(0, (
            r"(?i)({}){}$".format(singular[0], singular[1:]),
            r'\1' + plural[1:]
        ))
        PLURALS.insert(0, (
            r"(?i)({}){}$".format(plural[0], plural[1:]),
            r'\1' + plural[1:]
        ))
        SINGULARS.insert(0, (
            r"(?i)({}){}$".format(plural[0], plural[1:]),
            r'\1' + singular[1:]
        ))
    else:
        PLURALS.insert(0, (
            r"{}{}$".format(singular[0].upper(),
                            caseinsensitive(singular[1:])),
            plural[0].upper() + plural[1:]
        ))
        PLURALS.insert(0, (
            r"{}{}$".format(singular[0].lower(),
                            caseinsensitive(singular[1:])),
            plural[0].lower() + plural[1:]
        ))
        PLURALS.insert(0, (
            r"{}{}$".format(plural[0].upper(), caseinsensitive(plural[1:])),
            plural[0].upper() + plural[1:]
        ))
        PLURALS.insert(0, (
            r"{}{}$".format(plural[0].lower(), caseinsensitive(plural[1:])),
            plural[0].lower() + plural[1:]
        ))
        SINGULARS.insert(0, (
            r"{}{}$".format(plural[0].upper(), caseinsensitive(plural[1:])),
            singular[0].upper() + singular[1:]
        ))
        SINGULARS.insert(0, (
            r"{}{}$".format(plural[0].lower(), caseinsensitive(plural[1:])),
            singular[0].lower() + singular[1:]
        ))
94264
def definite_article(word, gender=MALE, role=SUBJECT):
    
    return article_definite.get((gender[:1].lower(), role[:3].lower()))
162966
function makeMoment(input, format, lang, strict, utc) {
    if (typeof lang === "boolean") {
        utc = strict;
        strict = lang;
        lang = undefined;
    }
    var itsJalaliDate = (isJalali(this));
    if(input && (typeof input === "string") && !format && itsJalaliDate && !moment.useGregorianParser) {
        input = input.replace(/\//g,"-");
        if(/\d{4}\-\d{2}\-\d{2}/.test(input)) {
            format = "jYYYY-jMM-jDD";
        } else if (/\d{4}\-\d{2}\-\d{1}/.test(input)) {
            format = "jYYYY-jMM-jD";
        } else if (/\d{4}\-\d{1}\-\d{1}/.test(input)) {
            format = "jYYYY-jM-jD";
        } else if (/\d{4}\-\d{1}\-\d{2}/.test(input)) {
            format = "jYYYY-jM-jDD";
        } else if (/\d{4}\-W\d{2}\-\d{2}/.test(input)) {
            format = "jYYYY-jW-jDD";
        } else if (/\d{4}\-\d{3}/.test(input)) {
            format = "jYYYY-jDDD";
        } else if (/\d{8}/.test(input)) {
            format = "jYYYYjMMjDD";
        } else if (/\d{4}W\d{2}\d{1}/.test(input)) {
            format = "jYYYYjWWjD";
        } else if (/\d{4}W\d{2}/.test(input)) {
            format = "jYYYYjWW";
        } else if (/\d{4}\d{3}/.test(input)) {
            format = "jYYYYjDDD";
        }
    }
    if (format && itsJalaliDate){
        format = toJalaliFormat(format);
    }
    if (format && typeof format === "string"){
        format = fixFormat(format, moment);
    }

    var config =
        { _i: input
            , _f: format
            , _l: lang
            , _strict: strict
            , _isUTC: utc
        }
        , date
        , m
        , jm
        , origInput = input
        , origFormat = format;
    if (format) {
        if (isArray(format)) {
            return makeDateFromStringAndArray(config, utc);
        } else {
            date = makeDateFromStringAndFormat(config);
            removeParsedTokens(config);
            format = "YYYY-MM-DD-" + config._f;
            input = leftZeroFill(date[0], 4) + "-"
                + leftZeroFill(date[1] + 1, 2) + "-"
                + leftZeroFill(date[2], 2) + "-"
                + config._i;
        }
    }
    if (utc){
        m = moment.utc(input, format, lang, strict);
    }
    else{
        m = moment(input, format, lang, strict);
    }
    if (config._isValid === false || (input && input._isAMomentObject && !input._isValid)){
        m._isValid = false;
    }
    m._jDiff = config._jDiff || 0;
    jm = objectCreate(jMoment.fn);
    extend(jm, m);
    if (strict && jm.isValid()) {
        jm._isValid = jm.format(origFormat) === origInput;
    }
    if (input && input.calSystem) {
        jm.calSystem = input.calSystem;
    }
    return jm;
}
1239258
def substitute_infinitives_as_subjects(sent_str):
    """"""
    sent_doc = textacy.Doc(sent_str, lang='en_core_web_lg')
    #inf_pattern = r'<PART><VERB>+' # To aux/auxpass* csubj
    inf_pattern = r'<PART><VERB>' # To aux/auxpass* csubj
    infinitives = textacy.extract.pos_regex_matches(sent_doc, inf_pattern)
    inf_subjs = [] # => [[0,1],...]
    for inf in infinitives:
        if inf[0].text.lower() != 'to':
            continue
        if ('csubj' not in [w.dep_ for w in inf] and sent_doc[inf[-1].i + 1].dep_
                != 'csubj'):
            continue
        if inf[-1].tag_ != 'VB':
            continue
        inf_subj = []
        for v in inf:
            inf_subj.append(v.i)
        inf_subjs.append(inf_subj) 
    new_sent_str = sent_str
    unusual_char = '形'
    for inf_subj in inf_subjs:
        start_inf = sent_doc[inf_subj[0]].idx 
        end_inf = sent_doc[inf_subj[-1]].idx + len(sent_doc[inf_subj[-1]])
        inf_len = end_inf - start_inf
        sub = (unusual_char * inf_len)
        new_sent_str = new_sent_str[:start_inf] + sub + new_sent_str[end_inf:]
    new_sent_str = re.sub('形+', '{}', new_sent_str)
    repl = [conjugate(sent_doc[i_s[-1]].text, tense='presentparticiple') for i_s in inf_subjs]
    return new_sent_str.format(*repl)
1171522
def articles(word):
	'''  '''

	from pattern.it import article

	result = [[None], [None]]
	genus = gender(word) or 'f'
	result[0] = [article(word, function = 'definite', gender = genus)]
	result[1] = [article(plural(word)[0], function = 'definite', gender = (genus, 'p'))]
	return result
725307
private static String mapFrenchTagSetToKaf(final String postag) {
    if (postag.startsWith("ADV")) {
      return "A"; // adverb
    } else if (postag.equalsIgnoreCase("CC") || postag.equalsIgnoreCase("CS")) {
      return "C"; // conjunction
    } else if (postag.startsWith("D") || postag.startsWith("I")) {
      return "D"; // det predeterminer
    } else if (postag.startsWith("ADJ")) {
      return "G"; // adjective
    } else if (postag.startsWith("NC")) {
      return "N"; // common noun
    } else if (postag.startsWith("NPP")) {
      return "R"; // proper noun
    } else if (postag.startsWith("PRO") || postag.startsWith("CL")) {
      return "Q"; // pronoun
    } else if (postag.equalsIgnoreCase("P") || postag.equalsIgnoreCase("P+D")
        || postag.equalsIgnoreCase("P+PRO")) {
      return "P"; // preposition
    } else if (postag.startsWith("V")) {
      return "V"; // verb
    } else {
      return "O"; // other
    }
  }
1130026
private static String mapGalicianCTAGTagSetToNAF(final String postag) {
    if (postag.startsWith("R")) {
      return "A"; // adverb
    } else if (postag.equalsIgnoreCase("CC") || postag.equalsIgnoreCase("CS")) {
      return "C"; // conjunction
    } else if (postag.startsWith("D") || postag.startsWith("G")
        || postag.startsWith("X") || postag.startsWith("Q")
        || postag.startsWith("T") || postag.startsWith("I")
        || postag.startsWith("M")) {
      return "D"; // det predeterminer
    } else if (postag.startsWith("A")) {
      return "G"; // adjective
    } else if (postag.startsWith("NC")) {
      return "N"; // common noun
    } else if (postag.startsWith("NP")) {
      return "R"; // proper noun
    } else if (postag.startsWith("S")) {
      return "P"; // preposition9434233199310741
    } else if (postag.startsWith("P")) {
      return "Q"; // pronoun
    } else if (postag.startsWith("V")) {
      return "V"; // verb
    } else {
      return "O"; // other
    }
  }
853110
function addInvisibles(grammar) {
		if (!grammar || grammar['tab']) {
			return;
		}

		// assign invisibles here to "mark" the grammar in case of self references
		for (var name in invisibles) {
			if (invisibles.hasOwnProperty(name)) {
				grammar[name] = invisibles[name];
			}
		}

		for (var name in grammar) {
			if (grammar.hasOwnProperty(name) && !invisibles[name]) {
				if (name === 'rest') {
					addInvisibles(grammar['rest']);
				} else {
					handleToken(grammar, name);
				}
			}
		}
	}
209468
private static String mapUDTagSetToNAF(final String postag) {
    if (postag.equalsIgnoreCase("ADV")) {
      return "A"; // adverb
    } else if (postag.equalsIgnoreCase("CONJ")
        || postag.equalsIgnoreCase("SCONJ")) {
      return "C"; // conjunction
    } else if (postag.equalsIgnoreCase("DET")) {
      return "D"; // det predeterminer
    } else if (postag.equalsIgnoreCase("ADJ")) {
      return "G"; // adjective
    } else if (postag.equalsIgnoreCase("NOUN")) {
      return "N"; // common noun
    } else if (postag.equalsIgnoreCase("PROPN")) {
      return "R"; // proper noun
    } else if (postag.equalsIgnoreCase("ADP")) {
      return "P"; // preposition
    } else if (postag.equalsIgnoreCase("PRON")) {
      return "Q"; // pronoun
    } else if (postag.startsWith("V")) {
      return "V"; // verb
    } else {
      return "O"; // other
    }
  }
1316403
function astSchemaToString(grammarName) {
        return grammarAstRules(grammarName).map(function (r) { return r.name + " <- " + r.astRuleDefn(); }).join('\n');
    }
926907
function stemPluralWord(plural_word){
    var matches = plural_word.match(/^(.*)-(.*)$/);
    if(!matches){
        return plural_word;
    }
    words = [matches[1], matches[2]];

    //malaikat-malaikat-nya -> malaikat malaikat-nya
    suffix = words[1];
    suffixes = ["ku", "mu", "nya", "lah", "kah", "tah", "pun"];
    matches = words[0].match(/^(.*)-(.*)$/);
    if(suffixes.indexOf(suffix) != -1 && matches){
        words[0] = matches[1];
        words[1] = matches[2] + '-' + suffix;
    }

    //berbalas-balasan -> balas
    rootWord1 = stemSingularWord(words[0]);
    rootWord2 = stemSingularWord(words[1]);

    //meniru-nirukan -> tiru
    if(!find(words[1]) && rootWord2==words[1]){
        rootWord2 = stemSingularWord("me" + words[1]);
    }
    if(rootWord1==rootWord2){
        return rootWord1;
    }
    else{
        return plural_word;
    }
}
267601
def present_participle(self, word):
        
        plv = self.plural_verb(word, 2)

        for pat, repl in (
            (r"ie$", r"y"),
            (r"ue$", r"u"),  # TODO: isn't ue$ -> u encompassed in the following rule?
            (r"([auy])e$", r"\g<1>"),
            (r"ski$", r"ski"),
            (r"[^b]i$", r""),
            (r"^(are|were)$", r"be"),
            (r"^(had)$", r"hav"),
            (r"^(hoe)$", r"\g<1>"),
            (r"([^e])e$", r"\g<1>"),
            (r"er$", r"er"),
            (r"([^aeiou][aeiouy]([bdgmnprst]))$", r"\g<1>\g<2>"),
        ):
            (ans, num) = re.subn(pat, repl, plv)
            if num:
                return "%sing" % ans
        return "%sing" % ans