| 216 | #### VERB CONJUGATION ############################################################################## |
| 217 | |
| 218 | class Verbs(_Verbs): |
| 219 | |
| 220 | def __init__(self): |
| 221 | _Verbs.__init__(self, os.path.join(MODULE, "nl-verbs.txt"), |
| 222 | language = "nl", |
| 223 | format = [0, 1, 2, 3, 7, 8, 17, 18, 19, 23, 25, 24, 16, 9, 10, 11, 15, 33, 26, 27, 28, 32], |
| 224 | default = { |
| 225 | 1: 0, 2: 0, 3: 0, 7: 0, # present singular |
| 226 | 4: 7, 5: 7, 6: 7, # present plural |
| 227 | 17: 25, 18: 25, 19: 25, 23: 25, # past singular |
| 228 | 20: 23, 21: 23, 22: 23, # past plural |
| 229 | 9: 16, 10: 16, 11: 16, 15: 16, # present singular negated |
| 230 | 12: 15, 13: 15, 14: 15, # present plural negated |
| 231 | 26: 33, 27: 33, 28: 33, # past singular negated |
| 232 | 29: 32, 30: 32, 31: 32, 32: 33 # past plural negated |
| 233 | }) |
| 234 | |
| 235 | def load(self): |
| 236 | _Verbs.load(self) |
| 237 | self._inverse["was"] = "zijn" # Instead of "wassen". |
| 238 | self._inverse["waren"] = "zijn" |
| 239 | self._inverse["zagen"] = "zien" |
| 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 |
no outgoing calls
no test coverage detected
searching dependent graphs…