def test_conjugate(self): # Assert different tenses with different conjugations. for (v1, v2, tense) in ( ("zijn", "zijn", nl.INFINITIVE), ("zijn", "ben", (nl.PRESENT, 1, nl.SINGULAR)), ("zijn", "bent", (nl.PRESENT, 2, nl.SINGULAR)), ("zijn", "is", (nl.PRESENT, 3, nl.SINGULAR)), ("zijn", "zijn", (nl.PRESENT, 0, nl.PLURAL)), ("zijn", "zijnd", (nl.PRESENT + nl.PARTICIPLE,)), ("zijn", "was", (nl.PAST, 1, nl.SINGULAR)), ("zijn", "was", (nl.PAST, 2, nl.SINGULAR)), ("zijn", "was", (nl.PAST, 3, nl.SINGULAR)), ("zijn", "waren", (nl.PAST, 0, nl.PLURAL)), ("zijn", "was", (nl.PAST, 0, None)), ("zijn", "geweest", (nl.PAST + nl.PARTICIPLE,)), ("had", "hebben", "inf"), ("had", "heb", "1sg"), ("had", "hebt", "2sg"), ("had", "heeft", "3sg"), ("had", "hebben", "pl"), ("had", "hebbend", "part"), ("heeft", "had", "1sgp"), ("heeft", "had", "2sgp"), ("heeft", "had", "3sgp"), ("heeft", "hadden", "ppl"), ("heeft", "had", "p"), ("heeft", "gehad", "ppart"), ("smsen", "smste", "3sgp")): self.assertEqual(nl.conjugate(v1, tense), v2) print("pattern.nl.conjugate()")
def test_conjugate(self): # Assert different tenses with different conjugations. for (v1, v2, tense) in (("zijn", "zijn", nl.INFINITIVE), ("zijn", "ben", nl.PRESENT_1ST_PERSON_SINGULAR), ("zijn", "bent", nl.PRESENT_2ND_PERSON_SINGULAR), ("zijn", "is", nl.PRESENT_3RD_PERSON_SINGULAR), ("zijn", "zijn", nl.PRESENT_PLURAL), ("zijn", "zijnd", nl.PRESENT_PARTICIPLE), ("zijn", "was", nl.PAST_1ST_PERSON_SINGULAR), ("zijn", "was", nl.PAST_2ND_PERSON_SINGULAR), ("zijn", "was", nl.PAST_3RD_PERSON_SINGULAR), ("zijn", "waren", nl.PAST_PLURAL), ("zijn", "was", nl.PAST), ("zijn", "geweest", nl.PAST_PARTICIPLE), ("had", "hebben", "inf"), ("had", "heb", "1sg"), ("had", "hebt", "2sg"), ("had", "heeft", "3sg"), ("had", "hebben", "pl"), ("had", "hebbend", "part"), ("heeft", "had", "1sgp"), ("heeft", "had", "2sgp"), ("heeft", "had", "3sgp"), ("heeft", "hadden", "ppl"), ("heeft", "had", "p"), ("heeft", "gehad", "ppart"), ("smsen", "smste", "3sgp")): self.assertEqual(nl.conjugate(v1, tense), v2) print "pattern.nl.conjugate()"
def test_conjugate(self): # Assert different tenses with different conjugations. for (v1, v2, tense) in (("zijn", "zijn", nl.INFINITIVE), ("zijn", "ben", (nl.PRESENT, 1, nl.SINGULAR)), ("zijn", "bent", (nl.PRESENT, 2, nl.SINGULAR)), ("zijn", "is", (nl.PRESENT, 3, nl.SINGULAR)), ("zijn", "zijn", (nl.PRESENT, 0, nl.PLURAL)), ("zijn", "zijnd", (nl.PRESENT + nl.PARTICIPLE, )), ("zijn", "was", (nl.PAST, 1, nl.SINGULAR)), ("zijn", "was", (nl.PAST, 2, nl.SINGULAR)), ("zijn", "was", (nl.PAST, 3, nl.SINGULAR)), ("zijn", "waren", (nl.PAST, 0, nl.PLURAL)), ("zijn", "was", (nl.PAST, 0, None)), ("zijn", "geweest", (nl.PAST + nl.PARTICIPLE, )), ("had", "hebben", "inf"), ("had", "heb", "1sg"), ("had", "hebt", "2sg"), ("had", "heeft", "3sg"), ("had", "hebben", "pl"), ("had", "hebbend", "part"), ("heeft", "had", "1sgp"), ("heeft", "had", "2sgp"), ("heeft", "had", "3sgp"), ("heeft", "hadden", "ppl"), ("heeft", "had", "p"), ("heeft", "gehad", "ppart"), ("smsen", "smste", "3sgp")): self.assertEqual(nl.conjugate(v1, tense), v2) print("pattern.nl.conjugate()")
def test_conjugate(self): # Assert different tenses with different conjugations. for (v1, v2, tense) in ( ("zijn", "zijn", nl.INFINITIVE), ("zijn", "ben", nl.PRESENT_1ST_PERSON_SINGULAR), ("zijn", "bent", nl.PRESENT_2ND_PERSON_SINGULAR), ("zijn", "is", nl.PRESENT_3RD_PERSON_SINGULAR), ("zijn", "zijn", nl.PRESENT_PLURAL), ("zijn", "zijnd", nl.PRESENT_PARTICIPLE), ("zijn", "was", nl.PAST_1ST_PERSON_SINGULAR), ("zijn", "was", nl.PAST_2ND_PERSON_SINGULAR), ("zijn", "was", nl.PAST_3RD_PERSON_SINGULAR), ("zijn", "waren", nl.PAST_PLURAL), ("zijn", "was", nl.PAST), ("zijn", "geweest", nl.PAST_PARTICIPLE), ("had", "hebben", "inf"), ("had", "heb", "1sg"), ("had", "hebt", "2sg"), ("had", "heeft", "3sg"), ("had", "hebben", "pl"), ("had", "hebbend", "part"), ("heeft", "had", "1sgp"), ("heeft", "had", "2sgp"), ("heeft", "had", "3sgp"), ("heeft", "hadden", "ppl"), ("heeft", "had", "p"), ("heeft", "gehad", "ppart"), ("smsen", "smste", "3sgp")): self.assertEqual(nl.conjugate(v1, tense), v2) print "pattern.nl.conjugate()"
def wordvarieties(word): lem = lemma(word) pre = predicative(word) att = attributive(word) sin = singularize(word) con = conjugate(word, PRESENT, 1, SG) return [lem, pre, att, sin, con]
def test_parse_lemma(self): # Assert the accuracy of the verb lemmatization algorithm. # Note: the accuracy is higher (90%) when measured on CELEX word forms # (presumably because nl.inflect.VERBS has high percentage irregular verbs). i, n = 0, 0 for v in nl.inflect.VERBS.infinitives: for tense in nl.inflect.VERBS.TENSES: if nl.inflect._parse_lemma(nl.conjugate(v, tense)) == v: i += 1 n += 1 self.assertTrue(float(i) / n > 0.83) print "pattern.nl.inflect._parse_lemma()"