Inflects the verb and returns the given tense (or None). For example: be - Verbs.conjugate("is", INFINITVE) => be - Verbs.conjugate("be", PRESENT, 1, SINGULAR) => I am - Verbs.conjugate("be", PRESENT, 1, PLURAL) => we are - Verbs.conjugate
(self, verb, *args, **kwargs)
| 1394 | return u |
| 1395 | |
| 1396 | def conjugate(self, verb, *args, **kwargs): |
| 1397 | """ Inflects the verb and returns the given tense (or None). |
| 1398 | For example: be |
| 1399 | - Verbs.conjugate("is", INFINITVE) => be |
| 1400 | - Verbs.conjugate("be", PRESENT, 1, SINGULAR) => I am |
| 1401 | - Verbs.conjugate("be", PRESENT, 1, PLURAL) => we are |
| 1402 | - Verbs.conjugate("be", PAST, 3, SINGULAR) => he was |
| 1403 | - Verbs.conjugate("be", PAST, aspect=PROGRESSIVE) => been |
| 1404 | - Verbs.conjugate("be", PAST, person=1, negated=True) => I wasn't |
| 1405 | """ |
| 1406 | id = tense_id(*args, **kwargs) |
| 1407 | # Get the tense index from the format description (or a default). |
| 1408 | i1 = self._format.get(id) |
| 1409 | i2 = self._format.get(self._default.get(id)) |
| 1410 | i3 = self._format.get(self._default.get(self._default.get(id))) |
| 1411 | b = self.lemma(verb, parse=kwargs.get("parse", True)) |
| 1412 | v = [] |
| 1413 | # Get the verb lexeme and return the requested index. |
| 1414 | if b in self: |
| 1415 | v = self[b] |
| 1416 | for i in (i1, i2, i3): |
| 1417 | if i is not None and 0 <= i < len(v) and v[i]: |
| 1418 | return v[i] |
| 1419 | if kwargs.get("parse", True) is True: # rule-based |
| 1420 | v = self.find_lexeme(b) |
| 1421 | for i in (i1, i2, i3): |
| 1422 | if i is not None and 0 <= i < len(v) and v[i]: |
| 1423 | return v[i] |
| 1424 | |
| 1425 | def tenses(self, verb, parse=True): |
| 1426 | """ Returns a list of possible tenses for the given inflected verb. |