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

Function find_lemmata

pattern/text/de/__init__.py:178–191  ·  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

176))
177
178def find_lemmata(tokens):
179 """ Annotates the tokens with lemmata for plural nouns and conjugated verbs,
180 where each token is a [word, part-of-speech] list.
181 """
182 for token in tokens:
183 word, pos, lemma = token[0], token[1], token[0]
184 if pos.startswith(("DT", "JJ")):
185 lemma = predicative(word)
186 if pos == "NNS":
187 lemma = singularize(word)
188 if pos.startswith(("VB", "MD")):
189 lemma = conjugate(word, INFINITIVE) or word
190 token.append(lemma.lower())
191 return tokens
192
193class Parser(_Parser):
194

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…