Returns the base form of the given inflected verb, using a rule-based approach. This is problematic if a verb ending in -e is given in the past tense or gerund.
(self, verb)
| 240 | self._inverse["wist"] = "weten" |
| 241 | |
| 242 | def find_lemma(self, verb): |
| 243 | """ Returns the base form of the given inflected verb, using a rule-based approach. |
| 244 | This is problematic if a verb ending in -e is given in the past tense or gerund. |
| 245 | """ |
| 246 | v = verb.lower() |
| 247 | # Common prefixes: op-bouwen and ver-bouwen inflect like bouwen. |
| 248 | for prefix in ("aan", "be", "her", "in", "mee", "ont", "op", "over", "uit", "ver"): |
| 249 | if v.startswith(prefix) and v[len(prefix):] in self.inflections: |
| 250 | return prefix + self.inflections[v[len(prefix):]] |
| 251 | # Present participle -end: hengelend, knippend. |
| 252 | if v.endswith("end"): |
| 253 | b = v[:-3] |
| 254 | # Past singular -de or -te: hengelde, knipte. |
| 255 | elif v.endswith(("de", "det", "te", "tet")): |
| 256 | b = v[:-2] |
| 257 | # Past plural -den or -ten: hengelden, knipten. |
| 258 | elif v.endswith(("chten"),): |
| 259 | b = v[:-2] |
| 260 | elif v.endswith(("den", "ten")) and len(v) > 3 and is_vowel(v[-4]): |
| 261 | b = v[:-2] |
| 262 | elif v.endswith(("den", "ten")): |
| 263 | b = v[:-3] |
| 264 | # Past participle ge- and -d or -t: gehengeld, geknipt. |
| 265 | elif v.endswith(("d","t")) and v.startswith("ge"): |
| 266 | b = v[2:-1] |
| 267 | # Present 2nd or 3rd singular: wordt, denkt, snakt, wacht. |
| 268 | elif v.endswith(("cht"),): |
| 269 | b = v |
| 270 | elif v.endswith(("dt", "bt", "gt", "kt", "mt", "pt", "wt", "xt", "aait", "ooit")): |
| 271 | b = v[:-1] |
| 272 | elif v.endswith("t") and len(v) > 2 and not is_vowel(v[-2]): |
| 273 | b = v[:-1] |
| 274 | elif v.endswith("en") and len(v) > 3: |
| 275 | return v |
| 276 | else: |
| 277 | b = v |
| 278 | # hengel => hengelen (and not hengellen) |
| 279 | if len(b) > 2 and b.endswith(("el", "nder", "om", "tter")) and not is_vowel(b[-3]): |
| 280 | pass |
| 281 | # Long vowel followed by -f or -s: geef => geven. |
| 282 | elif len(b) > 2 and not is_vowel(b[-1]) and is_vowel(b[-2]) and is_vowel(b[-3])\ |
| 283 | or b.endswith(("ijf", "erf"),): |
| 284 | if b.endswith("f"): b = b[:-1] + "v" |
| 285 | if b.endswith("s"): b = b[:-1] + "z" |
| 286 | if b[-2] == b[-3]: |
| 287 | b = b[:-2] + b[-1] |
| 288 | # Short vowel followed by consonant: snak => snakken. |
| 289 | elif len(b) > 1 and not is_vowel(b[-1]) and is_vowel(b[-2]) and not b.endswith(("er","ig")): |
| 290 | b = b + b[-1] |
| 291 | b = b + "en" |
| 292 | b = b.replace("vven", "ven") # omgevven => omgeven |
| 293 | b = b.replace("zzen", "zen") # genezzen => genezen |
| 294 | b = b.replace("aen", "aan") # doorgaen => doorgaan |
| 295 | return b |
| 296 | |
| 297 | def find_lexeme(self, verb): |
| 298 | """ For a regular verb (base form), returns the forms using a rule-based approach. |