MCPcopy Create free account
hub / github.com/clips/pattern / find_lemmata

Function find_lemmata

pattern/text/nl/__init__.py:110–123  ·  view source on GitHub ↗

Annotates the tokens with lemmata for plural nouns and conjugated verbs, where each token is a [word, part-of-speech] list.

(tokens)

Source from the content-addressed store, hash-verified

108))
109
110def find_lemmata(tokens):
111 """ Annotates the tokens with lemmata for plural nouns and conjugated verbs,
112 where each token is a [word, part-of-speech] list.
113 """
114 for token in tokens:
115 word, pos, lemma = token[0], token[1], token[0]
116 if pos.startswith("JJ") and word.endswith("e"):
117 lemma = predicative(word)
118 if pos == "NNS":
119 lemma = singularize(word)
120 if pos.startswith(("VB", "MD")):
121 lemma = conjugate(word, INFINITIVE) or word
122 token.append(lemma.lower())
123 return tokens
124
125class Parser(_Parser):
126

Callers 1

find_lemmataMethod · 0.70

Calls 4

predicativeFunction · 0.90
singularizeFunction · 0.90
conjugateFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…