Returns the indefinite (ein) or definite (der/die/das/die) article for the given word.
430228
def article(word, function=INDEFINITE, gender=MALE, role=SUBJECT):
    
    return function == DEFINITE \
       and definite_article(word, gender, role) \
        or indefinite_article(word, gender, role)
1089639
def findtext(self, expression):
        """"""
        self.__expression = expression
        return self.__doc.findtext(self.__expression)
860625
@Nullable
  private String getWordAfterEnumerationOrNull(List<String> words, int idx) {
    for (int i = idx; i < words.size(); i++) {
      String word = words.get(i);
      if (!(word.endsWith("-") || StringUtils.equalsAny(word, ",", "und", "oder", "sowie") || word.trim().isEmpty())) {
        return word;
      }
    }
    return null;
  }
1233562
protected static String getAorAnArticle(String word) {
		if (Arrays.asList('a', 'e', 'i', 'o', 'u', 'y').contains(Character.toLowerCase(word.charAt(0)))) {
			return "an"; //$NON-NLS-1$
		}
		return "a"; //$NON-NLS-1$
	}
58652
def gettext(self, singular, plural=None, n=1, locale=None) -> str:
        
        if locale is None:
            locale = self.ctx_locale.get()

        if locale not in self.locales:
            if n is 1:
                return singular
            else:
                return plural

        translator = self.locales[locale]

        if plural is None:
            return translator.gettext(singular)
        else:
            return translator.ngettext(singular, plural, n)
1341445
def lazy_gettext(self, singular, plural=None, n=1, locale=None) -> LazyProxy:
        
        return LazyProxy(self.gettext, singular, plural, n, locale)
142962
def find_lexeme(self, verb):
        
        v = verb.lower()
        # Stem = infinitive minus -en, -ln, -rn.
        b = b0 = re.sub("en$", "", re.sub("ln$", "l", re.sub("rn$", "r", v)))
        # Split common prefixes.
        x, x1, x2 = "", "", ""
        for prefix in prefix_separable:
            if v.startswith(prefix):
                b, x = b[len(prefix):], prefix
                x1 = (" " + x).rstrip()
                x2 = x + "ge"
                break
        # Present tense 1sg and subjunctive -el: handeln => ich handle, du handlest.
        pl = b.endswith("el") and b[:-2]+"l" or b
        # Present tense 1pl -el: handeln => wir handeln
        pw = v.endswith(("ln", "rn")) and v or b+"en"
        # Present tense ending in -d or -t gets -e:
        pr = b.endswith(("d", "t")) and b+"e" or b
        # Present tense 2sg gets -st, unless stem ends with -s or -z.
        p2 = pr.endswith(("s","z")) and pr+"t" or pr+"st"
        # Present participle: spiel + -end, arbeiten + -d:
        pp = v.endswith(("en", "ln", "rn")) and v+"d" or v+"end"
        # Past tense regular:
        pt = encode_sz(pr) + "t"
        # Past participle: haushalten => hausgehalten
        ge = (v.startswith(prefix_inseparable) or b.endswith(("r","t"))) and pt or "ge"+pt
        ge = x and x+"ge"+pt or ge
        # Present subjunctive: stem + -e, -est, -en, -et:
        s1 = encode_sz(pl)
        # Past subjunctive: past (usually with Umlaut) + -e, -est, -en, -et:
        s2 = encode_sz(pt)
        # Construct the lexeme:
        lexeme = a = [
            v, 
            pl+"e"+x1, p2+x1, pr+"t"+x1, pw+x1, pr+"t"+x1, pp,             # present
            pt+"e"+x1, pt+"est"+x1, pt+"e"+x1, pt+"en"+x1, pt+"et"+x1, ge, # past
            b+"e"+x1, pr+"t"+x1, x+pw,                                     # imperative
            s1+"e"+x1, s1+"est"+x1, s1+"en"+x1, s1+"et"+x1,                # subjunctive I
            s2+"e"+x1, s2+"est"+x1, s2+"en"+x1, s2+"et"+x1                 # subjunctive II
        ]
        # Encode Eszett (ß) and attempt to retrieve from the lexicon.
        # Decode Eszett for present and imperative.
        if encode_sz(v) in self:
            a = self[encode_sz(v)]
            a = [decode_sz(v) for v in a[:7]] + a[7:13] + [decode_sz(v) for v in a[13:20]] + a[20:]
        # Since the lexicon does not contain imperative for all verbs, don't simply return it.
        # Instead, update the rule-based lexeme with inflections from the lexicon.
        return [a[i] or lexeme[i] for i in range(len(a))]
704050
public String getOrElse(int i, String def)
    {
        if (i >= 0 && i < values.size())
        {
            return values.get(i);
        }
        return def;
    }
1156938
private static String toBinaryString(int word)
  {
    String lsb = Integer.toBinaryString(word);
    StringBuilder pad = new StringBuilder();
    for (int i = lsb.length(); i < 32; i++) {
      pad.append('0');
    }
    return pad.append(lsb).toString();
  }
171531
@Override
    public int wordFrequency(@NonNull String word) {
        // TODO: proper wordFrequency impl should return long, instead of int
        T element = extendedVocabulary.get(word);
        if (element != null)
            return (int) element.getElementFrequency();
        return 0;
    }
603252
public Optional<Sense> getSense(@NonNull String word, @NonNull POS pos, int senseNum, @NonNull Language language) {
        for (String lemma : Lemmatizers
                                .getLemmatizer(language)
                                .allPossibleLemmas(word, pos)) {
            for (Sense sense : db.getSenses(lemma.toLowerCase())) {
                if ((pos == POS.ANY || pos.isInstance(
                    sense.getPOS())) && sense.getSenseNumber() == senseNum && sense.getLanguage() == language) {
                    return Optional.of(sense);
                }
            }
        }
        return Optional.empty();
    }
1107417
public String getDefinitionForID(String id) {
        if (!terms.containsKey(id))
            return null;
        return terms.get(id).getDef();
    }
94264
def definite_article(word, gender=MALE, role=SUBJECT):
    
    return article_definite.get((gender[:1].lower(), role[:3].lower()))
820206
@Override
    public int docAppearedIn(String word) {
        T element = extendedVocabulary.get(word);
        if (element != null) {
            return (int) element.getSequencesCount();
        } else
            return -1;
    }
1218591
def _normalize(self, word):
        '''
        '''
        if '-' in word and word[0] != '-':
            return '!HYPHEN'
        elif word.isdigit() and len(word) == 4:
            return '!YEAR'
        elif word[0].isdigit():
            return '!DIGITS'
        else:
            return word.lower()
422912
protected static String toSingular(String word) {
		if (word.endsWith("ies")) { //$NON-NLS-1$
			return word.substring(0, word.length() - 3) + "y"; //$NON-NLS-1$
		}
		if (word.endsWith("s")) { //$NON-NLS-1$
			return word.substring(0, word.length() - 1);
		}
		return word;
	}
53416
public String removeClitic(String word) {
    String result = word;
    int endInd = result.lastIndexOf(this.affix);
    return result.substring(0, endInd);
  }