def setUp(self): self.maxDiff = 20000 self.ctx = Wtp() self.ctx.analyze_templates() self.ctx.start_page("testpage") self.config = WiktionaryConfig(capture_languages=None, capture_translations=True, capture_pronunciation=True, capture_linkages=True, capture_compounds=True, capture_redirects=True, capture_examples=True)
def run_data(self, item, word="testpage", lang="English", field="related", ruby="", sense=None, senses=[], ctx=None, is_reconstruction=False): """Runs a test where we expect the parsing to return None. This function returns ``data``.""" assert isinstance(item, str) assert isinstance(word, str) assert isinstance(lang, str) assert isinstance(field, str) assert isinstance(ruby, str) assert sense is None or isinstance(sense, str) assert isinstance(senses, list) assert ctx is None or isinstance(ctx, Wtp) ctx1 = ctx if ctx is not None else Wtp() self.ctx = ctx1 self.config = WiktionaryConfig() self.ctx.start_page(word) self.ctx.start_section(lang) data = {} ret = parse_linkage_item_text(self.ctx, word, data, field, item, sense, ruby, senses, is_reconstruction) self.assertIs(ret, None) if ctx is None: self.assertEqual(self.ctx.errors, []) self.assertEqual(self.ctx.warnings, []) self.assertEqual(self.ctx.debugs, []) return data
def test_gender5(self): # Numeric inflection classes should only be interpreted for certain # languages (e.g., Bantu languages) ctx = Wtp() # To allow debug messages data = self.run_data("foo 1", lang="Swedish", ctx=ctx) self.assertEqual(data, {"related": [ {"word": "foo 1"}]})
def test_gender13(self): # They should not be interpreted for other languages ctx = Wtp() # To allow debug messages data = self.run_data("foo 1 or 2", lang="English", ctx=ctx) self.assertEqual(data, {"related": [ {"word": "foo 1"}, {"word": "2"}, ]})
def test_long(self): # Just parse through the data and make sure that we find some words # This takes about 0.5 minutes. langs = collections.defaultdict(int) words = collections.defaultdict(int) poses = collections.defaultdict(int) num_transl = 0 num_redirects = 0 def word_cb(data): nonlocal num_transl nonlocal num_redirects if "redirect" in data: assert isinstance(data["redirect"], str) word = data["title"] words[word] += 1 num_redirects += 1 return word = data["word"] assert word words[word] += 1 lang = data["lang"] pos = data["pos"] assert word and lang and pos langs[lang] += 1 poses[pos] += 1 if data.get("translations"): num_transl += 1 for sense in data.get("senses", ()): if sense.get("translations"): num_transl += 1 path = "tests/test-pages-articles.xml.bz2" print("Parsing test data") ctx = Wtp() config = WiktionaryConfig(capture_languages=[ "English", "Finnish", "Spanish", "German", "Chinese", "Japanese", "Italian", "Portuguese", "Translingual" ], capture_translations=True, capture_pronunciation=True, capture_linkages=True, capture_compounds=True, capture_redirects=True) parse_wiktionary(ctx, path, config, word_cb, None) print("Test data parsing complete") assert num_redirects > 0 assert len(words) > 100 assert all(x < 50 for x in words.values()) assert langs["English"] > 0 assert langs["Finnish"] > 0 assert langs["Translingual"] > 0 assert len(langs.keys()) == 9 assert len(poses.keys()) <= len(wiktextract.PARTS_OF_SPEECH) assert sum(poses.values()) == sum(langs.values()) assert sum(words.values()) == sum(poses.values()) + num_redirects assert num_transl > 0
def test_gender15(self): # inclusive or/English/Translations ctx = Wtp() # To allow debug messages data = self.run_data("μη αποκλειστικό or n (mi apokleistikó or)", lang="Greek", word="inclusive or", ctx=ctx) self.assertEqual(data, {"related": [ {"word": "μη αποκλειστικό or", "tags": ["neuter"], "roman": "mi apokleistikó or"}, ]})
def runonce(self, num_threads): # Just parse through the data and make sure that we find some words path = "tests/test-pages-articles.xml.bz2" print("Parsing test data") ctx = Wtp(num_threads=num_threads) ret = ctx.process(path, page_cb) titles = collections.defaultdict(int) redirects = collections.defaultdict(int) for title, redirect_to in ret: titles[title] += 1 if redirect_to is not None: redirects[redirect_to] += 1 print("Test data parsing complete") assert sum(redirects.values()) > 0 assert len(titles) > 100 assert all(x == 1 for x in titles.values()) assert len(redirects) > 1
def test_prefix16(self): # Triggers an error due to invalid gloss reference ctx = Wtp() data = self.run_data("(4): foo", ctx=ctx, senses=[ {"glosses": ["sense1"]}, {"glosses": ["sense2", "sense2b"]}, {"glosses": ["sense3"]}]) self.assertEqual(data, {"related": [ {"word": "foo"}]}) self.assertNotEqual(ctx.debugs, [])
def parse_with_ctx(title, text, **kwargs): assert isinstance(title, str) assert isinstance(text, str) ctx = Wtp() ctx.analyze_templates() ctx.start_page(title) root = ctx.parse(text, **kwargs) print("parse_with_ctx: root", type(root), root) return root, ctx
class UtilsTests(unittest.TestCase): def setUp(self): self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def test_slashes1(self): ret = split_slashes(self.ctx, "foo ") self.assertEqual(ret, ["foo"]) def test_slashes2(self): ret = split_slashes(self.ctx, "foo bar / zap") self.assertEqual(ret, ["foo bar", "zap"]) def test_slashes3(self): ret = split_slashes(self.ctx, "foo/bar/zap ") self.assertEqual(ret, ["foo", "bar", "zap"]) def test_slashes4(self): ret = split_slashes(self.ctx, "foo bar/zap ") self.assertEqual(ret, ["foo bar", "foo zap"]) def test_slashes5(self): ret = split_slashes(self.ctx, "foo bar/zap ") self.assertEqual(ret, ["foo bar", "foo zap"]) def test_slashes6(self): ret = split_slashes(self.ctx, "foo/bar zap a/b") print("ret:", ret) self.assertEqual(ret, ["bar zap a", "bar zap b", "foo zap a", "foo zap b"]) def test_slashes7(self): self.ctx.add_page("wikitext", "foo", "x") assert self.ctx.page_exists("foo") ret = split_slashes(self.ctx, "foo/bar zap a/b") print("ret:", ret) # XXX this response is still perhaps not what we want with the page # existing self.assertEqual(ret, ["bar zap a", "bar zap b", "foo zap a", "foo zap b"])
class InflTests(unittest.TestCase): def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def xinfl(self, word, lang, pos, section, text): """Runs a single inflection table parsing test, and returns ``data``.""" self.ctx.start_page(word) self.ctx.start_section(lang) self.ctx.start_subsection(pos) tree = self.ctx.parse(text) data = {} parse_inflection_section(self.config, self.ctx, data, word, lang, pos, section, tree) return data def test_GermanLowGerman_verb1(self): ret = self.xinfl("kriegen", "German Low German", "verb", "Conjugation", """ <div class="NavFrame" style="width%3A+42em"> <div class="NavHead" style="background%3A%23CCCCFF%3B">Conjugation of ''kriegen'' (class 1 strong verb)</div> <div class="NavContent"> {| style="width%3A+100%25%3B+border%3A1px+solid+%23CCCCFF%3B+line-height%3A+125%25%3B+background-color%3A%23F9F9F9%3B+text-align%3Acenter%3B+border%3A+1px+solid+%23CCCCFF%3B" cellspacing="1" cellpadding="3" class="inflection-table" |- style="background-color:#F2F2FF; " |- ! style="background-color%3A%23dedeee%3B+font-weight%3Abold%3B" | [[infinitive]] | colspan="2" style="background-color%3A%23EFEFEF%3B" | '''kriegen''' |- ! style="background-color%3A%23CCCCFF%3B+font-weight%3Abold%3B" | [[indicative mood|indicative]] ! style="background-color%3A%23dedeee%3B+font-weight%3Abold%3B" | [[present tense|present]] ! style="background-color%3A%23dedeee%3B+font-weight%3Abold%3B" | [[preterite]] |- ! style="background-color%3A%23eeeeee%3B+font-weight%3Abold%3B" |[[first-person|1st person]] [[singular]] | style="background-color%3A%23efefff%3B" | krieg | style="background-color%3A%23efefff%3B" | kreeg |- ! style="background-color%3A%23eeeeee%3B+font-weight%3Abold%3B" |[[second-person|2nd person]] [[singular]] | style="background-color%3A%23efefff%3B" | kriggs(t) | style="background-color%3A%23efefff%3B" | kreegs(t) |- ! style="background-color%3A%23eeeeee%3B+font-weight%3Abold%3B" |[[third-person|3rd person]] [[singular]] | style="background-color%3A%23efefff%3B" | krigg(t) | style="background-color%3A%23efefff%3B" | kreeg |- ! style="background-color%3A%23eeeeee%3B+font-weight%3Abold%3B" |[[plural]] | style="background-color%3A%23efefff%3B" | kriegt, kriegen | style="background-color%3A%23efefff%3B" | kregen |- ! style="background-color%3A%23CCCCFF%3B+font-weight%3Abold%3B" | [[imperative mood|imperative]] ! style="background-color%3A%23eedede%3B+font-weight%3Abold%3B" | [[present tense|present]] ! style="background-color%3A%23eedede%3B+font-weight%3Abold%3B" | — |- ! style="background-color%3A%23eeeeee%3B+font-weight%3Abold%3B" |[[singular]] | style="background-color%3A%23ffefef%3B" | krieg | style="background-color%3A%23ffefef%3B" | |- ! style="background-color%3A%23eeeeee%3B+font-weight%3Abold%3B" |[[plural]] | style="background-color%3A%23ffefef%3B" | kriegt | style="background-color%3A%23ffefef%3B" | |- ! style="background-color%3A%23CCCCFF%3B+font-weight%3Abold%3B" | [[participle]] ! style="background-color%3A%23deeede%3B+font-weight%3Abold%3B" | [[present tense|present]] ! style="background-color%3A%23deeede%3B+font-weight%3Abold%3B" | [[past tense|past]] |- ! style="background-color%3A%23eeeeee%3B+font-weight%3Abold%3B" | | style="background-color%3A%23efffef%3B" | kriegen | style="background-color%3A%23efffef%3B" | (e)kregen, gekregen |- ! style="text+align%3Aleft%3B+font-weight%3A+normal" colspan="3" |Note: This conjugation is one of many; neither its grammar nor spelling apply to all dialects. |} </div></div>[[Category:Low German class 1 strong verbs]] """) expected = { "forms": [ { "form": "strong", "source": "Conjugation", "tags": [ "table-tags" ] }, { "form": "1 strong verb", "source": "Conjugation", "tags": [ "class" ] }, { "form": "kriegen", "source": "Conjugation", "tags": [ "infinitive" ] }, { "form": "krieg", "source": "Conjugation", "tags": [ "first-person", "indicative", "present", "singular" ] }, { "form": "kreeg", "source": "Conjugation", "tags": [ "first-person", "indicative", "preterite", "singular" ] }, { "form": "kriggs", "source": "Conjugation", "tags": [ "indicative", "present", "second-person", "singular" ] }, { "form": "kriggst", "source": "Conjugation", "tags": [ "indicative", "present", "second-person", "singular" ] }, { "form": "kreegs", "source": "Conjugation", "tags": [ "indicative", "preterite", "second-person", "singular" ] }, { "form": "kreegst", "source": "Conjugation", "tags": [ "indicative", "preterite", "second-person", "singular" ] }, { "form": "krigg", "source": "Conjugation", "tags": [ "indicative", "present", "singular", "third-person" ] }, { "form": "kriggt", "source": "Conjugation", "tags": [ "indicative", "present", "singular", "third-person" ] }, { "form": "kreeg", "source": "Conjugation", "tags": [ "indicative", "preterite", "singular", "third-person" ] }, { "form": "kriegt", "source": "Conjugation", "tags": [ "indicative", "plural", "present" ] }, { "form": "kriegen", "source": "Conjugation", "tags": [ "indicative", "plural", "present" ] }, { "form": "kregen", "source": "Conjugation", "tags": [ "indicative", "plural", "preterite" ] }, { "form": "krieg", "source": "Conjugation", "tags": [ "imperative", "present", "singular" ] }, { "form": "kriegt", "source": "Conjugation", "tags": [ "imperative", "plural", "present" ] }, { "form": "kriegen", "source": "Conjugation", "tags": [ "participle", "present" ] }, { "form": "kregen", "source": "Conjugation", "tags": ["participle", "past"], }, { "form": "ekregen", "source": "Conjugation", "tags": [ "participle", "past" ] }, { "form": "gekregen", "source": "Conjugation", "tags": [ "participle", "past" ] } ], } self.assertEqual(expected, ret)
class InflTests(unittest.TestCase): def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def xinfl(self, word, lang, pos, section, text): """Runs a single inflection table parsing test, and returns ``data``.""" self.ctx.start_page(word) self.ctx.start_section(lang) self.ctx.start_subsection(pos) tree = self.ctx.parse(text) data = {} parse_inflection_section(self.config, self.ctx, data, word, lang, pos, section, tree) return data def test_Polish_verb1(self): ret = self.xinfl( "mówić", "Polish", "verb", "Conjugation", """ <div class="NavFrame"> <div class="NavHead+inflection-table-verb">Conjugation of <i class="Latn+mention" lang="pl">mówić</i> <span class="gender"><abbr title="imperfective+aspect">impf</abbr></span></div> <div class="NavContent"> {| class="wikitable+inflection-table" style="margin%3A+1em+auto%3B" |- ! rowspan="2" | ! ! colspan="3" title="liczba+pojedyncza" | singular ! colspan="2" title="liczba+mnoga" | plural |- ! title="osoba" | person ! title="rodzaj+m%C4%99ski" | masculine ! title="rodzaj+%C5%BCe%C5%84ski" | feminine ! title="rodzaj+nijaki" | neuter ! title="rodzaj+m%C4%99skoosobowy" | virile ! title="rodzaj+niem%C4%99skoosobowy" | nonvirile |- ! colspan="2" title="bezokolicznik" | infinitive | colspan="5" | mówić |- ! rowspan="4" title="czas+tera%C5%BAniejszy" | present tense ! title="pierwsza+osoba+%28ja%2C+my%29" | 1st | colspan="3" | <span class="Latn" lang="pl">[[mówię#Polish|mówię]]</span> | colspan="2" | <span class="Latn" lang="pl">[[mówimy#Polish|mówimy]]</span> |- ! title="druga+osoba+%28ty%2C+wy%29" | 2nd | colspan="3" | <span class="Latn" lang="pl">[[mówisz#Polish|mówisz]]</span> | colspan="2" | <span class="Latn" lang="pl">[[mówicie#Polish|mówicie]]</span> |- ! title="trzecia+osoba+%28on%2C+ona%2C+ono%2C+pan%2C+pani%2C+oni%2C+one%2C+pa%C5%84stwo%29" | 3rd | colspan="3" | <span class="Latn" lang="pl">[[mówi#Polish|mówi]]</span> | colspan="2" | <span class="Latn" lang="pl">[[mówią#Polish|mówią]]</span> |- ! title="forma+bezosobowa" | impersonal | colspan="5" | <span class="Latn" lang="pl">[[mówi#Polish|mówi]] [[się#Polish|się]]</span> |- ! rowspan="4" title="czas+przesz%C5%82y" | past tense ! title="pierwsza+osoba+%28ja%2C+my%29" | 1st | <span class="Latn" lang="pl">[[mówiłem#Polish|mówiłem]]</span> | <span class="Latn" lang="pl">[[mówiłam#Polish|mówiłam]]</span> | | <span class="Latn" lang="pl">[[mówiliśmy#Polish|mówiliśmy]]</span> | <span class="Latn" lang="pl">[[mówiłyśmy#Polish|mówiłyśmy]]</span> |- ! title="druga+osoba+%28ty%2C+wy%29" | 2nd | <span class="Latn" lang="pl">[[mówiłeś#Polish|mówiłeś]]</span> | <span class="Latn" lang="pl">[[mówiłaś#Polish|mówiłaś]]</span> | | <span class="Latn" lang="pl">[[mówiliście#Polish|mówiliście]]</span> | <span class="Latn" lang="pl">[[mówiłyście#Polish|mówiłyście]]</span> |- ! title="trzecia+osoba+%28on%2C+ona%2C+ono%2C+pan%2C+pani%2C+oni%2C+one%2C+pa%C5%84stwo%29" | 3rd | <span class="Latn" lang="pl">[[mówił#Polish|mówił]]</span> | <span class="Latn" lang="pl">[[mówiła#Polish|mówiła]]</span> | <span class="Latn" lang="pl">[[mówiło#Polish|mówiło]]</span> | <span class="Latn" lang="pl">[[mówili#Polish|mówili]]</span> | <span class="Latn" lang="pl">[[mówiły#Polish|mówiły]]</span> |- ! title="forma+bezosobowa" | impersonal | colspan="5" | <span class="Latn" lang="pl">[[mówiono#Polish|mówiono]]</span> |- ! rowspan="4" title="czas+przysz%C5%82y" | future tense ! title="pierwsza+osoba+%28ja%2C+my%29" | 1st | <span class="Latn" lang="pl">[[będę#Polish|będę]] [[mówił#Polish|mówił]]</span>,<br>będę mówić<br> | <span class="Latn" lang="pl">[[będę#Polish|będę]] [[mówiła#Polish|mówiła]]</span>,<br>będę mówić<br> | | <span class="Latn" lang="pl">[[będziemy#Polish|będziemy]] [[mówili#Polish|mówili]]</span>,<br>będziemy mówić<br> | <span class="Latn" lang="pl">[[będziemy#Polish|będziemy]] [[mówiły#Polish|mówiły]]</span>,<br>będziemy mówić<br> |- ! title="druga+osoba+%28ty%2C+wy%29" | 2nd | <span class="Latn" lang="pl">[[będziesz#Polish|będziesz]] [[mówił#Polish|mówił]]</span>,<br>będziesz mówić<br> | <span class="Latn" lang="pl">[[będziesz#Polish|będziesz]] [[mówiła#Polish|mówiła]]</span>,<br>będziesz mówić<br> | | <span class="Latn" lang="pl">[[będziecie#Polish|będziecie]] [[mówili#Polish|mówili]]</span>,<br>będziecie mówić<br> | <span class="Latn" lang="pl">[[będziecie#Polish|będziecie]] [[mówiły#Polish|mówiły]]</span>,<br>będziecie mówić<br> |- ! title="trzecia+osoba+%28on%2C+ona%2C+ono%2C+pan%2C+pani%2C+oni%2C+one%2C+pa%C5%84stwo%29" | 3rd | <span class="Latn" lang="pl">[[będzie#Polish|będzie]] [[mówił#Polish|mówił]]</span>,<br>będzie mówić<br> | <span class="Latn" lang="pl">[[będzie#Polish|będzie]] [[mówiła#Polish|mówiła]]</span>,<br>będzie mówić<br> | <span class="Latn" lang="pl">[[będzie#Polish|będzie]] [[mówiło#Polish|mówiło]]</span>,<br>będzie mówić<br> | <span class="Latn" lang="pl">[[będą#Polish|będą]] [[mówili#Polish|mówili]]</span>,<br>będą mówić<br> | <span class="Latn" lang="pl">[[będą#Polish|będą]] [[mówiły#Polish|mówiły]]</span>,<br>będą mówić<br> |- ! title="forma+bezosobowa" | impersonal | colspan="5" | <span class="Latn" lang="pl">[[będzie#Polish|będzie]] mówić [[się#Polish|się]]</span> |- ! rowspan="4" title="tryb+przypuszczaj%C4%85cy" | conditional ! title="pierwsza+osoba+%28ja%2C+my%29" | 1st | <span class="Latn" lang="pl">[[mówiłbym#Polish|mówiłbym]]</span> | <span class="Latn" lang="pl">[[mówiłabym#Polish|mówiłabym]]</span> | | <span class="Latn" lang="pl">[[mówilibyśmy#Polish|mówilibyśmy]]</span> | <span class="Latn" lang="pl">[[mówiłybyśmy#Polish|mówiłybyśmy]]</span> |- ! title="druga+osoba+%28ty%2C+wy%29" | 2nd | <span class="Latn" lang="pl">[[mówiłbyś#Polish|mówiłbyś]]</span> | <span class="Latn" lang="pl">[[mówiłabyś#Polish|mówiłabyś]]</span> | | <span class="Latn" lang="pl">[[mówilibyście#Polish|mówilibyście]]</span> | <span class="Latn" lang="pl">[[mówiłybyście#Polish|mówiłybyście]]</span> |- ! title="trzecia+osoba+%28on%2C+ona%2C+ono%2C+pan%2C+pani%2C+oni%2C+one%2C+pa%C5%84stwo%29" | 3rd | <span class="Latn" lang="pl">[[mówiłby#Polish|mówiłby]]</span> | <span class="Latn" lang="pl">[[mówiłaby#Polish|mówiłaby]]</span> | <span class="Latn" lang="pl">[[mówiłoby#Polish|mówiłoby]]</span> | <span class="Latn" lang="pl">[[mówiliby#Polish|mówiliby]]</span> | <span class="Latn" lang="pl">[[mówiłyby#Polish|mówiłyby]]</span> |- ! title="forma+bezosobowa" | impersonal | colspan="5" | <span class="Latn" lang="pl">[[mówiono#Polish|mówiono]] [[by#Polish|by]]</span> |- ! rowspan="3" title="tryb+rozkazuj%C4%85cy" | imperative ! title="pierwsza+osoba+%28ja%2C+my%29" | 1st | colspan="3" | <span class="Latn" lang="pl">[[niech#Polish|niech]] [[mówię#Polish|mówię]]</span> | colspan="2" | <span class="Latn" lang="pl">[[mówmy#Polish|mówmy]]</span> |- ! title="druga+osoba+%28ty%2C+wy%29" | 2nd | colspan="3" | <span class="Latn" lang="pl">[[mów#Polish|mów]]</span> | colspan="2" | <span class="Latn" lang="pl">[[mówcie#Polish|mówcie]]</span> |- ! title="trzecia+osoba+%28on%2C+ona%2C+ono%2C+pan%2C+pani%2C+oni%2C+one%2C+pa%C5%84stwo%29" | 3rd | colspan="3" | <span class="Latn" lang="pl">[[niech#Polish|niech]] [[mówi#Polish|mówi]]</span> | colspan="2" | <span class="Latn" lang="pl">[[niech#Polish|niech]] [[mówią#Polish|mówią]]</span> |- ! colspan="2" title="imies%C5%82%C3%B3w+przymiotnikowy+czynny" | active adjectival participle | <span class="Latn" lang="pl">[[mówiący#Polish|mówiący]]</span> | <span class="Latn" lang="pl">[[mówiąca#Polish|mówiąca]]</span> | <span class="Latn" lang="pl">[[mówiące#Polish|mówiące]]</span> | <span class="Latn" lang="pl">[[mówiący#Polish|mówiący]]</span> | <span class="Latn" lang="pl">[[mówiące#Polish|mówiące]]</span> |- ! colspan="2" title="imies%C5%82%C3%B3w+przymiotnikowy+bierny" | passive adjectival participle | <span class="Latn" lang="pl">[[mówiony#Polish|mówiony]]</span> | <span class="Latn" lang="pl">[[mówiona#Polish|mówiona]]</span> | <span class="Latn" lang="pl">[[mówione#Polish|mówione]]</span> | <span class="Latn" lang="pl">[[mówieni#Polish|mówieni]]</span> | <span class="Latn" lang="pl">[[mówione#Polish|mówione]]</span> |- ! colspan="2" title="imies%C5%82%C3%B3w+przys%C5%82%C3%B3wkowy+wsp%C3%B3%C5%82czesny" | contemporary adverbial participle | colspan="5" | <span class="Latn" lang="pl">[[mówiąc#Polish|mówiąc]]</span> |- ! colspan="2" title="rzeczownik+odczasownikowy" | verbal noun | colspan="5" | <span class="Latn" lang="pl">[[mówienie#Polish|mówienie]]</span> |- |} </div></div> """) expected = { "forms": [{ "form": "imperfective", "source": "Conjugation", "tags": ["table-tags"] }, { "form": "mówić", "source": "Conjugation", "tags": ["infinitive"] }, { "form": "mówię", "source": "Conjugation", "tags": ["first-person", "present", "singular"] }, { "form": "mówimy", "source": "Conjugation", "tags": ["first-person", "plural", "present"] }, { "form": "mówisz", "source": "Conjugation", "tags": ["present", "second-person", "singular"] }, { "form": "mówicie", "source": "Conjugation", "tags": ["plural", "present", "second-person"] }, { "form": "mówi", "source": "Conjugation", "tags": ["present", "singular", "third-person"] }, { "form": "mówią", "source": "Conjugation", "tags": ["plural", "present", "third-person"] }, { "form": "mówi się", "source": "Conjugation", "tags": ["impersonal", "present"] }, { "form": "mówiłem", "source": "Conjugation", "tags": ["first-person", "masculine", "past", "singular"] }, { "form": "mówiłam", "source": "Conjugation", "tags": ["feminine", "first-person", "past", "singular"] }, { "form": "mówiliśmy", "source": "Conjugation", "tags": ["first-person", "past", "plural", "virile"] }, { "form": "mówiłyśmy", "source": "Conjugation", "tags": ["first-person", "nonvirile", "past", "plural"] }, { "form": "mówiłeś", "source": "Conjugation", "tags": ["masculine", "past", "second-person", "singular"] }, { "form": "mówiłaś", "source": "Conjugation", "tags": ["feminine", "past", "second-person", "singular"] }, { "form": "mówiliście", "source": "Conjugation", "tags": ["past", "plural", "second-person", "virile"] }, { "form": "mówiłyście", "source": "Conjugation", "tags": ["nonvirile", "past", "plural", "second-person"] }, { "form": "mówił", "source": "Conjugation", "tags": ["masculine", "past", "singular", "third-person"] }, { "form": "mówiła", "source": "Conjugation", "tags": ["feminine", "past", "singular", "third-person"] }, { "form": "mówiło", "source": "Conjugation", "tags": ["neuter", "past", "singular", "third-person"] }, { "form": "mówili", "source": "Conjugation", "tags": ["past", "plural", "third-person", "virile"] }, { "form": "mówiły", "source": "Conjugation", "tags": ["nonvirile", "past", "plural", "third-person"] }, { "form": "mówiono", "source": "Conjugation", "tags": ["impersonal", "past"] }, { "form": "będę mówił", "source": "Conjugation", "tags": ["first-person", "future", "masculine", "singular"] }, { "form": "będę mówić", "source": "Conjugation", "tags": ["first-person", "future", "masculine", "singular"] }, { "form": "będę mówiła", "source": "Conjugation", "tags": ["feminine", "first-person", "future", "singular"] }, { "form": "będę mówić", "source": "Conjugation", "tags": ["feminine", "first-person", "future", "singular"] }, { "form": "będziemy mówili", "source": "Conjugation", "tags": ["first-person", "future", "plural", "virile"] }, { "form": "będziemy mówić", "source": "Conjugation", "tags": ["first-person", "future", "plural", "virile"] }, { "form": "będziemy mówiły", "source": "Conjugation", "tags": ["first-person", "future", "nonvirile", "plural"] }, { "form": "będziemy mówić", "source": "Conjugation", "tags": ["first-person", "future", "nonvirile", "plural"] }, { "form": "będziesz mówił", "source": "Conjugation", "tags": ["future", "masculine", "second-person", "singular"] }, { "form": "będziesz mówić", "source": "Conjugation", "tags": ["future", "masculine", "second-person", "singular"] }, { "form": "będziesz mówiła", "source": "Conjugation", "tags": ["feminine", "future", "second-person", "singular"] }, { "form": "będziesz mówić", "source": "Conjugation", "tags": ["feminine", "future", "second-person", "singular"] }, { "form": "będziecie mówili", "source": "Conjugation", "tags": ["future", "plural", "second-person", "virile"] }, { "form": "będziecie mówić", "source": "Conjugation", "tags": ["future", "plural", "second-person", "virile"] }, { "form": "będziecie mówiły", "source": "Conjugation", "tags": ["future", "nonvirile", "plural", "second-person"] }, { "form": "będziecie mówić", "source": "Conjugation", "tags": ["future", "nonvirile", "plural", "second-person"] }, { "form": "będzie mówił", "source": "Conjugation", "tags": ["future", "masculine", "singular", "third-person"] }, { "form": "będzie mówić", "source": "Conjugation", "tags": ["future", "masculine", "singular", "third-person"] }, { "form": "będzie mówiła", "source": "Conjugation", "tags": ["feminine", "future", "singular", "third-person"] }, { "form": "będzie mówić", "source": "Conjugation", "tags": ["feminine", "future", "singular", "third-person"] }, { "form": "będzie mówiło", "source": "Conjugation", "tags": ["future", "neuter", "singular", "third-person"] }, { "form": "będzie mówić", "source": "Conjugation", "tags": ["future", "neuter", "singular", "third-person"] }, { "form": "będą mówili", "source": "Conjugation", "tags": ["future", "plural", "third-person", "virile"] }, { "form": "będą mówić", "source": "Conjugation", "tags": ["future", "plural", "third-person", "virile"] }, { "form": "będą mówiły", "source": "Conjugation", "tags": ["future", "nonvirile", "plural", "third-person"] }, { "form": "będą mówić", "source": "Conjugation", "tags": ["future", "nonvirile", "plural", "third-person"] }, { "form": "będzie mówić się", "source": "Conjugation", "tags": ["future", "impersonal"] }, { "form": "mówiłbym", "source": "Conjugation", "tags": ["conditional", "first-person", "masculine", "singular"] }, { "form": "mówiłabym", "source": "Conjugation", "tags": ["conditional", "feminine", "first-person", "singular"] }, { "form": "mówilibyśmy", "source": "Conjugation", "tags": ["conditional", "first-person", "plural", "virile"] }, { "form": "mówiłybyśmy", "source": "Conjugation", "tags": ["conditional", "first-person", "nonvirile", "plural"] }, { "form": "mówiłbyś", "source": "Conjugation", "tags": ["conditional", "masculine", "second-person", "singular"] }, { "form": "mówiłabyś", "source": "Conjugation", "tags": ["conditional", "feminine", "second-person", "singular"] }, { "form": "mówilibyście", "source": "Conjugation", "tags": ["conditional", "plural", "second-person", "virile"] }, { "form": "mówiłybyście", "source": "Conjugation", "tags": ["conditional", "nonvirile", "plural", "second-person"] }, { "form": "mówiłby", "source": "Conjugation", "tags": ["conditional", "masculine", "singular", "third-person"] }, { "form": "mówiłaby", "source": "Conjugation", "tags": ["conditional", "feminine", "singular", "third-person"] }, { "form": "mówiłoby", "source": "Conjugation", "tags": ["conditional", "neuter", "singular", "third-person"] }, { "form": "mówiliby", "source": "Conjugation", "tags": ["conditional", "plural", "third-person", "virile"] }, { "form": "mówiłyby", "source": "Conjugation", "tags": ["conditional", "nonvirile", "plural", "third-person"] }, { "form": "mówiono by", "source": "Conjugation", "tags": ["conditional", "impersonal"] }, { "form": "niech mówię", "source": "Conjugation", "tags": ["first-person", "imperative", "singular"] }, { "form": "mówmy", "source": "Conjugation", "tags": ["first-person", "imperative", "plural"] }, { "form": "mów", "source": "Conjugation", "tags": ["imperative", "second-person", "singular"] }, { "form": "mówcie", "source": "Conjugation", "tags": ["imperative", "plural", "second-person"] }, { "form": "niech mówi", "source": "Conjugation", "tags": ["imperative", "singular", "third-person"] }, { "form": "niech mówią", "source": "Conjugation", "tags": ["imperative", "plural", "third-person"] }, { "form": "mówiący", "source": "Conjugation", "tags": [ "active", "adjectival", "masculine", "participle", "singular" ] }, { "form": "mówiąca", "source": "Conjugation", "tags": ["active", "adjectival", "feminine", "participle", "singular"] }, { "form": "mówiące", "source": "Conjugation", "tags": ["active", "adjectival", "neuter", "participle", "singular"] }, { "form": "mówiący", "source": "Conjugation", "tags": ["active", "adjectival", "participle", "plural", "virile"] }, { "form": "mówiące", "source": "Conjugation", "tags": ["active", "adjectival", "nonvirile", "participle", "plural"] }, { "form": "mówiony", "source": "Conjugation", "tags": [ "adjectival", "masculine", "participle", "passive", "singular" ] }, { "form": "mówiona", "source": "Conjugation", "tags": [ "adjectival", "feminine", "participle", "passive", "singular" ] }, { "form": "mówione", "source": "Conjugation", "tags": ["adjectival", "neuter", "participle", "passive", "singular"] }, { "form": "mówieni", "source": "Conjugation", "tags": ["adjectival", "participle", "passive", "plural", "virile"] }, { "form": "mówione", "source": "Conjugation", "tags": ["adjectival", "nonvirile", "participle", "passive", "plural"] }, { "form": "mówiąc", "source": "Conjugation", "tags": ["adjectival", "contemporary", "participle"] }, { "form": "mówienie", "source": "Conjugation", "tags": [ "noun-from-verb", ] }], } self.assertEqual(expected, ret) def test_Polish_noun1(self): ret = self.xinfl( "dziecko", "Polish", "noun", "Declension", """ <div class="NavFrame+inflection-table-noun" style="width%3A+29em"> <div class="NavHead">Declension of <span class="Latn mention" lang="pl" xml:lang="pl">dziecko</span></div> <div class="NavContent"> {| style="width%3A+29em%3B+margin%3A+0%3B" class="wikitable+inflection-table" |- ! style="width%3A+8em%3B" | ! scope="col" | singular ! scope="col" | plural |- ! title="mianownik+%28kto%3F+co%3F%29" scope="row" | nominative | <span class="Latn" lang="pl" xml:lang="pl">[[dziecko]]</span> | <span class="Latn" lang="pl" xml:lang="pl">[[dzieci#Polish|dzieci]]</span> |- ! title="dope%C5%82niacz+%28kogo%3F+czego%3F%29" scope="row" | genitive | <span class="Latn" lang="pl" xml:lang="pl">[[dziecka#Polish|dziecka]]</span> | <span class="Latn" lang="pl" xml:lang="pl">[[dzieci#Polish|dzieci]]</span> |- ! title="celownik+%28komu%3F+czemu%3F%29" scope="row" | dative | <span class="Latn" lang="pl" xml:lang="pl">[[dziecku#Polish|dziecku]]</span> | <span class="Latn" lang="pl" xml:lang="pl">[[dzieciom#Polish|dzieciom]]</span> |- ! title="biernik+%28kogo%3F+co%3F%29" scope="row" | accusative | <span class="Latn" lang="pl" xml:lang="pl">[[dziecko]]</span> | <span class="Latn" lang="pl" xml:lang="pl">[[dzieci#Polish|dzieci]]</span> |- ! title="narz%C4%99dnik+%28kim%3F+czym%3F%29" scope="row" | instrumental | <span class="Latn" lang="pl" xml:lang="pl">[[dzieckiem#Polish|dzieckiem]]</span> | <span class="Latn" lang="pl" xml:lang="pl">[[dziećmi#Polish|dziećmi]]</span> |- ! title="miejscownik+%28o+kim%3F+o+czym%3F%29" scope="row" | locative | <span class="Latn" lang="pl" xml:lang="pl">[[dziecku#Polish|dziecku]]</span> | <span class="Latn" lang="pl" xml:lang="pl">[[dzieciach#Polish|dzieciach]]</span> |- ! title="wo%C5%82acz+%28o%21%29" scope="row" | vocative | <span class="Latn" lang="pl" xml:lang="pl">[[dziecko]]</span> | <span class="Latn" lang="pl" xml:lang="pl">[[dzieci#Polish|dzieci]]</span> |} </div></div> """) expected = { "forms": [{ "form": "", "source": "Declension", "tags": ["table-tags"] }, { "form": "dziecko", "source": "Declension", "tags": ["nominative", "singular"] }, { "form": "dzieci", "source": "Declension", "tags": ["nominative", "plural"] }, { "form": "dziecka", "source": "Declension", "tags": ["genitive", "singular"] }, { "form": "dzieci", "source": "Declension", "tags": ["genitive", "plural"] }, { "form": "dziecku", "source": "Declension", "tags": ["dative", "singular"] }, { "form": "dzieciom", "source": "Declension", "tags": ["dative", "plural"] }, { "form": "dziecko", "source": "Declension", "tags": ["accusative", "singular"] }, { "form": "dzieci", "source": "Declension", "tags": ["accusative", "plural"] }, { "form": "dzieckiem", "source": "Declension", "tags": ["instrumental", "singular"] }, { "form": "dziećmi", "source": "Declension", "tags": ["instrumental", "plural"] }, { "form": "dziecku", "source": "Declension", "tags": ["locative", "singular"] }, { "form": "dzieciach", "source": "Declension", "tags": ["locative", "plural"] }, { "form": "dziecko", "source": "Declension", "tags": ["singular", "vocative"] }, { "form": "dzieci", "source": "Declension", "tags": ["plural", "vocative"] }], } self.assertEqual(expected, ret) def test_Polish_adj1(self): ret = self.xinfl( "wysoki", "Polish", "adj", "Declension", """ <div class="NavFrame+inflection-table-adj" style="width%3A+61em"> <div class="NavHead" align="left">declension of <i class="Latn mention" lang="pl" xml:lang="pl">wysoki</i></div> <div class="NavContent"> {| class="wikitable+inflection-table" style="width%3A+61em%3B+margin%3A+0%3B+border%3A+none%3B" |- ! rowspan="2" style="width%3A+11em%3B" title="przypadek" | case ! colspan="4" scope="colgroup" title="liczba+pojedyncza" | singular ! colspan="3" scope="colgroup" title="liczba+mnoga" | plural |- ! style="min-width%3A+8em%3B" scope="col" title="rodzaj+m%C4%99skoosobowy%2Fm%C4%99skozwierz%C4%99cy" | masculine personal/animate ! style="min-width%3A+8em%3B" scope="col" title="rodzaj+m%C4%99skorzeczowy" | masculine inanimate ! style="min-width%3A+8em%3B" scope="col" title="rodzaj+nijaki" | neuter ! style="min-width%3A+8em%3B" scope="col" title="rodzaj+%C5%BCe%C5%84ski" | feminine ! style="min-width%3A+8em%3B" scope="col" title="rodzaj+m%C4%99skoosobowy" | virile ! style="min-width%3A+8em%3B" scope="col" title="rodzaj+niem%C4%99skoosobowy" | nonvirile |- ! title="mianownik+%28jaki%3F+jaka%3F+jakie%3F%29%2C+wo%C5%82acz+%28o%21%29" scope="row" | nominative, vocative | colspan="2" | <span class="Latn" lang="pl">[[wysoki#Polish|wysoki]]</span> | <span class="Latn" lang="pl">[[wysokie#Polish|wysokie]]</span> | <span class="Latn" lang="pl">[[wysoka#Polish|wysoka]]</span> | <span class="Latn" lang="pl">[[wysocy#Polish|wysocy]]</span> | <span class="Latn" lang="pl">[[wysokie#Polish|wysokie]]</span> |- ! title="dope%C5%82niacz+%28jakiego%3F+jakiej%3F%29" scope="row" | genitive | colspan="3" | <span class="Latn" lang="pl">[[wysokiego#Polish|wysokiego]]</span> | rowspan="2" | <span class="Latn" lang="pl">[[wysokiej#Polish|wysokiej]]</span> | colspan="2" | <span class="Latn" lang="pl">[[wysokich#Polish|wysokich]]</span> |- ! title="celownik+%28jakiemu%3F+jakiej%3F%29" scope="row" | dative | colspan="3" | <span class="Latn" lang="pl">[[wysokiemu#Polish|wysokiemu]]</span> | colspan="2" | <span class="Latn" lang="pl">[[wysokim#Polish|wysokim]]</span> |- ! title="biernik+%28jakiego%3F+jaki%3F+jak%C4%85%3F+jakie%3F%29" scope="row" | accusative | <span class="Latn" lang="pl">[[wysokiego#Polish|wysokiego]]</span> | <span class="Latn" lang="pl">[[wysoki#Polish|wysoki]]</span> | <span class="Latn" lang="pl">[[wysokie#Polish|wysokie]]</span> | rowspan="2" | <span class="Latn" lang="pl">[[wysoką#Polish|wysoką]]</span> | <span class="Latn" lang="pl">[[wysokich#Polish|wysokich]]</span> | <span class="Latn" lang="pl">[[wysokie#Polish|wysokie]]</span> |- ! title="narz%C4%99dnik+%28jakim%3F+jak%C4%85%3F%29" scope="row" | instrumental | colspan="3" rowspan="2" | <span class="Latn" lang="pl">[[wysokim#Polish|wysokim]]</span> | colspan="2" | <span class="Latn" lang="pl">[[wysokimi#Polish|wysokimi]]</span> |- ! title="miejscownik+%28jakim%3F+jakiej%3F%29" scope="row" | locative | <span class="Latn" lang="pl">[[wysokiej#Polish|wysokiej]]</span> | colspan="2" | <span class="Latn" lang="pl">[[wysokich#Polish|wysokich]]</span> |} </div> </div> """) expected = { "forms": [{ "form": "", "source": "Declension", "tags": ["table-tags"] }, { "form": "wysoki", "source": "Declension", "tags": ["masculine", "nominative", "singular", "vocative"] }, { "form": "wysokie", "source": "Declension", "tags": ["neuter", "nominative", "singular", "vocative"] }, { "form": "wysoka", "source": "Declension", "tags": ["feminine", "nominative", "singular", "vocative"] }, { "form": "wysocy", "source": "Declension", "tags": ["nominative", "plural", "virile", "vocative"] }, { "form": "wysokie", "source": "Declension", "tags": ["nominative", "nonvirile", "plural", "vocative"] }, { "form": "wysokiego", "source": "Declension", "tags": ["genitive", "masculine", "neuter", "singular"] }, { "form": "wysokiej", "source": "Declension", "tags": ["feminine", "genitive", "singular"] }, { "form": "wysokich", "source": "Declension", "tags": ["genitive", "plural"] }, { "form": "wysokiemu", "source": "Declension", "tags": ["dative", "masculine", "neuter", "singular"] }, { "form": "wysokiej", "source": "Declension", "tags": ["dative", "feminine", "singular"] }, { "form": "wysokim", "source": "Declension", "tags": ["dative", "plural"] }, { "form": "wysokiego", "source": "Declension", "tags": ["accusative", "animate", "masculine", "singular"] }, { "form": "wysoki", "source": "Declension", "tags": ["accusative", "inanimate", "masculine", "singular"] }, { "form": "wysokie", "source": "Declension", "tags": ["accusative", "neuter", "singular"] }, { "form": "wysoką", "source": "Declension", "tags": ["accusative", "feminine", "singular"] }, { "form": "wysokich", "source": "Declension", "tags": ["accusative", "plural", "virile"] }, { "form": "wysokie", "source": "Declension", "tags": ["accusative", "nonvirile", "plural"] }, { "form": "wysokim", "source": "Declension", "tags": ["instrumental", "masculine", "neuter", "singular"] }, { "form": "wysoką", "source": "Declension", "tags": ["feminine", "instrumental", "singular"] }, { "form": "wysokimi", "source": "Declension", "tags": ["instrumental", "plural"] }, { "form": "wysokim", "source": "Declension", "tags": ["locative", "masculine", "neuter", "singular"] }, { "form": "wysokiej", "source": "Declension", "tags": ["feminine", "locative", "singular"] }, { "form": "wysokich", "source": "Declension", "tags": ["locative", "plural"] }], } self.assertEqual(expected, ret)
def test_prefix18(self): # Triggers error due to invalid prefix ctx = Wtp() data = self.run_data("dsafjdasfkldjas: foo", ctx=ctx) self.assertEqual(data, {"related": [{"word": "foo"}]}) self.assertNotEqual(ctx.debugs, [])
class InflTests(unittest.TestCase): def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def xinfl(self, word, lang, pos, section, text): """Runs a single inflection table parsing test, and returns ``data``.""" self.ctx.start_page(word) self.ctx.start_section(lang) self.ctx.start_subsection(pos) tree = self.ctx.parse(text) data = {} parse_inflection_section(self.config, self.ctx, data, word, lang, pos, section, tree) return data def test_Dutch_verb1(self): ret = self.xinfl( "slapen", "Dutch", "verb", "Inflection", """ {| style="border%3A1px+solid+%23CCCCFF%3B+text-align%3Acenter%3B+line-height%3A125%25" class="inflection-table+vsSwitcher" data-toggle-category="inflection" cellspacing="1" cellpadding="3" |- style="background%3A+%23CCCCFF%3B" ! colspan="5" class="vsToggleElement" style="text-align%3A+left" | Inflection of <i class="Latn+mention" lang="nl">slapen</i> (strong class 7) |- class="vsShow" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[infinitive]] | style="min-width%3A+12em%3B" | <span class="Latn" lang="nl">[[slapen#Dutch|slapen]]</span> |- class="vsShow" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[past tense|past]] [[singular]] | <span class="Latn" lang="nl">[[sliep#Dutch|sliep]]</span> |- class="vsShow" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[past tense|past]] [[participle]] | <span class="Latn" lang="nl">[[geslapen#Dutch|geslapen]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[infinitive]] | colspan="4" | <span class="Latn" lang="nl">[[slapen#Dutch|slapen]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[gerund]] | colspan="4" | <span class="Latn" lang="nl">[[slapen#Dutch|slapen]]</span> <span class="gender"><abbr title="neuter+gender">n</abbr></span> |- class="vsHide" style="background%3A+%23E6E6FF%3B" | | style="min-width%3A+12em%3B+font-weight%3A+bold" | [[present tense]] | style="min-width%3A+12em%3B+font-weight%3A+bold" | [[past tense]] |- |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[first-person|1st person]] [[singular]] | <span class="Latn" lang="nl">[[slaap#Dutch|slaap]]</span> | <span class="Latn" lang="nl">[[sliep#Dutch|sliep]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[second-person|2nd person]] [[singular|sing.]] (<span lang="nl">[[jij#Dutch|jij]]</span>) | <span class="Latn" lang="nl">[[slaapt#Dutch|slaapt]]</span> | <span class="Latn" lang="nl">[[sliep#Dutch|sliep]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[second-person|2nd person]] [[singular|sing.]] (<span lang="nl">[[u#Dutch|u]]</span>) | <span class="Latn" lang="nl">[[slaapt#Dutch|slaapt]]</span> | <span class="Latn" lang="nl">[[sliep#Dutch|sliep]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[second-person|2nd person]] [[singular|sing.]] (<span lang="nl">[[gij#Dutch|gij]]</span>) | <span class="Latn" lang="nl">[[slaapt#Dutch|slaapt]]</span> | <span class="Latn" lang="nl">[[sliept#Dutch|sliept]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[third-person|3rd person]] [[singular]] | <span class="Latn" lang="nl">[[slaapt#Dutch|slaapt]]</span> | <span class="Latn" lang="nl">[[sliep#Dutch|sliep]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[plural]] | <span class="Latn" lang="nl">[[slapen#Dutch|slapen]]</span> | <span class="Latn" lang="nl">[[sliepen#Dutch|sliepen]]</span> |- class="vsHide" style="background%3A+%23E6E6FF%3B+height%3A+0.5em" | | colspan="2" | |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[subjunctive]] [[singular|sing.]]<sup>1</sup> | <span class="Latn" lang="nl">[[slape#Dutch|slape]]</span> | <span class="Latn" lang="nl">[[sliepe#Dutch|sliepe]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[subjunctive]] [[plural|plur.]]<sup>1</sup> | <span class="Latn" lang="nl">[[slapen#Dutch|slapen]]</span> | <span class="Latn" lang="nl">[[sliepen#Dutch|sliepen]]</span> |- class="vsHide" style="background%3A+%23E6E6FF%3B+height%3A+0.5em" | | colspan="2" | |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[imperative]] [[singular|sing.]] | <span class="Latn" lang="nl">[[slaap#Dutch|slaap]]</span> | rowspan="2" style="background%3A+%23E6E6FF%3B" | |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[imperative]] [[plural|plur.]]<sup>1</sup> | <span class="Latn" lang="nl">[[slaapt#Dutch|slaapt]]</span> |- class="vsHide" style="background%3A+%23E6E6FF%3B+height%3A+0.5em" | | colspan="2" | |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[participles]] | <span class="Latn" lang="nl">[[slapend#Dutch|slapend]]</span> | <span class="Latn" lang="nl">[[geslapen#Dutch|geslapen]]</span> |- class="vsHide" style="background%3A+%23E6E6FF%3B" | colspan="5" style="text-align%3Aleft%3B+vertical-align%3Atop%3B+font-size%3A+smaller%3B+line-height%3A+1em" | <sup>1)</sup> [[Wiktionary:Glossary#archaic|Archaic]]. |} [[Category:Dutch class 7 strong verbs|SLAPEN]][[Category:Dutch basic verbs|SLAPEN]] """) expected = { "forms": [{ "form": "strong", "source": "Inflection", "tags": ["table-tags"] }, { "form": "7", "source": "Inflection", "tags": ["class"] }, { "form": "slapen", "source": "Inflection", "tags": ["infinitive"] }, { "form": "slapen", "source": "Inflection", "tags": ["gerund", "neuter"] }, { "form": "slaap", "source": "Inflection", "tags": ["first-person", "present", "singular"] }, { "form": "sliep", "source": "Inflection", "tags": ["first-person", "past", "singular"] }, { "form": "slaapt", "source": "Inflection", "tags": ["present", "second-person", "singular"] }, { "form": "sliep", "source": "Inflection", "tags": ["past", "second-person", "singular"] }, { "form": "slaapt", "source": "Inflection", "tags": ["formal", "present", "second-person", "singular"] }, { "form": "sliep", "source": "Inflection", "tags": ["formal", "past", "second-person", "singular"] }, { "form": "slaapt", "source": "Inflection", "tags": [ "Flanders", "colloquial", "present", "second-person", "singular" ] }, { "form": "slaapt", "source": "Inflection", "tags": [ "archaic", "formal", "majestic", "present", "second-person", "singular" ] }, { "form": "sliept", "source": "Inflection", "tags": [ "Flanders", "colloquial", "past", "second-person", "singular" ] }, { "form": "sliept", "source": "Inflection", "tags": [ "archaic", "formal", "majestic", "past", "second-person", "singular" ] }, { "form": "slaapt", "source": "Inflection", "tags": ["present", "singular", "third-person"] }, { "form": "sliep", "source": "Inflection", "tags": ["past", "singular", "third-person"] }, { "form": "slapen", "source": "Inflection", "tags": ["plural", "present"] }, { "form": "sliepen", "source": "Inflection", "tags": ["past", "plural"] }, { "form": "slape", "source": "Inflection", "tags": ["archaic", "present", "singular", "subjunctive"] }, { "form": "sliepe", "source": "Inflection", "tags": ["archaic", "past", "singular", "subjunctive"] }, { "form": "slapen", "source": "Inflection", "tags": ["archaic", "plural", "present", "subjunctive"] }, { "form": "sliepen", "source": "Inflection", "tags": ["archaic", "past", "plural", "subjunctive"] }, { "form": "slaap", "source": "Inflection", "tags": ["imperative", "present", "singular"] }, { "form": "slaapt", "source": "Inflection", "tags": ["archaic", "imperative", "plural", "present"] }, { "form": "slapend", "source": "Inflection", "tags": ["participle", "present"] }, { "form": "geslapen", "source": "Inflection", "tags": ["participle", "past"] }], } self.assertEqual(expected, ret) def test_Dutch_adj1(self): ret = self.xinfl( "mooi", "Dutch", "adj", "Inflection", """ {| style="border%3A+1px+solid+%23CCCCFF%3B+text-align%3A+center%3B+line-height%3A+125%25%3B" class="inflection-table+vsSwitcher" data-toggle-category="inflection" cellspacing="1" cellpadding="3" |- style="background%3A+%23CCCCFF%3B" ! colspan="5" class="vsToggleElement" style="text-align%3A+left" | Inflection of <i class="Latn+mention" lang="nl">mooi</i> |- class="vsShow" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | uninflected | style="min-width%3A+12em%3B" | <span class="Latn+form-of+lang-nl+indef%7Cn%7Cs-form-of++++++form-of-nostore+" lang="nl">[[mooi#Dutch|mooi]]</span> |- class="vsShow" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | inflected | <span class="Latn+form-of+lang-nl+indef%7Cm%7Cand%7Cf%7Cs-form-of++++++form-of-nostore+" lang="nl">[[mooie#Dutch|mooie]]</span> |- class="vsShow" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | comparative | <span class="Latn+form-of+lang-nl+indef%7Cn%7Cs%7Ccomd-form-of++++++form-of-nostore+" lang="nl">[[mooier#Dutch|mooier]]</span> |- class="vsHide" style="background%3A+%23CCCCFF%3B" | colspan="2" style="background%3A+%23E6E6FF%3B" | ! style="min-width%3A+12em%3B" | [[positive degree|positive]] ! style="min-width%3A+12em%3B" | [[comparative degree|comparative]] ! style="min-width%3A+12em%3B" | [[superlative degree|superlative]] |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" colspan="2" | [[predicative]]/[[adverbial]] | <span class="Latn+form-of+lang-nl+pred-form-of+++++++" lang="nl">[[mooi#Dutch|mooi]]</span> | <span class="Latn+form-of+lang-nl+pred%7Ccomd-form-of+++++++" lang="nl">[[mooier#Dutch|mooier]]</span> | <span class="Latn+form-of+lang-nl+pred%7Csupd-form-of+++++++" lang="nl">het [[mooist#Dutch|mooist]]</span><br><span class="Latn+form-of+lang-nl+pred%7Csupd-form-of+++++++" lang="nl">het [[mooiste#Dutch|mooiste]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" rowspan="3" | [[indefinite]] ! style="background%3A+%23CCCCFF%3B" | [[masculine|m.]]/[[feminine|f.]] [[singular|sing.]] | <span class="Latn+form-of+lang-nl+indef%7Cm%7Cand%7Cf%7Cs-form-of+++++++" lang="nl">[[mooie#Dutch|mooie]]</span> | <span class="Latn+form-of+lang-nl+indef%7Cm%7Cand%7Cf%7Cs%7Ccomd-form-of+++++++" lang="nl">[[mooiere#Dutch|mooiere]]</span> | <span class="Latn+form-of+lang-nl+indef%7Cm%7Cand%7Cf%7Cs%7Csupd-form-of+++++++" lang="nl">[[mooiste#Dutch|mooiste]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" | [[neuter|n.]] [[singular|sing.]] | <span class="Latn+form-of+lang-nl+indef%7Cn%7Cs-form-of+++++++" lang="nl">[[mooi#Dutch|mooi]]</span> | <span class="Latn+form-of+lang-nl+indef%7Cn%7Cs%7Ccomd-form-of+++++++" lang="nl">[[mooier#Dutch|mooier]]</span> | <span class="Latn+form-of+lang-nl+indef%7Cn%7Cs%7Csupd-form-of+++++++" lang="nl">[[mooiste#Dutch|mooiste]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A%23CCCCFF%3B" | [[plural]] | <span class="Latn+form-of+lang-nl+indef%7Cp-form-of+++++++" lang="nl">[[mooie#Dutch|mooie]]</span> | <span class="Latn+form-of+lang-nl+indef%7Cp%7Ccomd-form-of+++++++" lang="nl">[[mooiere#Dutch|mooiere]]</span> | <span class="Latn+form-of+lang-nl+indef%7Cp%7Csupd-form-of+++++++" lang="nl">[[mooiste#Dutch|mooiste]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" colspan="2" | [[definite]] | <span class="Latn+form-of+lang-nl+def-form-of+++++++" lang="nl">[[mooie#Dutch|mooie]]</span> | <span class="Latn+form-of+lang-nl+def%7Ccomd-form-of+++++++" lang="nl">[[mooiere#Dutch|mooiere]]</span> | <span class="Latn+form-of+lang-nl+def%7Csupd-form-of+++++++" lang="nl">[[mooiste#Dutch|mooiste]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23CCCCFF%3B" colspan="2" | [[partitive]] | <span class="Latn+form-of+lang-nl+par-form-of+++++++" lang="nl">[[moois#Dutch|moois]]</span> | <span class="Latn+form-of+lang-nl+par%7Ccomd-form-of+++++++" lang="nl">[[mooiers#Dutch|mooiers]]</span> | — |} """) expected = { "forms": [{ "form": "", "source": "Inflection", "tags": ["table-tags"] }, { "form": "mooi", "source": "Inflection", "tags": ["adverbial", "positive", "predicative"] }, { "form": "mooier", "source": "Inflection", "tags": ["adverbial", "comparative", "predicative"] }, { "form": "het mooist", "source": "Inflection", "tags": ["adverbial", "predicative", "superlative"] }, { "form": "het mooiste", "source": "Inflection", "tags": ["adverbial", "predicative", "superlative"] }, { "form": "mooie", "source": "Inflection", "tags": [ "feminine", "indefinite", "masculine", "positive", "singular" ] }, { "form": "mooiere", "source": "Inflection", "tags": [ "comparative", "feminine", "indefinite", "masculine", "singular" ] }, { "form": "mooiste", "source": "Inflection", "tags": [ "feminine", "indefinite", "masculine", "singular", "superlative" ] }, { "form": "mooi", "source": "Inflection", "tags": ["indefinite", "neuter", "positive", "singular"] }, { "form": "mooier", "source": "Inflection", "tags": ["comparative", "indefinite", "neuter", "singular"] }, { "form": "mooiste", "source": "Inflection", "tags": ["indefinite", "neuter", "singular", "superlative"] }, { "form": "mooie", "source": "Inflection", "tags": ["indefinite", "plural", "positive"] }, { "form": "mooiere", "source": "Inflection", "tags": ["comparative", "indefinite", "plural"] }, { "form": "mooiste", "source": "Inflection", "tags": ["indefinite", "plural", "superlative"] }, { "form": "mooie", "source": "Inflection", "tags": ["definite", "positive"] }, { "form": "mooiere", "source": "Inflection", "tags": ["comparative", "definite"] }, { "form": "mooiste", "source": "Inflection", "tags": ["definite", "superlative"] }, { "form": "moois", "source": "Inflection", "tags": ["partitive", "positive"] }, { "form": "mooiers", "source": "Inflection", "tags": ["comparative", "partitive"] }, { "form": "-", "source": "Inflection", "tags": ["partitive", "superlative"] }], } self.assertEqual(expected, ret)
class PageTests(unittest.TestCase): def setUp(self): self.maxDiff = 20000 self.ctx = Wtp() self.ctx.analyze_templates() self.ctx.start_page("testpage") self.config = WiktionaryConfig(capture_languages=None, capture_translations=True, capture_pronunciation=True, capture_linkages=True, capture_compounds=True, capture_redirects=True, capture_examples=True) def runpage(self, text): assert isinstance(text, str) return parse_page(self.ctx, self.ctx.title, text, self.config) def test_page1(self): lst = self.runpage(""" ==Swedish== ===Noun=== foo f # sense 1 # sense 2 """) # XXX should also capture examples self.assertEqual(lst, [{ "forms": [{ "form": "foo", "tags": ["canonical", "feminine"] }], "lang": "Swedish", "lang_code": "sv", "pos": "noun", "senses": [{ "glosses": ["sense 1"], "raw_glosses": ["sense 1"], }, { "glosses": ["sense 2"], "raw_glosses": ["sense 2"] }], "word": "testpage" }]) def test_page2(self): lst = self.runpage(""" ==Swedish== ===Noun=== testpage f # sense 1 """) # XXX should also capture examples self.assertEqual(lst, [{ "lang": "Swedish", "lang_code": "sv", "pos": "noun", "senses": [ { "glosses": ["sense 1"], "raw_glosses": ["sense 1"], "tags": ["feminine"], }, ], "word": "testpage" }]) def test_page3(self): self.ctx.start_page("Unsupported titles/C sharp") lst = self.runpage(""" ==Swedish== ===Noun=== foo # sense 1 """) # XXX should also capture examples self.assertEqual(lst, [ { "forms": [ { "form": "foo", "tags": ["canonical"] }, ], "lang": "Swedish", "lang_code": "sv", "pos": "noun", "senses": [ { "glosses": ["sense 1"], "raw_glosses": ["sense 1"], }, ], "word": "C#" } ]) def test_page4(self): self.ctx.start_page("foo") lst = self.runpage(""" ==English== ===Noun=== foo # sense 1 # sense 2 # (mycology) mushroom # (person) one who foos ====Translations==== * Finnish: fuu * Swedish: bar m, hop f ====Related terms==== * (sense abc) zap * verbs: zip, zump """) print("RETURNED:", json.dumps(lst, indent=2, sort_keys=True)) # XXX should also capture examples self.assertEqual(lst, [{ "lang": "English", "lang_code": "en", "pos": "noun", "related": [ { "sense": "sense abc", "word": "zap" }, { "word": "zip", "tags": ["verb"] }, { "word": "zump", "tags": ["verb"] }, ], "senses": [ { "glosses": ["sense 1"], "raw_glosses": ["sense 1"], }, { "glosses": ["sense 2"], "raw_glosses": ["sense 2"], }, { "glosses": ["mushroom"], "raw_glosses": ["(mycology) mushroom"], "topics": ["biology", "mycology", "natural-sciences"], }, { "glosses": ["one who foos"], "raw_glosses": ["(person) one who foos"], "tags": ["person"], }, ], "translations": [ { "word": "fuu", "lang": "Finnish", "code": "fi" }, { "word": "bar", "lang": "Swedish", "code": "sv", "tags": ["masculine"] }, { "word": "hop", "lang": "Swedish", "code": "sv", "tags": ["feminine"] }, ], "word": "foo", }])
class LinkageTests(unittest.TestCase): def setUp(self): self.maxDiff = 20000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def run_data(self, item, word="testpage", lang="English", field="related", ruby="", sense=None, senses=[], ctx=None, is_reconstruction=False): """Runs a test where we expect the parsing to return None. This function returns ``data``.""" assert isinstance(item, str) assert isinstance(word, str) assert isinstance(lang, str) assert isinstance(field, str) assert isinstance(ruby, str) assert sense is None or isinstance(sense, str) assert isinstance(senses, list) assert ctx is None or isinstance(ctx, Wtp) ctx1 = ctx if ctx is not None else Wtp() self.ctx = ctx1 self.config = WiktionaryConfig() self.ctx.start_page(word) self.ctx.start_section(lang) data = {} ret = parse_linkage_item_text(self.ctx, word, data, field, item, sense, ruby, senses, is_reconstruction) self.assertIs(ret, None) if ctx is None: self.assertEqual(self.ctx.errors, []) self.assertEqual(self.ctx.warnings, []) self.assertEqual(self.ctx.debugs, []) return data def run_empty(self, item): data = self.run_data(item) self.assertEqual(data, {}) def test_simple1(self): data = self.run_data("plan B") self.assertEqual(data, {"related": [{"word": "plan B"}]}) def test_simple2(self): data = self.run_data("f") self.assertEqual(data, {"related": [{"word": "f"}]}) def test_simple3(self): data = self.run_data("3") self.assertEqual(data, {"related": [{"word": "3"}]}) def test_simple4(self): data = self.run_data("3", lang="Zulu") self.assertEqual(data, {"related": [{"word": "3"}]}) def test_simple5(self): data = self.run_data("u", lang="Swahili") self.assertEqual(data, {"related": [{"word": "u"}]}) def test_simple6(self): data = self.run_data("uu", lang="Swahili") self.assertEqual(data, {"related": [{"word": "uu"}]}) def test_simple7(self): data = self.run_data("f.") self.assertEqual(data, {"related": [{"word": "f."}]}) def test_simple8(self): data = self.run_data("f.") self.assertEqual(data, {"related": [{"word": "f."}]}) def test_simple9(self): data = self.run_data("&c.") self.assertEqual(data, {"related": [{"word": "&c."}]}) def test_simple10(self): data = self.run_data("& cetera") self.assertEqual(data, {"related": [{"word": "& cetera"}]}) def test_simple11(self): data = self.run_data("et cétéra") self.assertEqual(data, {"related": [{"word": "et cétéra"}]}) def test_simple12(self): data = self.run_data("et cætera, et caetera") self.assertEqual(data, {"related": [ {"word": "et cætera"}, {"word": "et caetera"}, ]}) def test_simple13(self): data = self.run_data("a, b, ..., z") self.assertEqual(data, {"related": [ {"word": "a"}, {"word": "b"}, {"word": "z"}, ]}) def test_simple14(self): data = self.run_data("a, b, …, z") self.assertEqual(data, {"related": [ {"word": "a"}, {"word": "b"}, {"word": "z"}, ]}) def test_simple15(self): data = self.run_data(",") self.assertEqual(data, {"related": [ {"word": ","}, ]}) def test_simple16(self): data = self.run_data(";") self.assertEqual(data, {"related": [ {"word": ";"}, ]}) def test_simple17(self): data = self.run_data("or") self.assertEqual(data, {"related": [ {"word": "or"}, ]}) def test_simple18(self): data = self.run_data("and") self.assertEqual(data, {"related": [ {"word": "and"}, ]}) def test_simple19(self): data = self.run_data("a or b") self.assertEqual(data, {"related": [ {"word": "a"}, {"word": "b"}, ]}) def test_simple20(self): data = self.run_data("a (verb)") self.assertEqual(data, {"related": [ {"word": "a", "tags": ["verb"]}]}) def test_simple21(self): data = self.run_data("a (b)") self.assertEqual(data, {"related": [ {"word": "a", "alt": "b"}]}) def test_simple22(self): data = self.run_data("human (H**o sapiens)") self.assertEqual(data, {"related": [ {"word": "human", "taxonomic": "H**o sapiens"}]}) def test_simple23(self): data = self.run_data("neanderthalin ihminen (×H**o neanderthalis)") self.assertEqual(data, {"related": [ {"word": "neanderthalin ihminen", "tags": ["extinct"], "taxonomic": "H**o neanderthalis"}]}) def test_simple24(self): data = self.run_data("×Dinosauria") self.assertEqual(data, {"related": [ {"word": "Dinosauria", "tags": ["extinct"]}]}) def test_simple25(self): data = self.run_data("foo (×Dummy)") self.assertEqual(data, {"related": [ {"word": "foo", "alt": "Dummy", "tags": ["extinct"]}]}) def test_simple26(self): data = self.run_data('foo "a horse"') self.assertEqual(data, {"related": [ {"word": "foo", "english": "a horse"}]}) def test_simple27(self): data = self.run_data("起徛 (Zhangzhou Hokkien)") self.assertEqual(data, {"related": [ {"word": "起徛", "tags": ["Zhangzhou-Hokkien"]}]}) def test_simple28(self): data = self.run_data("全部 (quánbù) (attributive)") self.assertEqual(data, {"related": [ {"word": "全部", "roman": "quánbù", "tags": ["attributive"]}]}) def test_simple29(self): data = self.run_data("整齊/整齐 (zhěngqí)") self.assertEqual(data, {"related": [ {"word": "整齊", "roman": "zhěngqí"}, {"word": "整齐", "roman": "zhěngqí"}, ]}) def test_simple30(self): data = self.run_data("甘心 (gānxīn) (usually in the negative)") self.assertEqual(data, {"related": [ {"word": "甘心", "tags": ["usually", "with-negation"], "roman": "gānxīn"}, ]}) def test_reconstruction1(self): data = self.run_data("*foo", is_reconstruction=True) self.assertEqual(data, {"related": [{"word": "foo"}]}) def test_reconstruction2(self): data = self.run_data("*foo", is_reconstruction=False) self.assertEqual(data, {"related": [{"word": "*foo"}]}) def test_dup1(self): # Duplicates should get eliminated data = self.run_data("foo, bar, foo") self.assertEqual(data, {"related": [ {"word": "foo"}, {"word": "bar"}, ]}) def test_senseonly1(self): # In this case, parse_linkage_item_text should return the sense # for follow-on linkages self.ctx.start_page("滿") self.ctx.start_section("Chinese") data = {} ret = parse_linkage_item_text(self.ctx, "滿", data, "synonyms", "(arrogant):", None, "", [], False) self.assertEqual(ret, "arrogant") def test_sensearg1(self): data = self.run_data("foo", sense="test sense") self.assertEqual(data, {"related": [{"word": "foo", "sense": "test sense"}]}) def test_sensearg2(self): data = self.run_data("foo", sense="intransitive verbs") self.assertEqual(data, {"related": [ {"word": "foo", "tags": ["intransitive", "verb"]}]}) def test_ignore1(self): self.run_empty("Historical and regional synonyms of foo") def test_ignore2(self): self.run_empty("edit data") def test_ignore3(self): self.run_empty("or these other third-person pronouns") def test_ignore4(self): self.run_empty("Signal flag: foobar") def test_ignore5(self): self.run_empty("Semaphore: foobar") def test_ignore6(self): self.run_empty("introduced in Unicode 1.2.3") def test_ignore7(self): self.run_empty("Any of Thesaurus:foobar") def test_ignore8(self): self.run_empty("See contents of Category:foobar") def test_ignore9(self): self.run_empty("domesticated animal: ,,,") def test_ignore10(self): self.run_empty("intransitive: ,, ") def test_ignore11(self): self.run_empty("(intransitive)") def test_ignore12(self): self.run_empty("(intransitive) ,,") def test_ignore13(self): # self-links should be ignored self.run_empty("testpage") def test_ignore_paren1(self): data = self.run_data("foo (foobar used as whatever)") self.assertEqual(data, {"related": [{"word": "foo"}]}) def test_ignore_paren2(self): data = self.run_data("foo (foobar from Etymology 1)") self.assertEqual(data, {"related": [{"word": "foo"}]}) def test_taxonomic1(self): data = self.run_data("Hominidae - family") self.assertEqual(data, {"related": [{"english": "family", "word": "Hominidae"}]}) def test_taxonomic2(self): data = self.run_data("Aotidae, Atelidae - families") self.assertEqual(data, {"related": [{"english": "family", "word": "Aotidae"}, {"english": "family", "word": "Atelidae"}]}) def test_taxonomic3(self): # Currently no special handling for taxonomic terms in linkages. # This might change in the future. data = self.run_data("H**o sapiens") self.assertEqual(data, {"related": [{"word": "H**o sapiens"}]}) def test_taxonomic4(self): data = self.run_data("(order): Eukaryota - superkingdom; " "Animalia - kingdom") self.assertEqual(data, {"related": [ {"sense": "order", "english": "superkingdom", "word": "Eukaryota"}, {"sense": "order", "english": "kingdom", "word": "Animalia"}]}) def test_truncate1(self): data = self.run_data("(blood type): from antigen B") self.assertEqual(data, {"related": [ {"word": "antigen B", "sense": "blood type"}]}) def test_truncate2(self): data = self.run_data("(symbol for boron): abbreviation of boron") self.assertEqual(data, {"related": [ {"word": "boron", "tags": ["abbreviation"], "sense": "symbol for boron"}]}) def test_truncate3(self): data = self.run_data("(cricket, balls): abbreviation of balls") self.assertEqual(data, {"related": [ {"word": "balls", "tags": ["abbreviation"], "topics": ["cricket", "ball-games", "games", "sports", "hobbies", "lifestyle"], "sense": "balls", }]}) def test_truncate4(self): data = self.run_data("(billion): abbreviation of billion") self.assertEqual(data, {"related": [ {"word": "billion", "tags": ["abbreviation"], "sense": "billion", }]}) def test_truncate5(self): data = self.run_data("H**o sapiens on Wikispecies") self.assertEqual(data, {"related": [ {"word": "H**o sapiens"} ]}) def test_truncate6(self): data = self.run_data("dog on English Wiktionary.") self.assertEqual(data, {"related": [ {"word": "dog"} ]}) def test_prefix1(self): data = self.run_data("animal: pet, companion") self.assertEqual(data, {"related": [ {"sense": "animal", "word": "pet"}, {"sense": "animal", "word": "companion"}]}) def test_prefix2(self): data = self.run_data("nouns: pet, companion") self.assertEqual(data, {"related": [ {"tags": ["noun"], "word": "pet"}, {"tags": ["noun"], "word": "companion"}]}) def test_prefix3(self): data = self.run_data("finance: stock, trading") self.assertEqual(data, {"related": [ {"topics": ["finance", "business"], "word": "stock"}, {"topics": ["finance", "business"], "word": "trading"}]}) def test_prefix4(self): data = self.run_data("(animal): pet, companion") self.assertEqual(data, {"related": [ {"sense": "animal", "word": "pet"}, {"sense": "animal", "word": "companion"}]}) def test_prefix5(self): data = self.run_data("(nouns): pet, companion") self.assertEqual(data, {"related": [ {"tags": ["noun"], "word": "pet"}, {"tags": ["noun"], "word": "companion"}]}) def test_prefix6(self): data = self.run_data("(finance): stock, trading") self.assertEqual(data, {"related": [ {"topics": ["finance", "business"], "word": "stock"}, {"topics": ["finance", "business"], "word": "trading"}]}) def test_prefix7(self): # XXX should this affect first linkage only or all of them? data = self.run_data("(animal) pet, companion") self.assertEqual(data, {"related": [ {"sense": "animal", "word": "pet"}, {"word": "companion"}]}) def test_prefix8(self): # XXX should this affect first linkage only or all of them? data = self.run_data("(nouns) pet, companion") self.assertEqual(data, {"related": [ {"tags": ["noun"], "word": "pet"}, {"word": "companion"}]}) def test_prefix9(self): # XXX should this affect first linkage only or all of them? data = self.run_data("(finance) stock, trading") self.assertEqual(data, {"related": [ {"topics": ["finance", "business"], "word": "stock"}, {"word": "trading"}]}) def test_prefix10(self): data = self.run_data("(intransitive, formal, to wander about) meander") self.assertEqual(data, {"related": [ {"sense": "to wander about", "tags": ["formal", "intransitive"], "word": "meander"}]}) def test_prefix11(self): data = self.run_data("(to wander about, intransitive, formal) meander") self.assertEqual(data, {"related": [ {"sense": "to wander about", "tags": ["formal", "intransitive"], "word": "meander"}]}) def test_prefix12(self): data = self.run_data("chemistry (slang): foo") self.assertEqual(data, {"related": [ {"tags": ["slang"], "topics": ["chemistry", "physical-sciences", "natural-sciences"], "word": "foo"}]}) def test_prefix13(self): data = self.run_data("foo: chemistry (slang)") self.assertEqual(data, {"related": [ {"tags": ["slang"], "topics": ["chemistry", "physical-sciences", "natural-sciences"], "word": "foo"}]}) def test_prefix14(self): data = self.run_data("(2): foo", senses=[ {"glosses": ["sense1"]}, {"glosses": ["sense2", "sense2b"]}, {"glosses": ["sense3"]}]) self.assertEqual(data, {"related": [ {"sense": "sense2; sense2b", "word": "foo"}]}) def test_prefix15(self): data = self.run_data("(3): foo", senses=[ {"glosses": ["sense1"]}, {"glosses": ["sense2", "sense2b"]}, {"glosses": ["sense3"]}]) self.assertEqual(data, {"related": [ {"sense": "sense3", "word": "foo"}]}) def test_prefix16(self): # Triggers an error due to invalid gloss reference ctx = Wtp() data = self.run_data("(4): foo", ctx=ctx, senses=[ {"glosses": ["sense1"]}, {"glosses": ["sense2", "sense2b"]}, {"glosses": ["sense3"]}]) self.assertEqual(data, {"related": [ {"word": "foo"}]}) self.assertNotEqual(ctx.debugs, []) def test_prefix17(self): data = self.run_data("(3): foo", sense="initial sense", senses=[ {"glosses": ["sense1"]}, {"glosses": ["sense2", "sense2b"]}, {"glosses": ["sense3"]}]) self.assertEqual(data, {"related": [ {"sense": "initial sense; sense3", "word": "foo"}]}) def test_prefix18(self): # Triggers error due to invalid prefix ctx = Wtp() data = self.run_data("dsafjdasfkldjas: foo", ctx=ctx) self.assertEqual(data, {"related": [{"word": "foo"}]}) self.assertNotEqual(ctx.debugs, []) def test_prefix19(self): data = self.run_data("NATO phonetic: Bravo") self.assertEqual(data, {"related": [ {"word": "Bravo", "english": "NATO phonetic"}]}) def test_prefix20(self): data = self.run_data("Morse code: –···") self.assertEqual(data, {"related": [ {"word": "–···", "english": "Morse code"}]}) def test_prefix21(self): data = self.run_data("Braille: ⠃") self.assertEqual(data, {"related": [ {"word": "⠃", "english": "Braille"}]}) def test_prefix22(self): data = self.run_data("something else in English: foo") self.assertEqual(data, {"related": [ {"word": "foo", "sense": "something else in English"}]}) def test_prefix23(self): data = self.run_data("(intransitive, transitive, verb, frequentative): " "foo") self.assertEqual(data, {"related": [ {"word": "foo", "tags": ["frequentative", "intransitive", "transitive", "verb"]}]}) def test_prefix24(self): data = self.run_data("foo: verb") self.assertEqual(data, {"related": [ {"word": "foo", "tags": ["verb"]}]}) def test_prefix25(self): data = self.run_data("(intransitive, to run, transitive, " "ditransitive): foo") self.assertEqual(data, {"related": [ {"word": "foo", "sense": "to run", "tags": ["ditransitive", "intransitive", "transitive"]}]}) def test_prefix26(self): data = self.run_data("(to run, transitive): foo") self.assertEqual(data, {"related": [ {"word": "foo", "sense": "to run", "tags": ["transitive"]}]}) def test_prefix27(self): data = self.run_data("alternative (B): foo") self.assertEqual(data, {"related": [ {"word": "foo", "sense": "alternative (B)"}]}) def test_prefix28(self): data = self.run_data("(human, H**o sapiens): foo") self.assertEqual(data, {"related": [ {"word": "foo", "sense": "human, H**o sapiens"}]}) def test_prefix29(self): data = self.run_data("H**o sapiens: foo (human)") self.assertEqual(data, {"related": [ {"word": "foo", "english": "human", "sense": "H**o sapiens"}]}) def test_prefix30(self): data = self.run_data("^() foo") self.assertEqual(data, {"related": [ {"word": "foo"}, ]}) def test_prefix31(self): data = self.run_data("^( ) foo") self.assertEqual(data, {"related": [ {"word": "foo"}, ]}) def test_prefix32(self): data = self.run_data("^ foo") self.assertEqual(data, {"related": [ {"word": "foo"}, ]}) def test_prefix33(self): data = self.run_data('(any member of the suborder (sometimes superfamily) Feliformia or Feloidea): feliform ("cat-like" carnivoran), feloid (compare Caniformia, Canoidea)') self.assertEqual(data, {"related": [ {"sense": "any member of the suborder (sometimes superfamily) Feliformia or Feloidea", "word": "feliform", "english": 'cat-like; carnivoran'}, {"sense": "any member of the suborder (sometimes superfamily) Feliformia or Feloidea", "word": "feloid", "english": "compare Caniformia, Canoidea"}, ]}) def test_suffix1(self): data = self.run_data("pet (animal), companion") self.assertEqual(data, {"related": [ {"english": "animal", "word": "pet"}, {"word": "companion"}]}) def test_suffix2(self): data = self.run_data("pet, companion (animal)") self.assertEqual(data, {"related": [ {"word": "pet"}, {"english": "animal", "word": "companion"}]}) def test_suffix3(self): data = self.run_data("pet, companion (animal) (female)") self.assertEqual(data, {"related": [ {"word": "pet"}, {"english": "animal", "tags": ["feminine"], "word": "companion"}]}) def test_suffix4(self): data = self.run_data("pet, companion (female, animal)") self.assertEqual(data, {"related": [ {"word": "pet"}, {"english": "animal", "tags": ["feminine"], "word": "companion"}]}) def test_suffix5(self): data = self.run_data("pet (verb), companion (female, animal)") self.assertEqual(data, {"related": [ {"tags": ["verb"], "word": "pet"}, {"english": "animal", "tags": ["feminine"], "word": "companion"}]}) def test_suffix6(self): data = self.run_data("foo, bar - verbs") self.assertEqual(data, {"related": [ {"tags": ["verb"], "word": "foo"}, {"tags": ["verb"], "word": "bar"}, ]}) def test_suffix7(self): data = self.run_data("a - b") self.assertEqual(data, {"related": [ {"word": "a - b"}, ]}) def test_suffix8(self): data = self.run_data("(no superlative): foo, bar - adjectives") self.assertEqual(data, {"related": [ {"tags": ["adjective", "no-superlative"], "word": "foo"}, {"tags": ["adjective", "no-superlative"], "word": "bar"}, ]}) def test_eq1(self): data = self.run_data("luoda = to create") self.assertEqual(data, {"related": [ {"word": "luoda", "english": "to create"}]}) def test_eq2(self): # This should also work in the opposite order (and it is used both ways) data = self.run_data("to create = luoda") self.assertEqual(data, {"related": [ {"word": "luoda", "english": "to create"}]}) def test_gender1(self): data = self.run_data("foo f", lang="Swedish") self.assertEqual(data, {"related": [ {"tags": ["feminine"], "word": "foo"}]}) def test_gender1(self): data = self.run_data("foo f", lang="Swedish") self.assertEqual(data, {"related": [ {"tags": ["feminine"], "word": "foo"}]}) def test_gender2(self): data = self.run_data("foo m", lang="Swedish") self.assertEqual(data, {"related": [ {"tags": ["masculine"], "word": "foo"}]}) def test_gender3(self): data = self.run_data("foo n", lang="Swedish") self.assertEqual(data, {"related": [ {"tags": ["neuter"], "word": "foo"}]}) def test_gender4(self): # XXX "common" should distinguish gender vs. frequent meanings data = self.run_data("foo c", lang="Swedish") self.assertEqual(data, {"related": [ {"tags": ["common-gender"], "word": "foo"}]}) def test_gender5(self): # Numeric inflection classes should only be interpreted for certain # languages (e.g., Bantu languages) ctx = Wtp() # To allow debug messages data = self.run_data("foo 1", lang="Swedish", ctx=ctx) self.assertEqual(data, {"related": [ {"word": "foo 1"}]}) def test_gender6(self): data = self.run_data("foo 1", lang="Zulu") self.assertEqual(data, {"related": [ {"tags": ["class-1"], "word": "foo"}]}) def test_gender7(self): data = self.run_data("foo 5/6", lang="Zulu") self.assertEqual(data, {"related": [ {"tags": ["class-5", "class-6"], "word": "foo"}]}) def test_gender8(self): data = self.run_data("foo 1a", lang="Zulu") self.assertEqual(data, {"related": [ {"tags": ["class-1a"], "word": "foo"}]}) def test_gender9(self): # These special inflection class markers should only be recognized # for certain languages data = self.run_data("foo mu", lang="Swahili") self.assertEqual(data, {"related": [ {"tags": ["class-18"], "word": "foo"}]}) def test_gender10(self): # Make sure the marker with "or" is handled properly data = self.run_data("foo ki or vi", lang="Swahili") self.assertEqual(data, {"related": [ {"tags": ["class-7", "class-8"], "word": "foo"}]}) def test_gender11(self): # For languages that don't recognize these markers, the "or" should # split linkage into two data = self.run_data("foo ki or vi", lang="English") self.assertEqual(data, {"related": [ {"word": "foo ki"}, {"word": "vi"}]}) def test_gender12(self): data = self.run_data("foo 1 or 2", lang="Ngazidja Comorian") self.assertEqual(data, {"related": [ {"word": "foo", "tags": ["class-1", "class-2"]}, ]}) def test_gender13(self): # They should not be interpreted for other languages ctx = Wtp() # To allow debug messages data = self.run_data("foo 1 or 2", lang="English", ctx=ctx) self.assertEqual(data, {"related": [ {"word": "foo 1"}, {"word": "2"}, ]}) def test_gender14(self): # pants/English/Translations data = self.run_data("kelnės f or n", lang="Lithuanian") self.assertEqual(data, {"related": [ {"word": "kelnės", "tags": ["feminine", "neuter"]}, ]}) def test_gender15(self): # inclusive or/English/Translations ctx = Wtp() # To allow debug messages data = self.run_data("μη αποκλειστικό or n (mi apokleistikó or)", lang="Greek", word="inclusive or", ctx=ctx) self.assertEqual(data, {"related": [ {"word": "μη αποκλειστικό or", "tags": ["neuter"], "roman": "mi apokleistikó or"}, ]}) def test_gender16(self): # simplified from wife/English/Translations data = self.run_data("ווײַב n or f, פֿרוי f (froy)", lang="Yiddish") print(json.dumps(data, indent=2, sort_keys=True)) self.assertEqual(data, {"related": [ {"word": "ווײַב", "tags": ["feminine", "neuter"]}, {"word": "פֿרוי", "tags": ["feminine"], "roman": "froy"}, ]}) def test_gender16orig(self): # wife/English/Translations data = self.run_data("ווײַב n (vayb) or f, פֿרוי f (froy)", lang="Yiddish") self.assertEqual(data, {"related": [ {"word": "ווײַב", "tags": ["feminine", "neuter"], "roman": "vayb"}, {"word": "פֿרוי", "tags": ["feminine"], "roman": "froy"}, ]}) def test_gender17(self): # homonym/English/Translations/French data = self.run_data("homonyme m or n", lang="French") self.assertEqual(data, {"related": [ {"word": "homonyme", "tags": ["masculine", "neuter"]}, ]}) def test_gender18(self): # dragonfly/Eng/Tr/Zulu data = self.run_data("uzekamanzi 1a or 2a", lang="Zulu") self.assertEqual(data, {"related": [ {"word": "uzekamanzi", "tags": ["class-1a", "class-2a"]}, ]}) def test_gender19(self): # Spanish Netherlands/Tr/French data = self.run_data("Pays-Bas espagnois pl or m", lang="French") self.assertEqual(data, {"related": [ {"word": "Pays-Bas espagnois", "tags": ["masculine", "plural", "singular"]}, ]}) def test_begining_tags1(self): data = self.run_data("frequentative juoksennella, cohortative juostaan", lang="Finnish") self.assertEqual(data, {"related": [ {"tags": ["frequentative"], "word": "juoksennella"}, {"tags": ["cohortative"], "word": "juostaan"}]}) def test_begining_tags2(self): data = self.run_data("frequentative", lang="Finnish") self.assertEqual(data, {"related": [ {"word": "frequentative"}]}) def test_jp1(self): data = self.run_data("一犬 (ikken): one dog", lang="Japanese", field="compounds", ruby="いっけん") self.assertEqual(data, {"compounds": [ {"word": "一犬", "roman": "ikken", "ruby": "いっけん", "english": "one dog"}]}) def test_jp2(self): # This twisted test just tries to cover a rare code path data = self.run_data("一犬 (ikken): one dog - family") self.assertEqual(data, {"related": [ {"word": "一犬", "roman": "ikken", "english": "family; one dog"}]}) def test_jp3(self): # This synthetic test tries to cover a case where there is also # an "alt" in the parentheses data = self.run_data("一犬 (滿洲, ikken): one dog") self.assertEqual(data, {"related": [ {"word": "一犬", "alt": "滿洲", "roman": "ikken", "english": "one dog"}]}) def test_ko1(self): data = self.run_data("만주 (滿洲, Manju, “Manchuria”)", lang="Korean") self.assertEqual(data, {"related": [ {"word": "만주", "alt": "滿洲", "roman": "Manju", "english": "Manchuria"}]}) def test_zh1(self): data = self.run_data("(to be brimming with): 充滿/充满 (chōngmǎn), " "充盈 (chōngyíng), 洋溢 (yángyì)", field="synonyms") self.assertEqual(data, {"synonyms": [ {"sense": "to be brimming with", "word": "充滿", "roman": "chōngmǎn"}, {"sense": "to be brimming with", "word": "充满", "roman": "chōngmǎn"}, {"sense": "to be brimming with", "word": "充盈", "roman": "chōngyíng"}, {"sense": "to be brimming with", "word": "洋溢", "roman": "yángyì"}]}) def test_papersizes1(self): data = self.run_data("(A paper sizes): 2A0 A0 A1 A2 A3 A4 " "A5 A6 A7 A8 A9 A10") self.assertEqual(data, {"related": [ {"sense": "A paper sizes", "word": "2A0"}, {"sense": "A paper sizes", "word": "A0"}, {"sense": "A paper sizes", "word": "A1"}, {"sense": "A paper sizes", "word": "A2"}, {"sense": "A paper sizes", "word": "A3"}, {"sense": "A paper sizes", "word": "A4"}, {"sense": "A paper sizes", "word": "A5"}, {"sense": "A paper sizes", "word": "A6"}, {"sense": "A paper sizes", "word": "A7"}, {"sense": "A paper sizes", "word": "A8"}, {"sense": "A paper sizes", "word": "A9"}, {"sense": "A paper sizes", "word": "A10"}]}) def test_papersizes2(self): data = self.run_data(" (B paper sizes): B0 B1 B2 B3 B4 " "B5 B6 B7 B8 B9 B10 ") self.assertEqual(data, {"related": [ {"sense": "B paper sizes", "word": "B0"}, {"sense": "B paper sizes", "word": "B1"}, {"sense": "B paper sizes", "word": "B2"}, {"sense": "B paper sizes", "word": "B3"}, {"sense": "B paper sizes", "word": "B4"}, {"sense": "B paper sizes", "word": "B5"}, {"sense": "B paper sizes", "word": "B6"}, {"sense": "B paper sizes", "word": "B7"}, {"sense": "B paper sizes", "word": "B8"}, {"sense": "B paper sizes", "word": "B9"}, {"sense": "B paper sizes", "word": "B10"}]}) def test_script1(self): data = self.run_data("(Arabic digits): 0 1 2 3 4 5 6 7 8 9") self.assertEqual(data, {"related": [ {"tags": ["Arabic", "digit"], "word": "0"}, {"tags": ["Arabic", "digit"], "word": "1"}, {"tags": ["Arabic", "digit"], "word": "2"}, {"tags": ["Arabic", "digit"], "word": "3"}, {"tags": ["Arabic", "digit"], "word": "4"}, {"tags": ["Arabic", "digit"], "word": "5"}, {"tags": ["Arabic", "digit"], "word": "6"}, {"tags": ["Arabic", "digit"], "word": "7"}, {"tags": ["Arabic", "digit"], "word": "8"}, {"tags": ["Arabic", "digit"], "word": "9"}]}) def test_script2(self): data = self.run_data("(Latin script): Aa Bb Cc Dd Ee Ff Gg Hh " "Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Sſs Tt " "Uu Vv Ww Xx Yy Zz") self.assertEqual(data, {"related": [ {"tags": ["Latin", "character"], "word": "A"}, {"tags": ["Latin", "character"], "word": "a"}, {"tags": ["Latin", "character"], "word": "B"}, {"tags": ["Latin", "character"], "word": "b"}, {"tags": ["Latin", "character"], "word": "C"}, {"tags": ["Latin", "character"], "word": "c"}, {"tags": ["Latin", "character"], "word": "D"}, {"tags": ["Latin", "character"], "word": "d"}, {"tags": ["Latin", "character"], "word": "E"}, {"tags": ["Latin", "character"], "word": "e"}, {"tags": ["Latin", "character"], "word": "F"}, {"tags": ["Latin", "character"], "word": "f"}, {"tags": ["Latin", "character"], "word": "G"}, {"tags": ["Latin", "character"], "word": "g"}, {"tags": ["Latin", "character"], "word": "H"}, {"tags": ["Latin", "character"], "word": "h"}, {"tags": ["Latin", "character"], "word": "I"}, {"tags": ["Latin", "character"], "word": "i"}, {"tags": ["Latin", "character"], "word": "J"}, {"tags": ["Latin", "character"], "word": "j"}, {"tags": ["Latin", "character"], "word": "K"}, {"tags": ["Latin", "character"], "word": "k"}, {"tags": ["Latin", "character"], "word": "L"}, {"tags": ["Latin", "character"], "word": "l"}, {"tags": ["Latin", "character"], "word": "M"}, {"tags": ["Latin", "character"], "word": "m"}, {"tags": ["Latin", "character"], "word": "N"}, {"tags": ["Latin", "character"], "word": "n"}, {"tags": ["Latin", "character"], "word": "O"}, {"tags": ["Latin", "character"], "word": "o"}, {"tags": ["Latin", "character"], "word": "P"}, {"tags": ["Latin", "character"], "word": "p"}, {"tags": ["Latin", "character"], "word": "Q"}, {"tags": ["Latin", "character"], "word": "q"}, {"tags": ["Latin", "character"], "word": "R"}, {"tags": ["Latin", "character"], "word": "r"}, {"tags": ["Latin", "character"], "word": "S"}, {"tags": ["Latin", "character"], "word": "ſ"}, {"tags": ["Latin", "character"], "word": "s"}, {"tags": ["Latin", "character"], "word": "T"}, {"tags": ["Latin", "character"], "word": "t"}, {"tags": ["Latin", "character"], "word": "U"}, {"tags": ["Latin", "character"], "word": "u"}, {"tags": ["Latin", "character"], "word": "V"}, {"tags": ["Latin", "character"], "word": "v"}, {"tags": ["Latin", "character"], "word": "W"}, {"tags": ["Latin", "character"], "word": "w"}, {"tags": ["Latin", "character"], "word": "X"}, {"tags": ["Latin", "character"], "word": "x"}, {"tags": ["Latin", "character"], "word": "Y"}, {"tags": ["Latin", "character"], "word": "y"}, {"tags": ["Latin", "character"], "word": "Z"}, {"tags": ["Latin", "character"], "word": "z"}, ]}) def test_script3(self): data = self.run_data("(Variations of letter B): Ḃḃ Ḅḅ Ḇḇ Ƀƀ Ɓɓ Ƃƃ ᵬ ᶀ ʙ Bb ȸ ℔ Ꞗꞗ") self.assertEqual(data, {"related": [ {"sense": "Variations of letter B", "tags": ["letter"], "word": "Ḃ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ḃ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "Ḅ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ḅ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "Ḇ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ḇ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "Ƀ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ƀ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "Ɓ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ɓ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "Ƃ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ƃ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ᵬ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ᶀ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ʙ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "B"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "b"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ȸ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "℔"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "Ꞗ"}, {"sense": "Variations of letter B", "tags": ["letter"], "word": "ꞗ"}, ]}) def test_script4(self): # This should get ignored data = self.run_data('For more variations, see Appendix:Variations of "b".') self.assertEqual(data, {}) def test_script5(self): data = self.run_data('(other scripts) Β (B, “Beta”), Б (B, “Be”), ' 'В (V, “Ve”), ב (b, “beth”)') self.assertEqual(data, {"related": [ {"word": "Β", "roman": "B", "english": "Beta", "sense": "other scripts"}, {"word": "Б", "roman": "B", "english": "Be"}, {"word": "В", "roman": "V", "english": "Ve"}, # XXX what should happen with the left-to-right mark here? {"word": "ב\u200e", "roman": "b", "english": "beth"}, ]}) def test_script6(self): data = self.run_data("(Latin-script letters) letter; A a, B b, C c, " "D d, E e, F f, G g, H h, I i, J j, K k, L l, " "M m, N n, O o, P p, Q q, R r, S s, T t, U u, " "V v, W w, X x, Y y, Z z", lang="English") self.assertEqual(data, {"related": [ {"tags": ["Latin", "letter"], "word": "letter"}, {"tags": ["Latin", "letter"], "word": "A"}, {"tags": ["Latin", "letter"], "word": "a"}, {"tags": ["Latin", "letter"], "word": "B"}, {"tags": ["Latin", "letter"], "word": "b"}, {"tags": ["Latin", "letter"], "word": "C"}, {"tags": ["Latin", "letter"], "word": "c"}, {"tags": ["Latin", "letter"], "word": "D"}, {"tags": ["Latin", "letter"], "word": "d"}, {"tags": ["Latin", "letter"], "word": "E"}, {"tags": ["Latin", "letter"], "word": "e"}, {"tags": ["Latin", "letter"], "word": "F"}, {"tags": ["Latin", "letter"], "word": "f"}, {"tags": ["Latin", "letter"], "word": "G"}, {"tags": ["Latin", "letter"], "word": "g"}, {"tags": ["Latin", "letter"], "word": "H"}, {"tags": ["Latin", "letter"], "word": "h"}, {"tags": ["Latin", "letter"], "word": "I"}, {"tags": ["Latin", "letter"], "word": "i"}, {"tags": ["Latin", "letter"], "word": "J"}, {"tags": ["Latin", "letter"], "word": "j"}, {"tags": ["Latin", "letter"], "word": "K"}, {"tags": ["Latin", "letter"], "word": "k"}, {"tags": ["Latin", "letter"], "word": "L"}, {"tags": ["Latin", "letter"], "word": "l"}, {"tags": ["Latin", "letter"], "word": "M"}, {"tags": ["Latin", "letter"], "word": "m"}, {"tags": ["Latin", "letter"], "word": "N"}, {"tags": ["Latin", "letter"], "word": "n"}, {"tags": ["Latin", "letter"], "word": "O"}, {"tags": ["Latin", "letter"], "word": "o"}, {"tags": ["Latin", "letter"], "word": "P"}, {"tags": ["Latin", "letter"], "word": "p"}, {"tags": ["Latin", "letter"], "word": "Q"}, {"tags": ["Latin", "letter"], "word": "q"}, {"tags": ["Latin", "letter"], "word": "R"}, {"tags": ["Latin", "letter"], "word": "r"}, {"tags": ["Latin", "letter"], "word": "S"}, {"tags": ["Latin", "letter"], "word": "s"}, {"tags": ["Latin", "letter"], "word": "T"}, {"tags": ["Latin", "letter"], "word": "t"}, {"tags": ["Latin", "letter"], "word": "U"}, {"tags": ["Latin", "letter"], "word": "u"}, {"tags": ["Latin", "letter"], "word": "V"}, {"tags": ["Latin", "letter"], "word": "v"}, {"tags": ["Latin", "letter"], "word": "W"}, {"tags": ["Latin", "letter"], "word": "w"}, {"tags": ["Latin", "letter"], "word": "X"}, {"tags": ["Latin", "letter"], "word": "x"}, {"tags": ["Latin", "letter"], "word": "Y"}, {"tags": ["Latin", "letter"], "word": "y"}, {"tags": ["Latin", "letter"], "word": "Z"}, {"tags": ["Latin", "letter"], "word": "z"}, ]})
class TrTests(unittest.TestCase): def setUp(self): self.maxDiff = 20000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("abolitionism") # Note: some tests use last char self.ctx.start_section("English") def runtr(self, item, sense=None, pos_datas=[], lang=None, langcode=None, translations_from_template=[], is_reconstruction=False): """Simple test runner. Returns data.""" data = {} parse_translation_item_text(self.ctx, self.ctx.title, data, item, sense, pos_datas, lang, langcode, translations_from_template, is_reconstruction) return data def test_trdesc1(self): tr = {} # Note: this test uses last char of title parse_translation_desc(self.ctx, "French", "abolitionnisme m", tr) self.assertEqual(self.ctx.errors, []) self.assertEqual(self.ctx.warnings, []) self.assertEqual(self.ctx.debugs, []) self.assertEqual(tr, {"word": "abolitionnisme", "tags": ["masculine"]}) def test_trdesc2(self): tr = {} parse_translation_desc(self.ctx, "French", "abolitionnisme f", tr) self.assertEqual(self.ctx.errors, []) self.assertEqual(self.ctx.warnings, []) self.assertEqual(self.ctx.debugs, []) self.assertEqual(tr, {"word": "abolitionnisme", "tags": ["feminine"]}) def test_trdesc3(self): tr = {} # m is in page title, should not interpret as tag self.ctx.start_page("m m m") parse_translation_desc(self.ctx, "French", "m m m", tr) self.assertEqual(self.ctx.errors, []) self.assertEqual(self.ctx.warnings, []) self.assertEqual(self.ctx.debugs, []) self.assertEqual(tr, {"word": "m m m"}) def test_trdesc4(self): tr = {} self.ctx.start_page("assessment") parse_translation_desc(self.ctx, "German", "Schätzung f", tr) self.assertEqual(self.ctx.errors, []) self.assertEqual(self.ctx.warnings, []) self.assertEqual(self.ctx.debugs, []) self.assertEqual(tr, {"word": "Schätzung", "tags": ["feminine"]}) def test_tr1(self): data = self.runtr("Finnish: foo") self.assertEqual(data, { "translations": [ { "word": "foo", "lang": "Finnish", "code": "fi" }, ] }) def test_tr2(self): data = self.runtr("Swedish: foo f") self.assertEqual( data, { "translations": [ { "word": "foo", "lang": "Swedish", "code": "sv", "tags": ["feminine"] }, ] }) def test_tr3(self): data = self.runtr("Swedish: foo f or m") self.assertEqual( data, { "translations": [ { "word": "foo", "lang": "Swedish", "code": "sv", "tags": ["feminine", "masculine"] }, ] }) def test_tr4(self): data = self.runtr("Swedish: foo ?") self.assertEqual(data, { "translations": [ { "word": "foo", "lang": "Swedish", "code": "sv" }, ] }) def test_tr5(self): data = self.runtr("Swedish: foo f, bar m") self.assertEqual( data, { "translations": [ { "word": "foo", "lang": "Swedish", "code": "sv", "tags": ["feminine"] }, { "word": "bar", "lang": "Swedish", "code": "sv", "tags": ["masculine"] }, ] }) def test_tr6(self): data = self.runtr("Swedish: foo f sg or f pl") self.assertEqual( data, { "translations": [ { "word": "foo", "lang": "Swedish", "code": "sv", "tags": ["feminine", "plural", "singular"] }, ] }) def test_tr7(self): # Dual should not be processed for Swedish data = self.runtr("Swedish: foo du") self.assertNotEqual(self.ctx.debugs, []) # Should be suspicious tr self.assertEqual( data, { "translations": [ { "word": "foo du", "lang": "Swedish", "code": "sv" }, ] }) def test_tr8(self): data = self.runtr("Mandarin: 是 (rrr)", lang="Chinese") self.assertEqual( data, { "translations": [ { "word": "是", "roman": "rrr", "lang": "Chinese", "code": "zh", "tags": ["Mandarin"] }, ] }) def test_tr9(self): data = self.runtr("Mandarin: 寺 (zh) (sì) (Buddhist)", langcode="zh") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "寺", "roman": "sì", "lang": "Mandarin", "code": "zh", "topics": ["Buddhist", "Buddhism", "religion", "lifestyle"] }, ] }) def test_tr10(self): data = self.runtr("Arabic: مَعْبَد m (maʿbad), هَيْكَل m (haykal)", langcode="ar") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "مَعْبَد", "roman": "maʿbad", "lang": "Arabic", "code": "ar", "tags": ["masculine"] }, { "word": "هَيْكَل", "roman": "haykal", "lang": "Arabic", "code": "ar", "tags": ["masculine"] }, ] }) def test_tr11(self): data = self.runtr("Oriya: please add this translation if you can") self.assertEqual(self.ctx.debugs, []) self.assertEqual(data, {}) def test_tr12(self): data = self.runtr( "Burmese: လျှောက် (my) (hlyauk), လမ်းလျှောက် (my) (lam:hlyauk)") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "လျှောက်", "roman": "hlyauk", "lang": "Burmese", "code": "my" }, { "word": "လမ်းလျှောက်", "roman": "lam:hlyauk", "lang": "Burmese", "code": "my" }, ] }) def test_tr13(self): data = self.runtr("Finnish: tämä, testi", translations_from_template=["tämä, testi"]) self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "tämä, testi", "lang": "Finnish", "code": "fi" }, ] }) def test_tr14(self): data = self.runtr("Finnish: kävellä (fi), käydä (fi) " "(poetic or archaic)") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "kävellä", "lang": "Finnish", "code": "fi" }, { "word": "käydä", "lang": "Finnish", "code": "fi", "tags": ["archaic", "poetic"] }, ] }) def test_tr15(self): data = self.runtr("Macedonian: шета (šeta) (to go for a walk), " "иде (ide)") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "шета", "roman": "šeta", "lang": "Macedonian", "english": "to go for a walk", "code": "mk" }, { "word": "иде", "roman": "ide", "lang": "Macedonian", "code": "mk" }, ] }) def test_tr16(self): data = self.runtr("Russian: испари́ться (ru) (isparítʹsja) " "(colloquial), бы́ли вы́несенны pl or pf " "(býli výnesenny) (past tense)") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "испари́ться", "roman": "isparítʹsja", "lang": "Russian", "code": "ru", "tags": ["colloquial"] }, { "word": "бы́ли вы́несенны", "roman": "býli výnesenny", "lang": "Russian", "code": "ru", "tags": ["past"] }, ] }) def test_tr16(self): # Test second-level "language" being script name data = self.runtr("Burmese: ပဏ္ဏ n (paṇṇa)", lang="Pali") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "ပဏ္ဏ", "roman": "paṇṇa", "lang": "Pali", "code": "pi", "tags": ["Burmese", "neuter"] }, ] }) def test_tr17(self): data = self.runtr("Finnish: foo 11") self.assertNotEqual(self.ctx.debugs, []) # should get warning self.assertEqual( data, { "translations": [ { "word": "foo 11", "lang": "Finnish", "code": "fi" }, ] }) def test_tr18(self): data = self.runtr("Maore Comorian: wani 11 or 6") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "wani", "lang": "Maore Comorian", "code": "swb", "tags": ["class-11", "class-6"] }, ] }) def test_tr19(self): data = self.runtr("Lingala: nkásá 9 or 10, lokásá 11 or 10") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "nkásá", "lang": "Lingala", "code": "ln", "tags": ["class-10", "class-9"] }, { "word": "lokásá", "lang": "Lingala", "code": "ln", "tags": ["class-10", "class-11"] }, ] }) def test_tr20(self): data = self.runtr("Swahili: jani (sw) 5 or 6, msahafu (sw) 3 or 4") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "jani", "lang": "Swahili", "code": "sw", "tags": ["class-5", "class-6"] }, { "word": "msahafu", "lang": "Swahili", "code": "sw", "tags": ["class-3", "class-4"] }, ] }) def test_tr21(self): data = self.runtr("Xhosa: igqabi 5 or 6") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "igqabi", "lang": "Xhosa", "code": "xh", "tags": ["class-5", "class-6"] }, ] }) def test_tr22(self): data = self.runtr("Zulu: ikhasi (zu) 5 or 6, iqabi (zu) 5 or 6") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "ikhasi", "lang": "Zulu", "code": "zu", "tags": ["class-5", "class-6"] }, { "word": "iqabi", "lang": "Zulu", "code": "zu", "tags": ["class-5", "class-6"] }, ] }) def test_tr23(self): data = self.runtr("Belarusian: ліст m (list)") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [ { "word": "ліст", "lang": "Belarusian", "code": "be", "roman": "list", "tags": ["masculine"] }, ] }) def test_tr24(self): data = self.runtr("Puxian Min: foo", lang="Chinese") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [{ "word": "foo", "lang": "Chinese", "code": "zh", "tags": ["Puxian-Min"] }] }) def test_tr25(self): data = self.runtr("Hallig and Mooring: foo", lang="Danish") self.assertEqual(self.ctx.debugs, []) # Special cases with Frisian, so test tr_second_tagmap handling # with bogus Danish instead... self.assertEqual( data, { "translations": [{ "word": "foo", "lang": "Danish", "code": "da", "tags": ["Hallig", "Mooring"] }] }) def test_tr26(self): data = self.runtr(" Ancient: foo", lang="Greek") self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [{ "word": "foo", "lang": "Greek", "code": "el", "tags": ["Ancient"] }] }) def test_tr27(self): data = self.runtr(" Proto-Germanic: *foo", lang="Proto-Germanic", is_reconstruction=True) self.assertEqual(self.ctx.debugs, []) self.assertEqual( data, { "translations": [{ "word": "foo", "lang": "Proto-Germanic", "code": "gem-pro" }] })
truncate_title = False if lst[-1] in ("A", "B", "C", "D", "E", "F", "I", "II", "III", "IV", "V"): truncate_title = False if not (len(lst) > 1 and any(x[0].isupper() for x in lst[1:]) and (len(lst[-1]) != 1 or lst[-1] not in ("virus",))): truncate_title = False if truncate_title: for i in range(1, len(lst)): if lst[i][0].isupper(): title = " ".join(lst[:i]) break return title ctx = Wtp(cache_file="species-cache") # Disable this for later runs to avoid recreating the cache. Makes developing # the code MUCH faster. Remove the cache file before reading the dump. # Read pages from the dump file into the cache file (Phase 1) #list(ctx.process(dumpfile, page_handler, phase1_only=True)) # Process the pages in the dump file. ret = list(ctx.reprocess(page_handler)) print("Count distinct titles:", len(set(ret))) firsts = set(x.split()[0] for x in ret if x.find("virus") < 0 and x.find("satellite") < 0 and x.find("viroid") < 0) print("Count distinct first words:", len(firsts)) words = set(x for title in ret for x in title.lower().split()) print("Count distinct latter:", len(words))
class InflTests(unittest.TestCase): def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def xinfl(self, word, lang, pos, section, text): """Runs a single inflection table parsing test, and returns ``data``.""" self.ctx.start_page(word) self.ctx.start_section(lang) self.ctx.start_subsection(pos) tree = self.ctx.parse(text) data = {} parse_inflection_section(self.config, self.ctx, data, word, lang, pos, section, tree) return data def test_Azerbaijani_noun1(self): ret = self.xinfl( "yardım", "Azerbaijani", "verb", "Declension", """ <div class="NavFrame" style> <div class="NavHead" style>Declension of ''yardım''</div> <div class="NavContent"> {| style="background%3A%23F9F9F9%3Bwidth%3A100%25%3Btext-align%3Acenter" class="inflection-table" |- ! colspan="1" rowspan="1" style | ! colspan="1" rowspan="1" style="background%3A%23DEDEDE" |singular | colspan="1" style="background%3A%23DEDEDE" |'''plural''' |- ! style="background%3A%23EFEFEF" | nominative | yardım |[[yardımlar]] |- ! style="background%3A%23EFEFEF" | definite accusative |[[yardımı]] |[[yardımları]] |- ! style="background%3A%23EFEFEF" | dative |[[yardıma]] |[[yardımlara]] |- ! style="background%3A%23EFEFEF" | locative |[[yardımda]] |[[yardımlarda]] |- ! style="background%3A%23EFEFEF" | ablative |[[yardımdan]] |[[yardımlardan]] |- ! style="background%3A%23EFEFEF" | definite genitive |[[yardımın]] |[[yardımların]] |} </div></div> <div class="NavFrame" style> <div class="NavHead" style>Possessive forms of ''yardım''</div> <div class="NavContent"> {| style="background%3A%23F9F9F9%3Bwidth%3A100%25%3Btext-align%3Acenter" class="inflection-table" |- ! colspan="1" style | ! colspan="2" style="background%3A%23DEDEDE" |nominative |- ! colspan="1" rowspan="1" style | ! colspan="1" rowspan="1" style="background%3A%23DEDEDE" |singular | colspan="1" style="background%3A%23DEDEDE" |'''plural''' |- ! style="background%3A%23EFEFEF" | [[mənim]] (“my”) |[[yardımım]] |[[yardımlarım]] |- ! style="background%3A%23EFEFEF" | [[sənin]] (“your”) |[[yardımın]] |[[yardımların]] |- ! style="background%3A%23EFEFEF" | [[onun]] (“his/her/its”) |[[yardımı]] |[[yardımları]] |- ! style="background%3A%23EFEFEF" | [[bizim]] (“our”) |[[yardımımız]] |[[yardımlarımız]] |- ! style="background%3A%23EFEFEF" | [[sizin]] (“your”) |[[yardımınız]] |[[yardımlarınız]] |- ! style="background%3A%23EFEFEF" | [[onların]] (“their”) |[[yardımı]] ''or'' [[yardımları]] |[[yardımları]] |- ! colspan="1" style | ! colspan="2" style="background%3A%23DEDEDE" |accusative |- ! colspan="1" rowspan="1" style | ! colspan="1" rowspan="1" style="background%3A%23DEDEDE" |singular | colspan="1" style="background%3A%23DEDEDE" |'''plural''' |- ! style="background%3A%23EFEFEF" | [[mənim]] (“my”) |[[yardımımı]] |[[yardımlarımı]] |- ! style="background%3A%23EFEFEF" | [[sənin]] (“your”) |[[yardımını]] |[[yardımlarını]] |- ! style="background%3A%23EFEFEF" | [[onun]] (“his/her/its”) |[[yardımını]] |[[yardımlarını]] |- ! style="background%3A%23EFEFEF" | [[bizim]] (“our”) |[[yardımımızı]] |[[yardımlarımızı]] |- ! style="background%3A%23EFEFEF" | [[sizin]] (“your”) |[[yardımınızı]] |[[yardımlarınızı]] |- ! style="background%3A%23EFEFEF" | [[onların]] (“their”) |[[yardımını]] ''or'' [[yardımlarını]] |[[yardımlarını]] |- ! colspan="1" style | ! colspan="2" style="background%3A%23DEDEDE" |dative |- ! colspan="1" rowspan="1" style | ! colspan="1" rowspan="1" style="background%3A%23DEDEDE" |singular | colspan="1" style="background%3A%23DEDEDE" |'''plural''' |- ! style="background%3A%23EFEFEF" | [[mənim]] (“my”) |[[yardımıma]] |[[yardımlarıma]] |- ! style="background%3A%23EFEFEF" | [[sənin]] (“your”) |[[yardımına]] |[[yardımlarına]] |- ! style="background%3A%23EFEFEF" | [[onun]] (“his/her/its”) |[[yardımına]] |[[yardımlarına]] |- ! style="background%3A%23EFEFEF" | [[bizim]] (“our”) |[[yardımımıza]] |[[yardımlarımıza]] |- ! style="background%3A%23EFEFEF" | [[sizin]] (“your”) |[[yardımınıza]] |[[yardımlarınıza]] |- ! style="background%3A%23EFEFEF" | [[onların]] (“their”) |[[yardımına]] ''or'' [[yardımlarına]] |[[yardımlarına]] |- ! colspan="1" style | ! colspan="2" style="background%3A%23DEDEDE" |locative |- ! colspan="1" rowspan="1" style | ! colspan="1" rowspan="1" style="background%3A%23DEDEDE" |singular | colspan="1" style="background%3A%23DEDEDE" |'''plural''' |- ! style="background%3A%23EFEFEF" | [[mənim]] (“my”) |[[yardımımda]] |[[yardımlarımda]] |- ! style="background%3A%23EFEFEF" | [[sənin]] (“your”) |[[yardımında]] |[[yardımlarında]] |- ! style="background%3A%23EFEFEF" | [[onun]] (“his/her/its”) |[[yardımında]] |[[yardımlarında]] |- ! style="background%3A%23EFEFEF" | [[bizim]] (“our”) |[[yardımımızda]] |[[yardımlarımızda]] |- ! style="background%3A%23EFEFEF" | [[sizin]] (“your”) |[[yardımınızda]] |[[yardımlarınızda]] |- ! style="background%3A%23EFEFEF" | [[onların]] (“their”) |[[yardımında]] ''or'' [[yardımlarında]] |[[yardımlarında]] |- ! colspan="1" style | ! colspan="2" style="background%3A%23DEDEDE" |ablative |- ! colspan="1" rowspan="1" style | ! colspan="1" rowspan="1" style="background%3A%23DEDEDE" |singular | colspan="1" style="background%3A%23DEDEDE" |'''plural''' |- ! style="background%3A%23EFEFEF" | [[mənim]] (“my”) |[[yardımımdan]] |[[yardımlarımdan]] |- ! style="background%3A%23EFEFEF" | [[sənin]] (“your”) |[[yardımından]] |[[yardımlarından]] |- ! style="background%3A%23EFEFEF" | [[onun]] (“his/her/its”) |[[yardımından]] |[[yardımlarından]] |- ! style="background%3A%23EFEFEF" | [[bizim]] (“our”) |[[yardımımızdan]] |[[yardımlarımızdan]] |- ! style="background%3A%23EFEFEF" | [[sizin]] (“your”) |[[yardımınızdan]] |[[yardımlarınızdan]] |- ! style="background%3A%23EFEFEF" | [[onların]] (“their”) |[[yardımından]] ''or'' [[yardımlarından]] |[[yardımlarından]] |- ! colspan="1" style | ! colspan="2" style="background%3A%23DEDEDE" |genitive |- ! colspan="1" rowspan="1" style | ! colspan="1" rowspan="1" style="background%3A%23DEDEDE" |singular | colspan="1" style="background%3A%23DEDEDE" |'''plural''' |- ! style="background%3A%23EFEFEF" | [[mənim]] (“my”) |[[yardımımın]] |[[yardımlarımın]] |- ! style="background%3A%23EFEFEF" | [[sənin]] (“your”) |[[yardımının]] |[[yardımlarının]] |- ! style="background%3A%23EFEFEF" | [[onun]] (“his/her/its”) |[[yardımının]] |[[yardımlarının]] |- ! style="background%3A%23EFEFEF" | [[bizim]] (“our”) |[[yardımımızın]] |[[yardımlarımızın]] |- ! style="background%3A%23EFEFEF" | [[sizin]] (“your”) |[[yardımınızın]] |[[yardımlarınızın]] |- ! style="background%3A%23EFEFEF" | [[onların]] (“their”) |[[yardımının]] ''or'' [[yardımlarının]] |[[yardımlarının]] |} </div></div> """) expected = { "forms": [{ "form": "", "source": "Declension", "tags": ["table-tags"] }, { "form": "yardım", "source": "Declension", "tags": ["nominative", "singular"] }, { "form": "yardımlar", "source": "Declension", "tags": ["nominative", "plural"] }, { "form": "yardımı", "source": "Declension", "tags": ["accusative", "definite", "singular"] }, { "form": "yardımları", "source": "Declension", "tags": ["accusative", "definite", "plural"] }, { "form": "yardıma", "source": "Declension", "tags": ["dative", "singular"] }, { "form": "yardımlara", "source": "Declension", "tags": ["dative", "plural"] }, { "form": "yardımda", "source": "Declension", "tags": ["locative", "singular"] }, { "form": "yardımlarda", "source": "Declension", "tags": ["locative", "plural"] }, { "form": "yardımdan", "source": "Declension", "tags": ["ablative", "singular"] }, { "form": "yardımlardan", "source": "Declension", "tags": ["ablative", "plural"] }, { "form": "yardımın", "source": "Declension", "tags": ["definite", "genitive", "singular"] }, { "form": "yardımların", "source": "Declension", "tags": ["definite", "genitive", "plural"] }, { "form": "", "source": "Declension", "tags": ["table-tags"] }, { "form": "yardımım", "source": "Declension", "tags": [ "first-person", "nominative", "possessive", "possessive-single", "singular" ] }, { "form": "yardımlarım", "source": "Declension", "tags": [ "first-person", "nominative", "possessive", "possessive-many", "singular" ] }, { "form": "yardımın", "source": "Declension", "tags": [ "nominative", "possessive", "possessive-single", "second-person", "singular" ] }, { "form": "yardımların", "source": "Declension", "tags": [ "nominative", "possessive", "possessive-many", "second-person", "singular" ] }, { "form": "yardımı", "source": "Declension", "tags": [ "nominative", "possessive", "possessive-single", "singular", "third-person" ] }, { "form": "yardımları", "source": "Declension", "tags": [ "nominative", "possessive", "possessive-many", "singular", "third-person" ] }, { "form": "yardımımız", "source": "Declension", "tags": [ "first-person", "nominative", "plural", "possessive", "possessive-single" ] }, { "form": "yardımlarımız", "source": "Declension", "tags": [ "first-person", "nominative", "plural", "possessive", "possessive-many" ] }, { "form": "yardımınız", "source": "Declension", "tags": [ "nominative", "plural", "possessive", "possessive-single", "second-person" ] }, { "form": "yardımlarınız", "source": "Declension", "tags": [ "nominative", "plural", "possessive", "possessive-many", "second-person" ] }, { "form": "yardımı", "source": "Declension", "tags": [ "nominative", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımları", "source": "Declension", "tags": [ "nominative", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımları", "source": "Declension", "tags": [ "nominative", "plural", "possessive", "possessive-many", "third-person" ] }, { "form": "yardımımı", "source": "Declension", "tags": [ "accusative", "first-person", "possessive", "possessive-single", "singular" ] }, { "form": "yardımlarımı", "source": "Declension", "tags": [ "accusative", "first-person", "possessive", "possessive-many", "singular" ] }, { "form": "yardımını", "source": "Declension", "tags": [ "accusative", "possessive", "possessive-single", "second-person", "singular" ] }, { "form": "yardımlarını", "source": "Declension", "tags": [ "accusative", "possessive", "possessive-many", "second-person", "singular" ] }, { "form": "yardımını", "source": "Declension", "tags": [ "accusative", "possessive", "possessive-single", "singular", "third-person" ] }, { "form": "yardımlarını", "source": "Declension", "tags": [ "accusative", "possessive", "possessive-many", "singular", "third-person" ] }, { "form": "yardımımızı", "source": "Declension", "tags": [ "accusative", "first-person", "plural", "possessive", "possessive-single" ] }, { "form": "yardımlarımızı", "source": "Declension", "tags": [ "accusative", "first-person", "plural", "possessive", "possessive-many" ] }, { "form": "yardımınızı", "source": "Declension", "tags": [ "accusative", "plural", "possessive", "possessive-single", "second-person" ] }, { "form": "yardımlarınızı", "source": "Declension", "tags": [ "accusative", "plural", "possessive", "possessive-many", "second-person" ] }, { "form": "yardımını", "source": "Declension", "tags": [ "accusative", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımlarını", "source": "Declension", "tags": [ "accusative", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımlarını", "source": "Declension", "tags": [ "accusative", "plural", "possessive", "possessive-many", "third-person" ] }, { "form": "yardımıma", "source": "Declension", "tags": [ "dative", "first-person", "possessive", "possessive-single", "singular" ] }, { "form": "yardımlarıma", "source": "Declension", "tags": [ "dative", "first-person", "possessive", "possessive-many", "singular" ] }, { "form": "yardımına", "source": "Declension", "tags": [ "dative", "possessive", "possessive-single", "second-person", "singular" ] }, { "form": "yardımlarına", "source": "Declension", "tags": [ "dative", "possessive", "possessive-many", "second-person", "singular" ] }, { "form": "yardımına", "source": "Declension", "tags": [ "dative", "possessive", "possessive-single", "singular", "third-person" ] }, { "form": "yardımlarına", "source": "Declension", "tags": [ "dative", "possessive", "possessive-many", "singular", "third-person" ] }, { "form": "yardımımıza", "source": "Declension", "tags": [ "dative", "first-person", "plural", "possessive", "possessive-single" ] }, { "form": "yardımlarımıza", "source": "Declension", "tags": [ "dative", "first-person", "plural", "possessive", "possessive-many" ] }, { "form": "yardımınıza", "source": "Declension", "tags": [ "dative", "plural", "possessive", "possessive-single", "second-person" ] }, { "form": "yardımlarınıza", "source": "Declension", "tags": [ "dative", "plural", "possessive", "possessive-many", "second-person" ] }, { "form": "yardımına", "source": "Declension", "tags": [ "dative", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımlarına", "source": "Declension", "tags": [ "dative", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımlarına", "source": "Declension", "tags": [ "dative", "plural", "possessive", "possessive-many", "third-person" ] }, { "form": "yardımımda", "source": "Declension", "tags": [ "first-person", "locative", "possessive", "possessive-single", "singular" ] }, { "form": "yardımlarımda", "source": "Declension", "tags": [ "first-person", "locative", "possessive", "possessive-many", "singular" ] }, { "form": "yardımında", "source": "Declension", "tags": [ "locative", "possessive", "possessive-single", "second-person", "singular" ] }, { "form": "yardımlarında", "source": "Declension", "tags": [ "locative", "possessive", "possessive-many", "second-person", "singular" ] }, { "form": "yardımında", "source": "Declension", "tags": [ "locative", "possessive", "possessive-single", "singular", "third-person" ] }, { "form": "yardımlarında", "source": "Declension", "tags": [ "locative", "possessive", "possessive-many", "singular", "third-person" ] }, { "form": "yardımımızda", "source": "Declension", "tags": [ "first-person", "locative", "plural", "possessive", "possessive-single" ] }, { "form": "yardımlarımızda", "source": "Declension", "tags": [ "first-person", "locative", "plural", "possessive", "possessive-many" ] }, { "form": "yardımınızda", "source": "Declension", "tags": [ "locative", "plural", "possessive", "possessive-single", "second-person" ] }, { "form": "yardımlarınızda", "source": "Declension", "tags": [ "locative", "plural", "possessive", "possessive-many", "second-person" ] }, { "form": "yardımında", "source": "Declension", "tags": [ "locative", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımlarında", "source": "Declension", "tags": [ "locative", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımlarında", "source": "Declension", "tags": [ "locative", "plural", "possessive", "possessive-many", "third-person" ] }, { "form": "yardımımdan", "source": "Declension", "tags": [ "ablative", "first-person", "possessive", "possessive-single", "singular" ] }, { "form": "yardımlarımdan", "source": "Declension", "tags": [ "ablative", "first-person", "possessive", "possessive-many", "singular" ] }, { "form": "yardımından", "source": "Declension", "tags": [ "ablative", "possessive", "possessive-single", "second-person", "singular" ] }, { "form": "yardımlarından", "source": "Declension", "tags": [ "ablative", "possessive", "possessive-many", "second-person", "singular" ] }, { "form": "yardımından", "source": "Declension", "tags": [ "ablative", "possessive", "possessive-single", "singular", "third-person" ] }, { "form": "yardımlarından", "source": "Declension", "tags": [ "ablative", "possessive", "possessive-many", "singular", "third-person" ] }, { "form": "yardımımızdan", "source": "Declension", "tags": [ "ablative", "first-person", "plural", "possessive", "possessive-single" ] }, { "form": "yardımlarımızdan", "source": "Declension", "tags": [ "ablative", "first-person", "plural", "possessive", "possessive-many" ] }, { "form": "yardımınızdan", "source": "Declension", "tags": [ "ablative", "plural", "possessive", "possessive-single", "second-person" ] }, { "form": "yardımlarınızdan", "source": "Declension", "tags": [ "ablative", "plural", "possessive", "possessive-many", "second-person" ] }, { "form": "yardımından", "source": "Declension", "tags": [ "ablative", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımlarından", "source": "Declension", "tags": [ "ablative", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımlarından", "source": "Declension", "tags": [ "ablative", "plural", "possessive", "possessive-many", "third-person" ] }, { "form": "yardımımın", "source": "Declension", "tags": [ "first-person", "genitive", "possessive", "possessive-single", "singular" ] }, { "form": "yardımlarımın", "source": "Declension", "tags": [ "first-person", "genitive", "possessive", "possessive-many", "singular" ] }, { "form": "yardımının", "source": "Declension", "tags": [ "genitive", "possessive", "possessive-single", "second-person", "singular" ] }, { "form": "yardımlarının", "source": "Declension", "tags": [ "genitive", "possessive", "possessive-many", "second-person", "singular" ] }, { "form": "yardımının", "source": "Declension", "tags": [ "genitive", "possessive", "possessive-single", "singular", "third-person" ] }, { "form": "yardımlarının", "source": "Declension", "tags": [ "genitive", "possessive", "possessive-many", "singular", "third-person" ] }, { "form": "yardımımızın", "source": "Declension", "tags": [ "first-person", "genitive", "plural", "possessive", "possessive-single" ] }, { "form": "yardımlarımızın", "source": "Declension", "tags": [ "first-person", "genitive", "plural", "possessive", "possessive-many" ] }, { "form": "yardımınızın", "source": "Declension", "tags": [ "genitive", "plural", "possessive", "possessive-single", "second-person" ] }, { "form": "yardımlarınızın", "source": "Declension", "tags": [ "genitive", "plural", "possessive", "possessive-many", "second-person" ] }, { "form": "yardımının", "source": "Declension", "tags": [ "genitive", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımlarının", "source": "Declension", "tags": [ "genitive", "plural", "possessive", "possessive-single", "third-person" ] }, { "form": "yardımlarının", "source": "Declension", "tags": [ "genitive", "plural", "possessive", "possessive-many", "third-person" ] }], } self.assertEqual(expected, ret)
class InflTests(unittest.TestCase): def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def xinfl(self, word, lang, pos, section, text): """Runs a single inflection table parsing test, and returns ``data``.""" self.ctx.start_page(word) self.ctx.start_section(lang) self.ctx.start_subsection(pos) tree = self.ctx.parse(text) data = {} parse_inflection_section(self.config, self.ctx, data, word, lang, pos, section, tree) return data def test_Latvian_verb1(self): ret = self.xinfl( "saprast", "Latvian", "verb", "Conjugation", """ <div class="NavFrame" style="width%3A470px"> <div class="NavHead" style>conjugation of ''saprast''</div> <div class="NavContent"> {| border="1px+solid+%23000000" style="border-collapse%3Acollapse%3B+background%3A%23F9F9F9%3B+text-align%3Acenter%3B+width%3A100%25" class="inflection-table" |- ! style="background%3A%23BCB2B0" | ! colspan="4" style="background%3A%23BCB2B0" | INDICATIVE <small>([[īstenības]] [[izteiksme]])</small> ! rowspan="2" style="background%3A%23BCB2B0" | IMPERATIVE<br><small>([[pavēles]] [[izteiksme]])</small> |- ! style="background%3A%23BCB2B0" | ! style="background%3A%23BCB2B0" | ! style="background%3A%23BCB2B0" | Present<br><small>([[tagadne]])</small> ! style="background%3A%23BCB2B0" | Past<br><small>([[pagātne]])</small> ! style="background%3A%23BCB2B0" | Future<br><small>([[nākotne]])</small> |- ! style="background%3A%23DEDEDE%3B+width%3A60px" | [[first person|1st pers.]] [[singular|sg.]] ! style="background%3A%23DEDEDE%3B+width%3A70px" | <span class="Latn" lang="lv">[[es#Latvian|es]]</span> | <span class="Latn" lang="lv">[[saprotu#Latvian|saprotu]]</span> | <span class="Latn" lang="lv">[[sapratu#Latvian|sapratu]]</span> | <span class="Latn" lang="lv">[[sapratīšu#Latvian|sapratīšu]]</span> | — |- ! style="background%3A%23DEDEDE" | [[second person|2nd pers.]] [[singular|sg.]] ! style="background%3A%23DEDEDE" | <span class="Latn" lang="lv">[[tu#Latvian|tu]]</span> | <span class="Latn" lang="lv">[[saproti#Latvian|saproti]]</span> | <span class="Latn" lang="lv">[[saprati#Latvian|saprati]]</span> | <span class="Latn" lang="lv">[[sapratīsi#Latvian|sapratīsi]]</span> | <span class="Latn" lang="lv">[[saproti#Latvian|saproti]]</span> |- ! style="background%3A%23DEDEDE" | [[third person|3rd pers.]] [[singular|sg.]] ! style="background%3A%23DEDEDE" | <span class="Latn" lang="lv">[[viņš#Latvian|viņš]]</span>, <span class="Latn" lang="lv">[[viņa#Latvian|viņa]]</span> | <span class="Latn" lang="lv">[[saprot#Latvian|saprot]]</span> | <span class="Latn" lang="lv">[[saprata#Latvian|saprata]]</span> | <span class="Latn" lang="lv">[[sapratīs#Latvian|sapratīs]]</span> | <span class="Latn" lang="lv">[[lai#Latvian|lai]]</span> <span class="Latn" lang="lv">[[saprot#Latvian|saprot]]</span> |- ! style="background%3A%23DEDEDE" | [[first person|1st pers.]] [[plural|pl.]] ! style="background%3A%23DEDEDE" | <span class="Latn" lang="lv">[[mēs#Latvian|mēs]]</span> | <span class="Latn" lang="lv">[[saprotam#Latvian|saprotam]]</span> | <span class="Latn" lang="lv">[[sapratām#Latvian|sapratām]]</span> | <span class="Latn" lang="lv">[[sapratīsim#Latvian|sapratīsim]]</span> | <span class="Latn" lang="lv">[[sapratīsim#Latvian|sapratīsim]]</span> |- ! style="background%3A%23DEDEDE" | [[second person|2nd pers.]] [[plural|pl.]] ! style="background%3A%23DEDEDE" | <span class="Latn" lang="lv">[[jūs#Latvian|jūs]]</span> | <span class="Latn" lang="lv">[[saprotat#Latvian|saprotat]]</span> | <span class="Latn" lang="lv">[[sapratāt#Latvian|sapratāt]]</span> | <span class="Latn" lang="lv">[[sapratīsiet#Latvian|sapratīsiet]]</span>,<br><span class="Latn" lang="lv">[[sapratīsit#Latvian|sapratīsit]]</span> | <span class="Latn" lang="lv">[[saprotiet#Latvian|saprotiet]]</span> |- ! style="background%3A%23DEDEDE" | [[third person|3rd pers.]] [[plural|pl.]] ! style="background%3A%23DEDEDE" | <span class="Latn" lang="lv">[[viņi#Latvian|viņi]]</span>, <span class="Latn" lang="lv">[[viņas#Latvian|viņas]]</span> | <span class="Latn" lang="lv">[[saprot#Latvian|saprot]]</span> | <span class="Latn" lang="lv">[[saprata#Latvian|saprata]]</span> | <span class="Latn" lang="lv">[[sapratīs#Latvian|sapratīs]]</span> | <span class="Latn" lang="lv">[[lai#Latvian|lai]]</span> <span class="Latn" lang="lv">[[saprot#Latvian|saprot]]</span> |- ! colspan="6" style="background%3A%23CDCDCD%3Bheight%3A.75em" | |- ! colspan="3" style="background%3A%23DEDEDE" | RENARRATIVE <small>([[atstāstījuma]] [[izteiksme]])</small> ! colspan="3" style="background%3A%23DEDEDE" | PARTICIPLES <small>([[divdabji]])</small> |- ! style="background%3A%23DEDEDE" | Present | colspan="2" | <span class="Latn" lang="lv">[[saprotot#Latvian|saprotot]]</span> ! colspan="2" style="background%3A%23DEDEDE" | Present Active 1 <small>(Adj.)</small> | <span class="Latn" lang="lv">[[saprotošs#Latvian|saprotošs]]</span> |- ! style="background%3A%23DEDEDE" | Past | colspan="2" | <span class="Latn" lang="lv">[[esot#Latvian|esot]]</span> <span class="Latn" lang="lv">[[sapratis#Latvian|sapratis]]</span> ! colspan="2" style="background%3A%23DEDEDE" | Present Active 2 <small>(Adv.)</small> | <span class="Latn" lang="lv">[[saprazdams#Latvian|saprazdams]]</span> |- ! style="background%3A%23DEDEDE" | Future | colspan="2" | <span class="Latn" lang="lv">[[sapratīšot#Latvian|sapratīšot]]</span> ! colspan="2" style="background%3A%23DEDEDE" | Present Active 3 <small>(Adv.)</small> | <span class="Latn" lang="lv">[[saprotot#Latvian|saprotot]]</span> |- ! style="background%3A%23DEDEDE" | Imperative | colspan="2" | <span class="Latn" lang="lv">[[lai#Latvian|lai]]</span> <span class="Latn" lang="lv">[[saprotot#Latvian|saprotot]]</span> ! colspan="2" style="background%3A%23DEDEDE" | Present Active 4 <small>(Obj.)</small> | <span class="Latn" lang="lv">[[saprotam#Latvian|saprotam]]</span> |- ! colspan="3" style="background%3A%23DEDEDE" | CONDITIONAL <small>([[vēlējuma]] [[izteiksme]])</small> ! colspan="2" style="background%3A%23DEDEDE" | Past Active | <span class="Latn" lang="lv">[[sapratis#Latvian|sapratis]]</span> |- ! style="background%3A%23DEDEDE" | Present | colspan="2" | <span class="Latn" lang="lv">[[saprastu#Latvian|saprastu]]</span> ! colspan="2" style="background%3A%23DEDEDE" | Present Passive | <span class="Latn" lang="lv">[[saprotams#Latvian|saprotams]]</span> |- ! style="background%3A%23DEDEDE" | Past | colspan="2" | <span class="Latn" lang="lv">[[būtu#Latvian|būtu]]</span> <span class="Latn" lang="lv">[[sapratis#Latvian|sapratis]]</span> ! colspan="2" style="background%3A%23DEDEDE" | Past Passive | <span class="Latn" lang="lv">[[saprasts#Latvian|saprasts]]</span> |- ! colspan="3" style="background%3A%23DEDEDE" | DEBITIVE <small>([[vajadzības]] [[izteiksme]])</small> ! colspan="3" style="background%3A%23DEDEDE" | NOMINAL FORMS |- ! style="background%3A%23DEDEDE" | Indicative | colspan="2" | (<span class="Latn" lang="lv">[[būt#Latvian|būt]]</span>) <span class="Latn" lang="lv">[[jāsaprot#Latvian|jāsaprot]]</span> ! colspan="2" style="background%3A%23DEDEDE" | Infinitive <small>(nenoteiksme)</small> | <span class="Latn" lang="lv">[[saprast#Latvian|saprast]]</span> |- ! style="background%3A%23DEDEDE" | Conjunctive 1 | colspan="2" | <span class="Latn" lang="lv">[[esot#Latvian|esot]]</span> <span class="Latn" lang="lv">[[jāsaprot#Latvian|jāsaprot]]</span> ! colspan="2" style="background%3A%23DEDEDE" | Negative Infinitive | <span class="Latn" lang="lv">[[nesaprast#Latvian|nesaprast]]</span> |- ! style="background%3A%23DEDEDE" | Conjunctive 2 | colspan="2" | <span class="Latn" lang="lv">[[jāsaprotot#Latvian|jāsaprotot]]</span> ! colspan="2" style="background%3A%23DEDEDE" | Verbal noun | <span class="Latn" lang="lv">[[saprašana#Latvian|saprašana]]</span> |} </div></div>[[Category:Latvian first conjugation verbs]][[Category:Latvian first conjugation verbs in -t]][[Category:Latvian a/o/a-s/t type first conjugation verbs]][[Category:Latvian first conjugation verbs in -zt or -st]] """) expected = { "forms": [{ "form": "", "source": "Conjugation", "tags": ["table-tags"] }, { "form": "saprotu", "source": "Conjugation", "tags": ["first-person", "indicative", "present", "singular"] }, { "form": "sapratu", "source": "Conjugation", "tags": ["first-person", "indicative", "past", "singular"] }, { "form": "sapratīšu", "source": "Conjugation", "tags": ["first-person", "future", "indicative", "singular"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['first-person', 'imperative', 'singular'] }, { "form": "saproti", "source": "Conjugation", "tags": ["indicative", "present", "second-person", "singular"] }, { "form": "saprati", "source": "Conjugation", "tags": ["indicative", "past", "second-person", "singular"] }, { "form": "sapratīsi", "source": "Conjugation", "tags": ["future", "indicative", "second-person", "singular"] }, { "form": "saproti", "source": "Conjugation", "tags": ["imperative", "second-person", "singular"] }, { "form": "saprot", "source": "Conjugation", "tags": ["indicative", "present", "singular", "third-person"] }, { "form": "saprata", "source": "Conjugation", "tags": ["indicative", "past", "singular", "third-person"] }, { "form": "sapratīs", "source": "Conjugation", "tags": ["future", "indicative", "singular", "third-person"] }, { "form": "lai saprot", "source": "Conjugation", "tags": ["imperative", "singular", "third-person"] }, { "form": "saprotam", "source": "Conjugation", "tags": ["first-person", "indicative", "plural", "present"] }, { "form": "sapratām", "source": "Conjugation", "tags": ["first-person", "indicative", "past", "plural"] }, { "form": "sapratīsim", "source": "Conjugation", "tags": ["first-person", "future", "indicative", "plural"] }, { "form": "sapratīsim", "source": "Conjugation", "tags": ["first-person", "imperative", "plural"] }, { "form": "saprotat", "source": "Conjugation", "tags": ["indicative", "plural", "present", "second-person"] }, { "form": "sapratāt", "source": "Conjugation", "tags": ["indicative", "past", "plural", "second-person"] }, { "form": "sapratīsiet", "source": "Conjugation", "tags": ["future", "indicative", "plural", "second-person"] }, { "form": "sapratīsit", "source": "Conjugation", "tags": ["future", "indicative", "plural", "second-person"] }, { "form": "saprotiet", "source": "Conjugation", "tags": ["imperative", "plural", "second-person"] }, { "form": "saprot", "source": "Conjugation", "tags": ["indicative", "plural", "present", "third-person"] }, { "form": "saprata", "source": "Conjugation", "tags": ["indicative", "past", "plural", "third-person"] }, { "form": "sapratīs", "source": "Conjugation", "tags": ["future", "indicative", "plural", "third-person"] }, { "form": "lai saprot", "source": "Conjugation", "tags": ["imperative", "plural", "third-person"] }, { "form": "saprotot", "source": "Conjugation", "tags": ["present", "renarrative"] }, { "form": "saprotošs", "source": "Conjugation", "tags": [ "active", "adjectival", "participle", "participle-1", "present" ] }, { "form": "esot sapratis", "source": "Conjugation", "tags": ["past", "renarrative"] }, { "form": "saprazdams", "source": "Conjugation", "tags": [ "active", "adverbial", "participle", "participle-2", "present" ] }, { "form": "sapratīšot", "source": "Conjugation", "tags": ["future", "renarrative"] }, { "form": "saprotot", "source": "Conjugation", "tags": [ "active", "adverbial", "participle", "participle-3", "present" ] }, { "form": "lai saprotot", "source": "Conjugation", "tags": ["imperative"] }, { "form": "saprotam", "source": "Conjugation", "tags": ["active", "participle", "participle-4", "present"] }, { "form": "sapratis", "source": "Conjugation", "tags": ["active", "participle", "past"] }, { "form": "saprastu", "source": "Conjugation", "tags": ["conditional", "present"] }, { "form": "saprotams", "source": "Conjugation", "tags": ["participle", "passive", "present"] }, { "form": "būtu sapratis", "source": "Conjugation", "tags": ["conditional", "past"] }, { "form": "saprasts", "source": "Conjugation", "tags": ["participle", "passive", "past"] }, { "form": "jāsaprot", "source": "Conjugation", "tags": ["debitive", "indicative"] }, { "form": "būt jāsaprot", "source": "Conjugation", "tags": ["debitive", "indicative"] }, { "form": "saprast", "source": "Conjugation", "tags": ["infinitive"] }, { "form": "esot jāsaprot", "source": "Conjugation", "tags": ["conjunctive", "conjunctive-1", "debitive"] }, { "form": "nesaprast", "source": "Conjugation", "tags": ["infinitive", "negative"] }, { "form": "jāsaprotot", "source": "Conjugation", "tags": ["conjunctive", "conjunctive-2", "debitive"] }, { "form": "saprašana", "source": "Conjugation", "tags": ["noun-from-verb"] }], } self.assertEqual(expected, ret) def test_Latvian_noun1(self): ret = self.xinfl( "auss", "Latvian", "noun", "Declension", """ <div class="NavFrame" style="width%3A410px"> <div class="NavHead" style>Declension of ''auss''<nowiki /> (6th declension)</div> <div class="NavContent"> {| border="1px+solid+%23000000" style="border-collapse%3Acollapse%3B+background%3A%23F9F9F9%3B+text-align%3Acenter%3B+width%3A100%25" class="inflection-table" |- ! style="width%3A178px%3Bbackground%3A%23DEDEDE" | ! style="background%3A%23DEDEDE" | singular <small>([[vienskaitlis]])</small> ! style="background%3A%23DEDEDE" | plural <small>([[daudzskaitlis]])</small> |- ! style="background%3A%23EFEFEF" | nominative <small>([[nominatīvs]])</small> | <span class="Latn+form-of+lang-lv+nom%7Cs-form-of+++++++" lang="lv">[[auss#Latvian|auss]]</span> | <span class="Latn+form-of+lang-lv+nom%7Cp-form-of+++++++" lang="lv">[[ausis#Latvian|ausis]]</span> |- ! style="background%3A%23EFEFEF" | accusative <small>([[akuzatīvs]])</small> | <span class="Latn+form-of+lang-lv+acc%7Cs-form-of+++++++" lang="lv">[[ausi#Latvian|ausi]]</span> | <span class="Latn+form-of+lang-lv+acc%7Cp-form-of+++++++" lang="lv">[[ausis#Latvian|ausis]]</span> |- ! style="background%3A%23EFEFEF" | genitive <small>([[ģenitīvs]])</small> | <span class="Latn+form-of+lang-lv+gen%7Cs-form-of+++++++" lang="lv">[[auss#Latvian|auss]]</span> | <span class="Latn+form-of+lang-lv+gen%7Cp-form-of+++++++" lang="lv">[[ausu#Latvian|ausu]]</span> |- ! style="background%3A%23EFEFEF" | dative <small>([[datīvs]])</small> | <span class="Latn+form-of+lang-lv+dat%7Cs-form-of+++++++" lang="lv">[[ausij#Latvian|ausij]]</span> | <span class="Latn+form-of+lang-lv+dat%7Cp-form-of+++++++" lang="lv">[[ausīm#Latvian|ausīm]]</span> |- ! style="background%3A%23EFEFEF" | instrumental <small>([[instrumentālis]])</small> | <span class="Latn+form-of+lang-lv+ins%7Cs-form-of+++++++" lang="lv">[[ausi#Latvian|ausi]]</span> | <span class="Latn+form-of+lang-lv+ins%7Cp-form-of+++++++" lang="lv">[[ausīm#Latvian|ausīm]]</span> |- ! style="background%3A%23EFEFEF" | locative <small>([[lokatīvs]])</small> | <span class="Latn+form-of+lang-lv+loc%7Cs-form-of+++++++" lang="lv">[[ausī#Latvian|ausī]]</span> | <span class="Latn+form-of+lang-lv+loc%7Cp-form-of+++++++" lang="lv">[[ausīs#Latvian|ausīs]]</span> |- ! style="background%3A%23EFEFEF" | vocative <small>([[vokatīvs]])</small> | <span class="Latn+form-of+lang-lv+voc%7Cs-form-of+++++++" lang="lv">[[auss#Latvian|auss]]</span> | <span class="Latn+form-of+lang-lv+voc%7Cp-form-of+++++++" lang="lv">[[ausis#Latvian|ausis]]</span> |} </div></div>[[Category:Latvian sixth declension  nouns]][[Category:Latvian  noun forms]][[Category:Latvian non-alternating sixth declension  nouns]] """) expected = { "forms": [{ "form": "declension-6", "source": "Declension", "tags": ["table-tags"] }, { "form": "6th declension", "source": "Declension", "tags": ["class"] }, { "form": "auss", "source": "Declension", "tags": ["nominative", "singular"] }, { "form": "ausis", "source": "Declension", "tags": ["nominative", "plural"] }, { "form": "ausi", "source": "Declension", "tags": ["accusative", "singular"] }, { "form": "ausis", "source": "Declension", "tags": ["accusative", "plural"] }, { "form": "auss", "source": "Declension", "tags": ["genitive", "singular"] }, { "form": "ausu", "source": "Declension", "tags": ["genitive", "plural"] }, { "form": "ausij", "source": "Declension", "tags": ["dative", "singular"] }, { "form": "ausīm", "source": "Declension", "tags": ["dative", "plural"] }, { "form": "ausi", "source": "Declension", "tags": ["instrumental", "singular"] }, { "form": "ausīm", "source": "Declension", "tags": ["instrumental", "plural"] }, { "form": "ausī", "source": "Declension", "tags": ["locative", "singular"] }, { "form": "ausīs", "source": "Declension", "tags": ["locative", "plural"] }, { "form": "auss", "source": "Declension", "tags": ["singular", "vocative"] }, { "form": "ausis", "source": "Declension", "tags": ["plural", "vocative"] }], } self.assertEqual(expected, ret) def test_Latvian_adj1(self): ret = self.xinfl( "zils", "Latvian", "adj", "Declension", """ <div class="NavFrame" style="width%3A508px"> <div class="NavHead" style>indefinite declension <small>([[nenoteiktā]] [[galotne]])</small> of ''zils''</div> <div class="NavContent"> {| border="1" style="border-collapse%3Acollapse%3B+background%3A%23F9F9F9%3B+text-align%3Acenter%3B+width%3A100%25" class="inflection-table" |- ! rowspan="2" style="background%3A%23DEDEDE%3Bwidth%3A195px" | ! colspan="2" style="background%3A%23DEDEDE%3Bwidth%3A156px" | masculine <small>([[vīriešu]] [[dzimte]])</small> ! rowspan="9" style="background%3A%23DEDEDE%3Bwidth%3A1px" | ! colspan="2" style="background%3A%23DEDEDE%3Bwidth%3A156px" | feminine <small>([[sieviešu]] [[dzimte]])</small> |- ! style="background%3A%23DEDEDE%3Bwidth%3A77px" | singular <br><small>([[vienskaitlis]])</small> ! style="background%3A%23DEDEDE%3Bwidth%3A79px" | plural <br><small>([[daudzskaitlis]])</small> ! style="background%3A%23DEDEDE%3Bwidth%3A77px" | singular <br><small>([[vienskaitlis]])</small> ! style="background%3A%23DEDEDE%3Bwidth%3A79px" | plural <br><small>([[daudzskaitlis]])</small> |- ! style="background%3A%23EFEFEF" | nominative <small>([[nominatīvs]])</small> | <span class="Latn" lang="lv">[[zils#Latvian|zils]]</span> | <span class="Latn" lang="lv">[[zili#Latvian|zili]]</span> | <span class="Latn" lang="lv">[[zila#Latvian|zila]]</span> | <span class="Latn" lang="lv">[[zilas#Latvian|zilas]]</span> |- ! style="background%3A%23EFEFEF" | accusative <small>([[akuzatīvs]])</small> | <span class="Latn" lang="lv">[[zilu#Latvian|zilu]]</span> | <span class="Latn" lang="lv">[[zilus#Latvian|zilus]]</span> | <span class="Latn" lang="lv">[[zilu#Latvian|zilu]]</span> | <span class="Latn" lang="lv">[[zilas#Latvian|zilas]]</span> |- ! style="background%3A%23EFEFEF" | genitive <small>([[ģenitīvs]])</small> | <span class="Latn" lang="lv">[[zila#Latvian|zila]]</span> | <span class="Latn" lang="lv">[[zilu#Latvian|zilu]]</span> | <span class="Latn" lang="lv">[[zilas#Latvian|zilas]]</span> | <span class="Latn" lang="lv">[[zilu#Latvian|zilu]]</span> |- ! style="background%3A%23EFEFEF" | dative <small>([[datīvs]])</small> | <span class="Latn" lang="lv">[[zilam#Latvian|zilam]]</span> | <span class="Latn" lang="lv">[[ziliem#Latvian|ziliem]]</span> | <span class="Latn" lang="lv">[[zilai#Latvian|zilai]]</span> | <span class="Latn" lang="lv">[[zilām#Latvian|zilām]]</span> |- ! style="background%3A%23EFEFEF" | instrumental <small>([[instrumentālis]])</small> | <span class="Latn" lang="lv">[[zilu#Latvian|zilu]]</span> | <span class="Latn" lang="lv">[[ziliem#Latvian|ziliem]]</span> | <span class="Latn" lang="lv">[[zilu#Latvian|zilu]]</span> | <span class="Latn" lang="lv">[[zilām#Latvian|zilām]]</span> |- ! style="background%3A%23EFEFEF" | locative <small>([[lokatīvs]])</small> | <span class="Latn" lang="lv">[[zilā#Latvian|zilā]]</span> | <span class="Latn" lang="lv">[[zilos#Latvian|zilos]]</span> | <span class="Latn" lang="lv">[[zilā#Latvian|zilā]]</span> | <span class="Latn" lang="lv">[[zilās#Latvian|zilās]]</span> |- ! style="background%3A%23EFEFEF" | vocative <small>([[vokatīvs]])</small> | — | — | — | — |- ! colspan="10" style="background%3A%23DEDEDE%3Bheight%3A1em" | |} </div></div> """) expected = { "forms": [{ "form": "", "source": "Declension", "tags": ["table-tags"] }, { "form": "zils", "source": "Declension", "tags": ["indefinite", "masculine", "nominative", "singular"] }, { "form": "zili", "source": "Declension", "tags": ["indefinite", "masculine", "nominative", "plural"] }, { "form": "zila", "source": "Declension", "tags": ["feminine", "indefinite", "nominative", "singular"] }, { "form": "zilas", "source": "Declension", "tags": ["feminine", "indefinite", "nominative", "plural"] }, { "form": "zilu", "source": "Declension", "tags": ["accusative", "indefinite", "masculine", "singular"] }, { "form": "zilus", "source": "Declension", "tags": ["accusative", "indefinite", "masculine", "plural"] }, { "form": "zilu", "source": "Declension", "tags": ["accusative", "feminine", "indefinite", "singular"] }, { "form": "zilas", "source": "Declension", "tags": ["accusative", "feminine", "indefinite", "plural"] }, { "form": "zila", "source": "Declension", "tags": ["genitive", "indefinite", "masculine", "singular"] }, { "form": "zilu", "source": "Declension", "tags": ["genitive", "indefinite", "masculine", "plural"] }, { "form": "zilas", "source": "Declension", "tags": ["feminine", "genitive", "indefinite", "singular"] }, { "form": "zilu", "source": "Declension", "tags": ["feminine", "genitive", "indefinite", "plural"] }, { "form": "zilam", "source": "Declension", "tags": ["dative", "indefinite", "masculine", "singular"] }, { "form": "ziliem", "source": "Declension", "tags": ["dative", "indefinite", "masculine", "plural"] }, { "form": "zilai", "source": "Declension", "tags": ["dative", "feminine", "indefinite", "singular"] }, { "form": "zilām", "source": "Declension", "tags": ["dative", "feminine", "indefinite", "plural"] }, { "form": "zilu", "source": "Declension", "tags": ["indefinite", "instrumental", "masculine", "singular"] }, { "form": "ziliem", "source": "Declension", "tags": ["indefinite", "instrumental", "masculine", "plural"] }, { "form": "zilu", "source": "Declension", "tags": ["feminine", "indefinite", "instrumental", "singular"] }, { "form": "zilām", "source": "Declension", "tags": ["feminine", "indefinite", "instrumental", "plural"] }, { "form": "zilā", "source": "Declension", "tags": ["indefinite", "locative", "masculine", "singular"] }, { "form": "zilos", "source": "Declension", "tags": ["indefinite", "locative", "masculine", "plural"] }, { "form": "zilā", "source": "Declension", "tags": ["feminine", "indefinite", "locative", "singular"] }, { "form": "zilās", "source": "Declension", "tags": ["feminine", "indefinite", "locative", "plural"] }, { 'form': '-', 'source': 'Declension', 'tags': ['indefinite', 'masculine', 'singular', 'vocative'] }, { 'form': '-', 'source': 'Declension', 'tags': ['indefinite', 'masculine', 'plural', 'vocative'] }, { 'form': '-', 'source': 'Declension', 'tags': ['feminine', 'indefinite', 'singular', 'vocative'] }, { 'form': '-', 'source': 'Declension', 'tags': ['feminine', 'indefinite', 'plural', 'vocative'] }], } self.assertEqual(expected, ret)
class WiktExtractTests(unittest.TestCase): def setUp(self): self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") def test_empty(self): ret = decode_tags(self.config, []) self.assertEqual(self.config.warnings, []) self.assertEqual(ret, [()]) def test_singular(self): ret = decode_tags(self.config, ["singular"]) self.assertEqual(self.config.warnings, []) self.assertEqual(ret, [("singular", )]) def test_unknown(self): ret = decode_tags(self.config, ["unknowntag"]) self.assertNotEqual(self.config.warnings, []) self.assertEqual(ret, [("error", )]) def test_plural_partitive(self): ret = decode_tags(self.config, ["partitive", "plural"]) self.assertEqual(self.config.warnings, []) self.assertEqual(ret, [("partitive", "plural")]) def test_combo(self): ret = decode_tags(self.config, ["class", "2a", "stress", "pattern", "1"]) self.assertEqual(self.config.warnings, []) self.assertEqual(ret, [("class 2a", "stress pattern 1")]) def test_combo_err(self): ret = decode_tags(self.config, ["class", "2a", "stress", "pattern", "xyz"]) self.assertNotEqual(self.config.warnings, []) self.assertEqual(ret, [("class 2a", "error")]) def test_head1(self): data = {} parse_word_head(self.ctx, self.config, "noun", "", data) self.assertEqual(self.config.warnings, []) self.assertEqual(data, {}) def test_head2(self): data = {} parse_word_head(self.ctx, self.config, "noun", "testpage", data) self.assertEqual(self.config.warnings, []) self.assertEqual(data, {}) def test_head3(self): data = {} parse_word_head(self.ctx, self.config, "noun", "testpAge", data) self.assertEqual(self.config.warnings, []) self.assertEqual( data, {"forms": [{ "form": "testpAge", "tags": ["canonical"] }]}) def test_head4(self): data = {} parse_word_head(self.ctx, self.config, "noun", "testpage f", data) self.assertEqual(self.config.warnings, []) self.assertEqual(data, {"tags": ["feminine"]}) def test_head5(self): data = {} parse_word_head(self.ctx, self.config, "noun", "testpAge m", data) self.assertEqual(self.config.warnings, []) self.assertEqual( data, { "forms": [{ "form": "testpAge", "tags": ["canonical"] }], "tags": ["masculine"] }) def test_head6(self): data = {} parse_word_head(self.ctx, self.config, "noun", "testpage n", data) self.assertEqual(self.config.warnings, []) self.assertEqual(data, {"tags": ["neuter"]}) def test_head7(self): data = {} parse_word_head(self.ctx, self.config, "noun", "testpage c", data) self.assertEqual(self.config.warnings, []) self.assertEqual(data, {"tags": ["common"]}) def test_head8(self): data = {} parse_word_head(self.ctx, self.config, "noun", "testpage f (plurale tantum, inanimate)", data) self.assertEqual(self.config.warnings, []) self.assertEqual(data, {"tags": ["feminine", "plurale tantum", "inanimate"]}) def test_head9(self): data = {} parse_word_head( self.ctx, self.config, "noun", "testpage f (plurale tantum, stem testpag, inanimate)", data) print(data) self.assertEqual(self.config.warnings, []) self.assertEqual( data, { "tags": ["feminine", "plurale tantum", "inanimate"], "forms": [{ "tags": ["stem"], "form": "testpag" }] }) def test_head10(self): data = {} parse_word_head( self.ctx, self.config, "noun", "testpage f (plurale tantum, stem testpag, inanimate) " "(+ dative)", data) self.assertEqual(self.config.warnings, []) print(data) self.assertEqual( data, { "tags": ["feminine", "plurale tantum", "inanimate", "with dative"], "forms": [{ "tags": ["stem"], "form": "testpag" }] }) def test_comma_semi1(self): self.assertEqual(split_at_comma_semi(""), []) def test_comma_semi2(self): self.assertEqual(split_at_comma_semi("foo bar"), ["foo bar"]) def test_comma_semi3(self): self.assertEqual(split_at_comma_semi("foo bar, zappa"), ["foo bar", "zappa"]) def test_comma_semi4(self): self.assertEqual(split_at_comma_semi("foo , bar; zappa"), ["foo", "bar", "zappa"]) def test_comma_semi5(self): self.assertEqual(split_at_comma_semi("a (foo, bar); zappa"), ["a (foo bar)", "zappa"]) def test_comma_semi5(self): self.assertEqual(split_at_comma_semi("a (foo, bar)[1; zappa], z"), ["a (foo, bar)[1; zappa]", "z"])
def setUp(self): self.maxDiff = 20000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("abolitionism") # Note: some tests use last char self.ctx.start_section("English")
class InflTests(unittest.TestCase): def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def xinfl(self, word, lang, pos, section, text): """Runs a single inflection table parsing test, and returns ``data``.""" self.ctx.start_page(word) self.ctx.start_section(lang) self.ctx.start_subsection(pos) tree = self.ctx.parse(text) data = {} parse_inflection_section(self.config, self.ctx, data, word, lang, pos, section, tree) return data def test_Danish_noun1(self): ret = self.xinfl( "motorsav", "Danish", "noun", "Inflection", """ <div class="NavFrame"> <div class="NavHead">Declension of <i class="Latn+mention" lang="da">motorsav</i></div> <div class="NavContent"> {| class="inflection-table" style="text-align%3Acenter%3Bwidth%3A100%25%3B" |- style="background-color%3A%23eee%3B" ! rowspan="2" | common<br>gender ! colspan="2" | ''Singular'' ! colspan="2" | ''Plural'' |- style="font-size%3A90%25%3Bbackground-color%3A%23eee%3B" ! style="width%3A25%25%3B" | ''indefinite'' ! style="width%3A25%25%3B" | ''definite'' ! style="width%3A25%25%3B" | ''indefinite'' ! style="width%3A25%25%3B" | ''definite'' |- ! style="background-color%3A%23eee%3B" | ''[[nominative case|nominative]]'' | style="background-color%3A%23f9f9f9%3B" | <span class="Latn" lang="da">[[motorsav#Danish|motorsav]]</span> | style="background-color%3A%23f9f9f9%3B" | <span class="Latn+form-of+lang-da+def%7Cs-form-of+++++++" lang="da">[[motorsaven#Danish|motorsaven]]</span> | style="background-color%3A%23f9f9f9%3B" | <span class="Latn+form-of+lang-da+indef%7Cp-form-of+++++++" lang="da">[[motorsave#Danish|motorsave]]</span> | style="background-color%3A%23f9f9f9%3B" | <span class="Latn+form-of+lang-da+def%7Cp-form-of+++++++" lang="da">[[motorsavene#Danish|motorsavene]]</span> |- ! style="background-color%3A%23eee%3B" | ''[[genitive case|genitive]]'' | style="background-color%3A%23f9f9f9%3B" | <span class="Latn+form-of+lang-da+indef%7Cgen%7Cs-form-of+++++++" lang="da">[[motorsavs#Danish|motorsavs]]</span> | style="background-color%3A%23f9f9f9%3B" | <span class="Latn+form-of+lang-da+def%7Cgen%7Cs-form-of+++++++" lang="da">[[motorsavens#Danish|motorsavens]]</span> | style="background-color%3A%23f9f9f9%3B" | <span class="Latn+form-of+lang-da+indef%7Cgen%7Cp-form-of+++++++" lang="da">[[motorsaves#Danish|motorsaves]]</span> | style="background-color%3A%23f9f9f9%3B" | <span class="Latn+form-of+lang-da+def%7Cgen%7Cp-form-of+++++++" lang="da">[[motorsavenes#Danish|motorsavenes]]</span> |} </div></div> """) expected = { "forms": [{ "form": "", "source": "Inflection", "tags": ["table-tags"] }, { "form": "motorsav", "source": "Inflection", "tags": ["indefinite", "nominative", "singular"] }, { "form": "motorsaven", "source": "Inflection", "tags": ["definite", "nominative", "singular"] }, { "form": "motorsave", "source": "Inflection", "tags": ["indefinite", "nominative", "plural"] }, { "form": "motorsavene", "source": "Inflection", "tags": ["definite", "nominative", "plural"] }, { "form": "motorsavs", "source": "Inflection", "tags": ["genitive", "indefinite", "singular"] }, { "form": "motorsavens", "source": "Inflection", "tags": ["definite", "genitive", "singular"] }, { "form": "motorsaves", "source": "Inflection", "tags": ["genitive", "indefinite", "plural"] }, { "form": "motorsavenes", "source": "Inflection", "tags": ["definite", "genitive", "plural"] }], } self.assertEqual(expected, ret) def test_Danish_verb1(self): ret = self.xinfl( "patte", "Danish", "verb", "Inflection", """ <div class="NavFrame"> <div class="NavHead">Inflection of <i class="Latn+mention" lang="da">patte</i></div> <div class="NavContent"> {| class="inflection-table" style="border-collapse%3Aseparate%3B+background%3A%23F0F0F0%3B+text-align%3Acenter%3B+width%3A100%25%3B+border-spacing%3A2px" |- ! ! colspan="1" |present ! colspan="1" |past |- ! colspan="1" style="background%3A%23c0cfe4" | simple |<span class="Latn+form-of+lang-da+pres-form-of+++++++" lang="da">[[patter#Danish|patter]]</span> |<span class="Latn+form-of+lang-da+past-form-of+++++++" lang="da">[[pattede#Danish|pattede]]</span> |- ! colspan="1" style="background%3A%23c0cfe4" | perfect |<span class="Latn" lang="da">[[har#Danish|har]]</span> pattet |<span class="Latn" lang="da">[[havde#Danish|havde]]</span> pattet |- ! colspan="1" style="background%3A%23c0cfe4" | passive |<span class="Latn+form-of+lang-da+pasv-form-of+++++++" lang="da">[[pattes#Danish|pattes]]</span> |— |- ! colspan="1" style="background%3A%23c0cfe4" | participle |<span class="Latn+form-of+lang-da+pres%7Cptcp-form-of+++++++" lang="da">[[pattende#Danish|pattende]]</span> |<span class="Latn+form-of+lang-da+past%7Cptcp-form-of+++++++" lang="da">[[pattet#Danish|pattet]]</span> |- ! colspan="1" style="background%3A%23e2e4c0" |imperative |<span class="Latn+form-of+lang-da+impr-form-of+++++++" lang="da">[[pat#Danish|pat]]</span> |— |- ! colspan="1" style="background%3A%23e2e4c0" |infinitive |<span class="Latn" lang="da">[[patte#Danish|patte]]</span> |— |- ! colspan="1" style="background%3A%23e2e4c0" |auxiliary verb |<span class="Latn" lang="da">[[have#Danish|have]]</span> |— |- ! colspan="1" style="background%3A%23e2e4c0" |gerund |<span class="Latn+form-of+lang-da+gerund-form-of+++++++" lang="da">[[patten#Danish|patten]]</span> |— |} </div></div> """) expected = { "forms": [{ "form": "", "source": "Inflection", "tags": ["table-tags"] }, { "form": "patter", "source": "Inflection", "tags": ["present"] }, { "form": "pattede", "source": "Inflection", "tags": ["past"] }, { "form": "har pattet", "source": "Inflection", "tags": ["perfect", "present"] }, { "form": "havde pattet", "source": "Inflection", "tags": ["past", "perfect"] }, { "form": "pattes", "source": "Inflection", "tags": ["passive", "present"] }, { 'form': '-', 'source': 'Inflection', 'tags': ['passive', 'past'] }, { "form": "pattende", "source": "Inflection", "tags": ["participle", "present"] }, { "form": "pattet", "source": "Inflection", "tags": ["participle", "past"] }, { "form": "pat", "source": "Inflection", "tags": ["imperative", "present"] }, { 'form': '-', 'source': 'Inflection', 'tags': ['imperative', 'past'] }, { "form": "patte", "source": "Inflection", "tags": ["infinitive", "present"] }, { 'form': '-', 'source': 'Inflection', 'tags': ['infinitive', 'past'] }, { "form": "have", "source": "Inflection", "tags": ["auxiliary", "present"] }, { 'form': '-', 'source': 'Inflection', 'tags': ['auxiliary', 'past'] }, { "form": "patten", "source": "Inflection", "tags": ["gerund", "present"] }, { 'form': '-', 'source': 'Inflection', 'tags': ['gerund', 'past'] }], } self.assertEqual(expected, ret) def test_Danish_adj1(self): ret = self.xinfl( "kedelig", "Danish", "adj", "Inflection", """ {| class="inflection-table+vsSwitcher" data-toggle-category="inflection" style="border%3A+solid+1px+%23CCCCFF%3B+text-align%3Aleft%3B" cellspacing="1" cellpadding="2" |- style="background%3A+%23CCCCFF%3B+vertical-align%3A+top%3B" ! class="vsToggleElement" colspan="4" | Inflection of <i class="Latn+mention" lang="da">kedelig</i> |- class="vsHide" style="background%3A+%23CCCCFF%3B" ! style="min-width%3A+12em%3B" | ! style="min-width%3A+12em%3B" | Positive ! style="min-width%3A+12em%3B" | Comparative ! style="min-width%3A+12em%3B" | Superlative |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Common singular | <span class="Latn" lang="da">[[kedelig#Danish|kedelig]]</span> | <span class="Latn" lang="da">[[kedeligere#Danish|kedeligere]]</span> | <span class="Latn" lang="da">[[kedeligst#Danish|kedeligst]]</span><sup>2</sup> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Neuter singular | <span class="Latn" lang="da">[[kedeligt#Danish|kedeligt]]</span> | <span class="Latn" lang="da">[[kedeligere#Danish|kedeligere]]</span> | <span class="Latn" lang="da">[[kedeligst#Danish|kedeligst]]</span><sup>2</sup> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Plural | <span class="Latn" lang="da">[[kedelige#Danish|kedelige]]</span> | <span class="Latn" lang="da">[[kedeligere#Danish|kedeligere]]</span> | <span class="Latn" lang="da">[[kedeligst#Danish|kedeligst]]</span><sup>2</sup> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Definite attributive<sup>1</sup> | <span class="Latn" lang="da">[[kedelige#Danish|kedelige]]</span> | <span class="Latn" lang="da">[[kedeligere#Danish|kedeligere]]</span> | <span class="Latn" lang="da">[[kedeligste#Danish|kedeligste]]</span> |- class="vsHide" style="background%3A+%23E6E6FF%3B" | style="font-size%3A+smaller%3B" colspan="4" | 1) When an adjective is applied predicatively to something definite, the corresponding "indefinite" form is used.<br> 2) The "indefinite" superlatives may not be used attributively. |} """) expected = { "forms": [{ "form": "", "source": "Inflection", "tags": ["table-tags"] }, { "form": "kedelig", "source": "Inflection", "tags": ["common-gender", "positive", "singular"] }, { "form": "kedeligere", "source": "Inflection", "tags": ["common-gender", "comparative", "singular"] }, { "form": "kedeligst", "source": "Inflection", "tags": ["common-gender", "singular", "superlative"] }, { "form": "kedeligt", "source": "Inflection", "tags": ["neuter", "positive", "singular"] }, { "form": "kedeligere", "source": "Inflection", "tags": ["comparative", "neuter", "singular"] }, { "form": "kedeligst", "source": "Inflection", "tags": ["neuter", "singular", "superlative"] }, { "form": "kedelige", "source": "Inflection", "tags": ["plural", "positive"] }, { "form": "kedeligere", "source": "Inflection", "tags": ["comparative", "plural"] }, { "form": "kedeligst", "source": "Inflection", "tags": ["plural", "superlative"] }, { "form": "kedelige", "source": "Inflection", "tags": ["attributive", "definite", "positive"] }, { "form": "kedeligere", "source": "Inflection", "tags": ["attributive", "comparative", "definite"] }, { "form": "kedeligste", "source": "Inflection", "tags": ["attributive", "definite", "superlative"] }], } self.assertEqual(expected, ret) def test_Danish_adj2(self): # This also tests having forms identical to a tag/header in the table ret = self.xinfl( "negativ", "Danish", "adj", "Inflection", """ {| class="inflection-table+vsSwitcher" data-toggle-category="inflection" style="border%3A+solid+1px+%23CCCCFF%3B+text-align%3Aleft%3B" cellspacing="1" cellpadding="2" |- style="background%3A+%23CCCCFF%3B+vertical-align%3A+top%3B" ! class="vsToggleElement" colspan="4" | Inflection of <i class="Latn+mention" lang="da">negativ</i> |- class="vsHide" style="background%3A+%23CCCCFF%3B" ! style="min-width%3A+12em%3B" | ! style="min-width%3A+12em%3B" | Positive ! style="min-width%3A+12em%3B" | Comparative ! style="min-width%3A+12em%3B" | Superlative |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Common singular | <span class="Latn" lang="da">[[negativ#Danish|negativ]]</span> | <span class="Latn" lang="da">[[mere#Danish|mere]] [[negativ#Danish|negativ]]</span> | <span class="Latn" lang="da">[[mest#Danish|mest]] [[negativ#Danish|negativ]]</span><sup>2</sup> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Neuter singular | <span class="Latn" lang="da">[[negativt#Danish|negativt]]</span> | <span class="Latn" lang="da">[[mere#Danish|mere]] [[negativ#Danish|negativ]]</span> | <span class="Latn" lang="da">[[mest#Danish|mest]] [[negativ#Danish|negativ]]</span><sup>2</sup> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Plural | <span class="Latn" lang="da">[[negative#Danish|negative]]</span> | <span class="Latn" lang="da">[[mere#Danish|mere]] [[negativ#Danish|negativ]]</span> | <span class="Latn" lang="da">[[mest#Danish|mest]] [[negativ#Danish|negativ]]</span><sup>2</sup> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Definite attributive<sup>1</sup> | <span class="Latn" lang="da">[[negative#Danish|negative]]</span> | <span class="Latn" lang="da">[[mere#Danish|mere]] [[negativ#Danish|negativ]]</span> | <span class="Latn" lang="da">[[mest#Danish|mest]] [[negative#Danish|negative]]</span> |- class="vsHide" style="background%3A+%23E6E6FF%3B" | style="font-size%3A+smaller%3B" colspan="4" | 1) When an adjective is applied predicatively to something definite, the corresponding "indefinite" form is used.<br> 2) The "indefinite" superlatives may not be used attributively. |} """) expected = { "forms": [{ "form": "", "source": "Inflection", "tags": ["table-tags"] }, { "form": "negativ", "source": "Inflection", "tags": ["common-gender", "positive", "singular"] }, { "form": "mere negativ", "source": "Inflection", "tags": ["common-gender", "comparative", "singular"] }, { "form": "mest negativ", "source": "Inflection", "tags": ["common-gender", "singular", "superlative"] }, { "form": "negativt", "source": "Inflection", "tags": ["neuter", "positive", "singular"] }, { "form": "mere negativ", "source": "Inflection", "tags": ["comparative", "neuter", "singular"] }, { "form": "mest negativ", "source": "Inflection", "tags": ["neuter", "singular", "superlative"] }, { "form": "negative", "source": "Inflection", "tags": ["plural", "positive"] }, { "form": "mere negativ", "source": "Inflection", "tags": ["comparative", "plural"] }, { "form": "mest negativ", "source": "Inflection", "tags": ["plural", "superlative"] }, { "form": "negative", "source": "Inflection", "tags": ["attributive", "definite", "positive"] }, { "form": "mere negativ", "source": "Inflection", "tags": ["attributive", "comparative", "definite"] }, { "form": "mest negative", "source": "Inflection", "tags": ["attributive", "definite", "superlative"] }], } self.assertEqual(expected, ret)
class InflTests(unittest.TestCase): def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def xinfl(self, word, lang, pos, section, text): """Runs a single inflection table parsing test, and returns ``data``.""" self.ctx.start_page(word) self.ctx.start_section(lang) self.ctx.start_subsection(pos) tree = self.ctx.parse(text) data = {} parse_inflection_section(self.config, self.ctx, data, word, lang, pos, section, tree) return data def test_Swedish_noun1(self): ret = self.xinfl( "berg", "Swedish", "noun", "Declension", """ {| class="inflection-table+vsSwitcher" data-toggle-category="inflection" style="border%3A+solid+1px+%23CCCCFF%3B+text-align%3Aleft%3B" cellspacing="1" cellpadding="2" |- style="background%3A+%23CCCCFF%3B+vertical-align%3A+top%3B" ! class="vsToggleElement" colspan="5" | Declension of <i class="Latn+mention" lang="sv">berg</i> |- class="vsHide" style="background%3A+%23CCCCFF%3B" ! rowspan="2" style="min-width%3A+12em%3B" | ! colspan="2" | Singular ! colspan="2" | Plural |- class="vsHide" style="background%3A+%23CCCCFF%3B" ! style="min-width%3A+12em%3B" | Indefinite ! style="min-width%3A+12em%3B" | Definite ! style="min-width%3A+12em%3B" | Indefinite ! style="min-width%3A+12em%3B" | Definite |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Nominative | <span class="Latn" lang="sv">[[berg#Swedish|berg]]</span> | <span class="Latn" lang="sv">[[berget#Swedish|berget]]</span> | <span class="Latn" lang="sv">[[berg#Swedish|berg]]</span> | <span class="Latn" lang="sv">[[bergen#Swedish|bergen]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Genitive | <span class="Latn" lang="sv">[[bergs#Swedish|bergs]]</span> | <span class="Latn" lang="sv">[[bergets#Swedish|bergets]]</span> | <span class="Latn" lang="sv">[[bergs#Swedish|bergs]]</span> | <span class="Latn" lang="sv">[[bergens#Swedish|bergens]]</span> |} """) expected = { "forms": [{ "form": "", "source": "Declension", "tags": ["table-tags"] }, { "form": "berg", "source": "Declension", "tags": ["indefinite", "nominative", "singular"] }, { "form": "berget", "source": "Declension", "tags": ["definite", "nominative", "singular"] }, { "form": "berg", "source": "Declension", "tags": ["indefinite", "nominative", "plural"] }, { "form": "bergen", "source": "Declension", "tags": ["definite", "nominative", "plural"] }, { "form": "bergs", "source": "Declension", "tags": ["genitive", "indefinite", "singular"] }, { "form": "bergets", "source": "Declension", "tags": ["definite", "genitive", "singular"] }, { "form": "bergs", "source": "Declension", "tags": ["genitive", "indefinite", "plural"] }, { "form": "bergens", "source": "Declension", "tags": ["definite", "genitive", "plural"] }], } self.assertEqual(expected, ret) def test_Swedish_verb1(self): ret = self.xinfl( "kunna", "Swedish", "verb", "Conjugation", """ <div class="NavFrame" style="width%3A+54em%3B" data-toggle-category="inflection"> <div class="NavHead">Conjugation of kunna (irregular)</div> <div class="NavContent"> {| class="inflection-table" style="width%3A+100%25%3B+line-height%3A+125%25%3B+background-color%3A+%23F9F9F9%3B+text-align%3A+center%3B+border%3A+1px+solid+%23CCCCFF%3B" cellpadding="3" cellspacing="1" |- ! ! colspan="2" style="width%3A+50%25%3B+background-color%3A%23EFEFEF%3B" | Active ! colspan="2" style="width%3A+50%25%3B+background-color%3A%23EFEFEF%3B" | Passive |- ! style="background-color%3A%23EFEFEF%3B" | Infinitive | colspan="2" | <span class="Latn" lang="sv">[[kunna#Swedish|kunna]]</span> | colspan="2" | — |- ! style="background-color%3A%23EFEFEF%3B" | Supine | colspan="2" | <span class="Latn" lang="sv">[[kunnat#Swedish|kunnat]]</span> | colspan="2" | — |- ! style="background-color%3A%23EFEFEF%3B" | Imperative | colspan="2" | — | colspan="2" | — |- ! style="background-color%3A%23EFEFEF%3B" | ''Imper. plural''<sup>1</sup> | colspan="2" | — | colspan="2" | — |- ! ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Present ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Past ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Present ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Past |- ! style="background-color%3A%23EFEFEF%3B" | Indicative | <span class="Latn" lang="sv">[[kan#Swedish|kan]]</span> | <span class="Latn" lang="sv">[[kunde#Swedish|kunde]]</span> | — | — |- ! style="background-color%3A%23EFEFEF%3B" | ''Ind. plural''<sup>1</sup> | <span class="Latn" lang="sv">[[kunna#Swedish|kunna]]</span> | <span class="Latn" lang="sv">[[kunde#Swedish|kunde]]</span> | — | — |- ! style="background-color%3A%23EFEFEF%3B" | ''Subjunctive''<sup>2</sup> | <span class="Latn" lang="sv">[[kunne#Swedish|kunne]]</span> | <span class="Latn" lang="sv">[[kunde#Swedish|kunde]]</span> | — | — |- ! ! colspan="4" style="width%3A+100%25%3B+background-color%3A%23EFEFEF%3B" | Participles |- ! style="background-color%3A%23EFEFEF%3B" | Present participle | colspan="4" | <span class="Latn" lang="sv">[[kunnande#Swedish|kunnande]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | Past participle | colspan="4" | — |- | colspan="5" style="text-align%3A+left%3B" | <small><sup>1</sup> Archaic. <sup>2</sup> Dated. See [[Appendix:Swedish verbs#Dated and archaic forms|the appendix on Swedish verbs]].</small> |} </div></div>[[Category:Swedish irregular verbs|KUNNA]] """) expected = { "forms": [{ "form": "irregular", "source": "Conjugation", "tags": ["table-tags"] }, { "form": "kunna", "source": "Conjugation", "tags": ["active", "infinitive"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['infinitive', 'passive'] }, { "form": "kunnat", "source": "Conjugation", "tags": ["active", "supine"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['passive', 'supine'] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['active', 'imperative'] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['imperative', 'passive'] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['active', 'archaic', 'imperative', 'plural'] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['archaic', 'imperative', 'passive', 'plural'] }, { "form": "kan", "source": "Conjugation", "tags": ["active", "indicative", "present"] }, { "form": "kunde", "source": "Conjugation", "tags": ["active", "indicative", "past"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['indicative', 'passive', 'present'] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['indicative', 'passive', 'past'] }, { "form": "kunna", "source": "Conjugation", "tags": ["active", "archaic", "indicative", "plural", "present"] }, { "form": "kunde", "source": "Conjugation", "tags": ["active", "archaic", "indicative", "past", "plural"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['archaic', 'indicative', 'passive', 'plural', 'present'] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['archaic', 'indicative', 'passive', 'past', 'plural'] }, { "form": "kunne", "source": "Conjugation", "tags": ["active", "dated", "present", "subjunctive"] }, { "form": "kunde", "source": "Conjugation", "tags": ["active", "dated", "past", "subjunctive"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['dated', 'passive', 'present', 'subjunctive'] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['dated', 'passive', 'past', 'subjunctive'] }, { "form": "kunnande", "source": "Conjugation", "tags": ["participle", "present"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['participle', 'past'] }], } self.assertEqual(expected, ret) def test_Swedish_verb2(self): ret = self.xinfl( "simma", "Swedish", "verb", "Conjugation", """ <div class="NavFrame" style="width%3A+54em%3B" data-toggle-category="inflection"> <div class="NavHead">Conjugation of simma (weak)</div> <div class="NavContent"> {| class="inflection-table" style="width%3A+100%25%3B+line-height%3A+125%25%3B+background-color%3A+%23F9F9F9%3B+text-align%3A+center%3B+border%3A+1px+solid+%23CCCCFF%3B" cellpadding="3" cellspacing="1" |- ! ! colspan="2" style="width%3A+50%25%3B+background-color%3A%23EFEFEF%3B" | Active ! colspan="2" style="width%3A+50%25%3B+background-color%3A%23EFEFEF%3B" | Passive |- ! style="background-color%3A%23EFEFEF%3B" | Infinitive | colspan="2" | <span class="Latn" lang="sv">[[simma#Swedish|simma]]</span> | colspan="2" | <span class="Latn" lang="sv">[[simmas#Swedish|simmas]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | Supine | colspan="2" | <span class="Latn" lang="sv">[[simmat#Swedish|simmat]]</span> | colspan="2" | <span class="Latn" lang="sv">[[simmats#Swedish|simmats]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | Imperative | colspan="2" | <span class="Latn" lang="sv">[[simma#Swedish|simma]]</span> | colspan="2" | — |- ! style="background-color%3A%23EFEFEF%3B" | ''Imper. plural''<sup>1</sup> | colspan="2" | <span class="Latn" lang="sv">[[simmen#Swedish|simmen]]</span> | colspan="2" | — |- ! ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Present ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Past ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Present ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Past |- ! style="background-color%3A%23EFEFEF%3B" | Indicative | <span class="Latn" lang="sv">[[simmar#Swedish|simmar]]</span> | <span class="Latn" lang="sv">[[simmade#Swedish|simmade]]</span> | <span class="Latn" lang="sv">[[simmas#Swedish|simmas]]</span> | <span class="Latn" lang="sv">[[simmades#Swedish|simmades]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | ''Ind. plural''<sup>1</sup> | <span class="Latn" lang="sv">[[simma#Swedish|simma]]</span> | <span class="Latn" lang="sv">[[simmade#Swedish|simmade]]</span> | <span class="Latn" lang="sv">[[simmas#Swedish|simmas]]</span> | <span class="Latn" lang="sv">[[simmades#Swedish|simmades]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | ''Subjunctive''<sup>2</sup> | <span class="Latn" lang="sv">[[simme#Swedish|simme]]</span> | <span class="Latn" lang="sv">[[simmade#Swedish|simmade]]</span> | <span class="Latn" lang="sv">[[simmes#Swedish|simmes]]</span> | <span class="Latn" lang="sv">[[simmades#Swedish|simmades]]</span> |- ! ! colspan="4" style="width%3A+100%25%3B+background-color%3A%23EFEFEF%3B" | Participles |- ! style="background-color%3A%23EFEFEF%3B" | Present participle | colspan="4" | <span class="Latn" lang="sv">[[simmande#Swedish|simmande]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | Past participle | colspan="4" | <span class="Latn" lang="sv">[[simmad#Swedish|simmad]]</span> |- | colspan="5" style="text-align%3A+left%3B" | <small><sup>1</sup> Archaic. <sup>2</sup> Dated. See [[Appendix:Swedish verbs#Dated and archaic forms|the appendix on Swedish verbs]].</small> |} </div></div>[[Category:Swedish weak verbs|SIMMA]] <div class="NavFrame" style="width%3A+54em%3B" data-toggle-category="inflection"> <div class="NavHead">Conjugation of simma (class 3 strong)</div> <div class="NavContent"> {| class="inflection-table" style="width%3A+100%25%3B+line-height%3A+125%25%3B+background-color%3A+%23F9F9F9%3B+text-align%3A+center%3B+border%3A+1px+solid+%23CCCCFF%3B" cellpadding="3" cellspacing="1" |- ! ! colspan="2" style="width%3A+50%25%3B+background-color%3A%23EFEFEF%3B" | Active ! colspan="2" style="width%3A+50%25%3B+background-color%3A%23EFEFEF%3B" | Passive |- ! style="background-color%3A%23EFEFEF%3B" | Infinitive | colspan="2" | <span class="Latn" lang="sv">[[simma#Swedish|simma]]</span> | colspan="2" | <span class="Latn" lang="sv">[[simmas#Swedish|simmas]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | Supine | colspan="2" | <span class="Latn" lang="sv">[[summit#Swedish|summit]]</span> | colspan="2" | <span class="Latn" lang="sv">[[summits#Swedish|summits]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | Imperative | colspan="2" | <span class="Latn" lang="sv">[[sim#Swedish|sim]]</span> | colspan="2" | — |- ! style="background-color%3A%23EFEFEF%3B" | ''Imper. plural''<sup>1</sup> | colspan="2" | <span class="Latn" lang="sv">[[simmen#Swedish|simmen]]</span> | colspan="2" | — |- ! ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Present ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Past ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Present ! style="width%3A+25%25%3B+background-color%3A%23EFEFEF%3B" | Past |- ! style="background-color%3A%23EFEFEF%3B" | Indicative | <span class="Latn" lang="sv">[[simmer#Swedish|simmer]]</span> | <span class="Latn" lang="sv">[[sam#Swedish|sam]]</span> | <span class="Latn" lang="sv">[[sims#Swedish|sims]]</span>, <span class="Latn" lang="sv">[[simmes#Swedish|simmes]]</span> | <span class="Latn" lang="sv">[[sams#Swedish|sams]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | ''Ind. plural''<sup>1</sup> | <span class="Latn" lang="sv">[[simma#Swedish|simma]]</span> | <span class="Latn" lang="sv">[[summo#Swedish|summo]]</span> | <span class="Latn" lang="sv">[[simmas#Swedish|simmas]]</span> | <span class="Latn" lang="sv">[[summos#Swedish|summos]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | ''Subjunctive''<sup>2</sup> | <span class="Latn" lang="sv">[[simme#Swedish|simme]]</span> | <span class="Latn" lang="sv">[[summe#Swedish|summe]]</span> | <span class="Latn" lang="sv">[[simmes#Swedish|simmes]]</span> | <span class="Latn" lang="sv">[[summes#Swedish|summes]]</span> |- ! ! colspan="4" style="width%3A+100%25%3B+background-color%3A%23EFEFEF%3B" | Participles |- ! style="background-color%3A%23EFEFEF%3B" | Present participle | colspan="4" | <span class="Latn" lang="sv">[[simmande#Swedish|simmande]]</span> |- ! style="background-color%3A%23EFEFEF%3B" | Past participle | colspan="4" | <span class="Latn" lang="sv">[[summen#Swedish|summen]]</span> |- | colspan="5" style="text-align%3A+left%3B" | <small><sup>1</sup> Archaic. <sup>2</sup> Dated. See [[Appendix:Swedish verbs#Dated and archaic forms|the appendix on Swedish verbs]].</small> |} </div></div>[[Category:Swedish strong verbs|SIMMA]][[Category:Swedish class 3 strong verbs|SIMMA]] """) expected = { "forms": [{ "form": "weak", "source": "Conjugation", "tags": ["table-tags"] }, { "form": "simma", "source": "Conjugation", "tags": ["active", "infinitive"] }, { "form": "simmas", "source": "Conjugation", "tags": ["infinitive", "passive"] }, { "form": "simmat", "source": "Conjugation", "tags": ["active", "supine"] }, { "form": "simmats", "source": "Conjugation", "tags": ["passive", "supine"] }, { "form": "simma", "source": "Conjugation", "tags": ["active", "imperative"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['imperative', 'passive'] }, { "form": "simmen", "source": "Conjugation", "tags": ["active", "archaic", "imperative", "plural"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['archaic', 'imperative', 'passive', 'plural'] }, { "form": "simmar", "source": "Conjugation", "tags": ["active", "indicative", "present"] }, { "form": "simmade", "source": "Conjugation", "tags": ["active", "indicative", "past"] }, { "form": "simmas", "source": "Conjugation", "tags": ["indicative", "passive", "present"] }, { "form": "simmades", "source": "Conjugation", "tags": ["indicative", "passive", "past"] }, { "form": "simma", "source": "Conjugation", "tags": ["active", "archaic", "indicative", "plural", "present"] }, { "form": "simmade", "source": "Conjugation", "tags": ["active", "archaic", "indicative", "past", "plural"] }, { "form": "simmas", "source": "Conjugation", "tags": ["archaic", "indicative", "passive", "plural", "present"] }, { "form": "simmades", "source": "Conjugation", "tags": ["archaic", "indicative", "passive", "past", "plural"] }, { "form": "simme", "source": "Conjugation", "tags": ["active", "dated", "present", "subjunctive"] }, { "form": "simmade", "source": "Conjugation", "tags": ["active", "dated", "past", "subjunctive"] }, { "form": "simmes", "source": "Conjugation", "tags": ["dated", "passive", "present", "subjunctive"] }, { "form": "simmades", "source": "Conjugation", "tags": ["dated", "passive", "past", "subjunctive"] }, { "form": "simmande", "source": "Conjugation", "tags": ["participle", "present"] }, { "form": "simmad", "source": "Conjugation", "tags": ["participle", "past"] }, { "form": "strong", "source": "Conjugation", "tags": ["table-tags"] }, { "form": "3 strong", "source": "Conjugation", "tags": ["class"] }, { "form": "simma", "source": "Conjugation", "tags": ["active", "infinitive"] }, { "form": "simmas", "source": "Conjugation", "tags": ["infinitive", "passive"] }, { "form": "summit", "source": "Conjugation", "tags": ["active", "supine"] }, { "form": "summits", "source": "Conjugation", "tags": ["passive", "supine"] }, { "form": "sim", "source": "Conjugation", "tags": ["active", "imperative"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['imperative', 'passive'] }, { 'form': 'simmen', 'source': 'Conjugation', 'tags': ['active', 'archaic', 'imperative', 'plural'] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['archaic', 'imperative', 'passive', 'plural'] }, { "form": "simmer", "source": "Conjugation", "tags": ["active", "indicative", "present"] }, { "form": "sam", "source": "Conjugation", "tags": ["active", "indicative", "past"] }, { "form": "sims", "source": "Conjugation", "tags": ["indicative", "passive", "present"] }, { "form": "simmes", "source": "Conjugation", "tags": ["indicative", "passive", "present"] }, { "form": "sams", "source": "Conjugation", "tags": ["indicative", "passive", "past"] }, { 'form': 'simma', 'source': 'Conjugation', 'tags': ['active', 'archaic', 'indicative', 'plural', 'present'] }, { "form": "summo", "source": "Conjugation", "tags": ["active", "archaic", "indicative", "past", "plural"] }, { 'form': 'simmas', 'source': 'Conjugation', 'tags': ['archaic', 'indicative', 'passive', 'plural', 'present'] }, { "form": "summos", "source": "Conjugation", "tags": ["archaic", "indicative", "passive", "past", "plural"] }, { 'form': 'simme', 'source': 'Conjugation', 'tags': ['active', 'dated', 'present', 'subjunctive'] }, { "form": "summe", "source": "Conjugation", "tags": ["active", "dated", "past", "subjunctive"] }, { 'form': 'simmes', 'source': 'Conjugation', 'tags': ['dated', 'passive', 'present', 'subjunctive'] }, { "form": "summes", "source": "Conjugation", "tags": ["dated", "passive", "past", "subjunctive"] }, { 'form': 'simmande', 'source': 'Conjugation', 'tags': ['participle', 'present'] }, { "form": "summen", "source": "Conjugation", "tags": ["participle", "past"] }], } self.assertEqual(expected, ret) def test_Swedish_adj1(self): ret = self.xinfl( "vacker", "Swedish", "adj", "Declension", """ {| class="inflection-table+vsSwitcher" data-toggle-category="inflection" style="border%3A+solid+1px+%23CCCCFF%3B+text-align%3Aleft%3B" cellspacing="1" cellpadding="2" |- style="background%3A+%23CCCCFF%3B+vertical-align%3A+top%3B" ! class="vsToggleElement" colspan="4" | Inflection of <i class="Latn+mention" lang="sv">vacker</i> |- class="vsHide" style="background%3A+%23CCCCFF%3B" ! style="min-width%3A+12em%3B" | Indefinite ! style="min-width%3A+12em%3B" | Positive ! style="min-width%3A+12em%3B" | Comparative ! style="min-width%3A+12em%3B" | Superlative<sup>2</sup> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Common singular | <span class="Latn" lang="sv">[[vacker#Swedish|vacker]]</span> | <span class="Latn" lang="sv">[[vackrare#Swedish|vackrare]]</span> | <span class="Latn" lang="sv">[[vackrast#Swedish|vackrast]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Neuter singular | <span class="Latn" lang="sv">[[vackert#Swedish|vackert]]</span> | <span class="Latn" lang="sv">[[vackrare#Swedish|vackrare]]</span> | <span class="Latn" lang="sv">[[vackrast#Swedish|vackrast]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Plural | <span class="Latn" lang="sv">[[vackra#Swedish|vackra]]</span> | <span class="Latn" lang="sv">[[vackrare#Swedish|vackrare]]</span> | <span class="Latn" lang="sv">[[vackrast#Swedish|vackrast]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Masculine plural<sup>3</sup> | <span class="Latn" lang="sv">[[vackre#Swedish|vackre]]</span> | <span class="Latn" lang="sv">[[vackrare#Swedish|vackrare]]</span> | <span class="Latn" lang="sv">[[vackrast#Swedish|vackrast]]</span> |- class="vsHide" style="background%3A+%23CCCCFF%3B" ! Definite ! Positive ! Comparative ! Superlative |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Masculine singular<sup>1</sup> | <span class="Latn" lang="sv">[[vackre#Swedish|vackre]]</span> | <span class="Latn" lang="sv">[[vackrare#Swedish|vackrare]]</span> | <span class="Latn" lang="sv">[[vackraste#Swedish|vackraste]]</span> |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | All | <span class="Latn" lang="sv">[[vackra#Swedish|vackra]]</span> | <span class="Latn" lang="sv">[[vackrare#Swedish|vackrare]]</span> | <span class="Latn" lang="sv">[[vackraste#Swedish|vackraste]]</span> |- class="vsHide" style="background%3A+%23E6E6FF%3B" | style="font-size%3A+smaller%3B" colspan="4" | 1) Only used, optionally, to refer to things whose natural gender is masculine.<br>2) The indefinite superlative forms are only used in the predicative.<br>3) Dated or archaic |} """) expected = { "forms": [{ "form": "", "source": "Declension", "tags": ["table-tags"] }, { "form": "vacker", "source": "Declension", "tags": ["common-gender", "indefinite", "positive", "singular"] }, { "form": "vackrare", "source": "Declension", "tags": ["common-gender", "comparative", "indefinite", "singular"] }, { "form": "vackrast", "source": "Declension", "tags": ["common-gender", "indefinite", "singular", "superlative"] }, { "form": "vackert", "source": "Declension", "tags": ["indefinite", "neuter", "positive", "singular"] }, { "form": "vackrare", "source": "Declension", "tags": ["comparative", "indefinite", "neuter", "singular"] }, { "form": "vackrast", "source": "Declension", "tags": ["indefinite", "neuter", "singular", "superlative"] }, { "form": "vackra", "source": "Declension", "tags": ["indefinite", "plural", "positive"] }, { "form": "vackrare", "source": "Declension", "tags": ["comparative", "indefinite", "plural"] }, { "form": "vackrast", "source": "Declension", "tags": ["indefinite", "plural", "superlative"] }, { "form": "vackre", "source": "Declension", "tags": ["indefinite", "masculine", "plural", "positive"] }, { "form": "vackrare", "source": "Declension", "tags": ["comparative", "indefinite", "masculine", "plural"] }, { "form": "vackrast", "source": "Declension", "tags": ["indefinite", "masculine", "plural", "superlative"] }, { "form": "vackre", "source": "Declension", "tags": ["definite", "masculine", "positive", "singular"] }, { "form": "vackrare", "source": "Declension", "tags": ["comparative", "definite", "masculine", "singular"] }, { "form": "vackraste", "source": "Declension", "tags": ["definite", "masculine", "singular", "superlative"] }, { "form": "vackra", "source": "Declension", "tags": ["definite", "positive"] }, { "form": "vackrare", "source": "Declension", "tags": ["comparative", "definite"] }, { "form": "vackraste", "source": "Declension", "tags": ["definite", "superlative"] }], } self.assertEqual(expected, ret) def test_Swedish_noun2(self): ret = self.xinfl( "mos", "Swedish", "noun", "Declension", """ {| class="inflection-table+vsSwitcher" data-toggle-category="inflection" style="border%3A+solid+1px+%23CCCCFF%3B+text-align%3Aleft%3B" cellspacing="1" cellpadding="2" |- style="background%3A+%23CCCCFF%3B+vertical-align%3Atop%3B" ! class="vsToggleElement" colspan="5" | Declension of <i class="Latn+mention" lang="sv">[[mos#Swedish|mos]]</i> |- class="vsHide" style="background%3A+%23CCCCFF%3B" ! rowspan="2" style="min-width%3A+12em%3B" | ! colspan="2" | Uncountable ! colspan="2" | |- class="vsHide" style="background%3A+%23CCCCFF%3B" ! style="min-width%3A+12em%3B" | Indefinite ! style="min-width%3A+12em%3B" | Definite ! style="min-width%3A+12em%3B" | ! style="min-width%3A+12em%3B" | |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Nominative | <span class="Latn+form-of+lang-sv+indef%7Cnom%7Cs-form-of+++++++" lang="sv">[[mos#Swedish|mos]]</span> | <span class="Latn+form-of+lang-sv+def%7Cnom%7Cs-form-of+++++++" lang="sv">[[moset#Swedish|moset]]</span> | — | — |- class="vsHide" style="background%3A+%23F2F2FF%3B" ! style="background%3A+%23E6E6FF%3B" | Genitive | <span class="Latn+form-of+lang-sv+indef%7Cgen%7Cs-form-of+++++++" lang="sv">[[mos#Swedish|mos]]</span> | <span class="Latn+form-of+lang-sv+def%7Cgen%7Cs-form-of+++++++" lang="sv">[[mosets#Swedish|mosets]]</span> | — | — |} [[Category:Swedish nouns]] """) expected = { "forms": [{ "form": "", "source": "Declension", "tags": ["table-tags"] }, { "form": "mos", "source": "Declension", "tags": ["indefinite", "nominative", "uncountable"] }, { "form": "moset", "source": "Declension", "tags": ["definite", "nominative", "uncountable"] }, { "form": "mos", "source": "Declension", "tags": ["genitive", "indefinite", "uncountable"] }, { "form": "mosets", "source": "Declension", "tags": ["definite", "genitive", "uncountable"] }], } self.assertEqual(expected, ret)
def setUp(self): self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage")
class InflTests(unittest.TestCase): def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def xinfl(self, word, lang, pos, section, text): """Runs a single inflection table parsing test, and returns ``data``.""" self.ctx.start_page(word) self.ctx.start_section(lang) self.ctx.start_subsection(pos) tree = self.ctx.parse(text) data = {} parse_inflection_section(self.config, self.ctx, data, word, lang, pos, section, tree) return data def test_Lombard_verb1(self): # The main point is to test global annotations from table header # going into the forms ret = self.xinfl( "baià", "Lombard", "verb", "Conjugation", """ <div class="NavFrame" style="text-align%3Acenter"><div class="NavHead">[[File:Flag of Milan.svg|20px]] Western Lombard conjugation of baià ([[:Category:Lombard transitive verbs|transitive]])</div><div class="NavContent"> {| style="text-align%3Acenter%3Bbackground%3A%23F9F9F9" |- ! colspan="3" style="background%3A%23e2e4c0" |infinitive | colspan="7" |<span class="Latn" lang="lmo">[[baià#Lombard|baià]]</span> |- ! colspan="3" style="background%3A%23e2e4c0" |gerund | colspan="7" |<span class="Latn" lang="lmo">[[baiànd#Lombard|baiànd]], [[baiàndo#Lombard|baiàndo]]</span> |- ! colspan="3" style="background%3A%23e2e4c0" |past participle | colspan="7" |<span class="Latn" lang="lmo">[[baiàa#Lombard|baiàa]]</span> |- ! colspan="3" style="background%3A%23e2e4c0" |auxiliary verb | colspan="7" |<span class="Latn" lang="lmo">[[avè#Lombard|avè]]</span> |- ! rowspan="2" colspan="2" style="background%3A%23DEDEDE" | ! colspan="3" style="background%3A%23DEDEDE" |singular ! colspan="3" style="background%3A%23DEDEDE" |plural |- ! style="background%3A%23DEDEDE" |first ! style="background%3A%23DEDEDE" |second ! style="background%3A%23DEDEDE" |third ! style="background%3A%23DEDEDE" |first ! style="background%3A%23DEDEDE" |second ! style="background%3A%23DEDEDE" |third |- ! rowspan="4" style="background%3A%23c0cfe4" |indicative ! style="background%3A%23c0cfe4" | ! style="background%3A%23c0cfe4" |mì ! style="background%3A%23c0cfe4" |tì te ! style="background%3A%23c0cfe4" |lù el / lee la ! style="background%3A%23c0cfe4" |nun ! style="background%3A%23c0cfe4" |violter / vialter ! style="background%3A%23c0cfe4" |lor |- ! style="background%3A%23c0cfe4%3Bheight%3A3em" |present |<span class="Latn" lang="lmo">[[bàii#Lombard|bàii]]</span> |<span class="Latn" lang="lmo">[[bàiet#Lombard|bàiet]]</span> |<span class="Latn" lang="lmo">[[bàia#Lombard|bàia]]</span> |<span class="Latn" lang="lmo">[[bàiom#Lombard|bàiom]]</span> |<span class="Latn" lang="lmo">[[bàiov#Lombard|bàiov]], [[baiee#Lombard|baiee]]</span> |<span class="Latn" lang="lmo">[[bàien#Lombard|bàien]]</span> |- ! style="background%3A%23c0cfe4%3Bheight%3A3em" |imperfect |<span class="Latn" lang="lmo">[[baiàvi#Lombard|baiàvi]]</span> |<span class="Latn" lang="lmo">[[baiàvet#Lombard|baiàvet]]</span> |<span class="Latn" lang="lmo">[[baiàva#Lombard|baiàva]]</span> |<span class="Latn" lang="lmo">[[baiàvom#Lombard|baiàvom]]</span> |<span class="Latn" lang="lmo">[[baiàvov#Lombard|baiàvov]]</span> |<span class="Latn" lang="lmo">[[baiàven#Lombard|baiàven]]</span> |- ! style="background%3A%23c0cfe4%3Bheight%3A3em" |future |<span class="Latn" lang="lmo">[[baiaróo#Lombard|baiaróo]]</span> |<span class="Latn" lang="lmo">[[baiaré#Lombard|baiaré]], [[baiarét#Lombard|baiarét]]</span> |<span class="Latn" lang="lmo">[[baiarà#Lombard|baiarà]]</span> |<span class="Latn" lang="lmo">[[baiarèmm#Lombard|baiarèmm]]</span> |<span class="Latn" lang="lmo">[[baiarii#Lombard|baiarii]]</span> |<span class="Latn" lang="lmo">[[baiarànn#Lombard|baiarànn]]</span> |- ! rowspan="2" style="background%3A%23c0d8e4" |conditional ! style="background%3A%23c0d8e4" | ! style="background%3A%23c0d8e4" |mì ! style="background%3A%23c0d8e4" |tì te ! style="background%3A%23c0d8e4" |lù el / lee la ! style="background%3A%23c0d8e4" |nun ! style="background%3A%23c0d8e4" |violter / vialter ! style="background%3A%23c0d8e4" |lor |- ! style="background%3A%23c0d8e4%3Bheight%3A3em" |present |<span class="Latn" lang="lmo">[[baiarìa#Lombard|baiarìa]], [[baiarìss#Lombard|baiarìss]], [[baiarìssi#Lombard|baiarìssi]]</span> |<span class="Latn" lang="lmo">[[baiarìet#Lombard|baiarìet]], [[baiarìsset#Lombard|baiarìsset]]</span> |<span class="Latn" lang="lmo">[[baiarìa#Lombard|baiarìa]], [[baiarìss#Lombard|baiarìss]]</span> |<span class="Latn" lang="lmo">[[baiarìom#Lombard|baiarìom]], [[baiarìssom#Lombard|baiarìssom]]</span> |<span class="Latn" lang="lmo">[[baiarìov#Lombard|baiarìov]], [[baiarìssov#Lombard|baiarìssov]]</span> |<span class="Latn" lang="lmo">[[baiarìen#Lombard|baiarìen]], [[baiarìssen#Lombard|baiarìssen]]</span> |- ! rowspan="3" style="background%3A%23c0e4c0" |subjunctive ! style="background%3A%23c0e4c0" | ! style="background%3A%23c0e4c0" |(che) mì ! style="background%3A%23c0e4c0" |(che) tì te ! style="background%3A%23c0e4c0" |(che) lù el / lee la ! style="background%3A%23c0e4c0" |(che) nun ! style="background%3A%23c0e4c0" |(che) violter / vialter ! style="background%3A%23c0e4c0" |(che) lor |- ! style="background%3A%23c0e4c0%3Bheight%3A3em" |present |<span class="Latn" lang="lmo">[[bàii#Lombard|bàii]]</span> |<span class="Latn" lang="lmo">[[bàiet#Lombard|bàiet]]</span> |<span class="Latn" lang="lmo">[[bàia#Lombard|bàia]]</span> |<span class="Latn" lang="lmo">[[bàiom#Lombard|bàiom]]</span> |<span class="Latn" lang="lmo">[[bàiov#Lombard|bàiov]], [[baiii#Lombard|baiii]]</span> |<span class="Latn" lang="lmo">[[bàien#Lombard|bàien]]</span> |- ! style="background%3A%23c0e4c0%3Bheight%3A3em" |past |<span class="Latn" lang="lmo">[[baiàssi#Lombard|baiàssi]]</span> |<span class="Latn" lang="lmo">[[baiàsset#Lombard|baiàsset]]</span> |<span class="Latn" lang="lmo">[[baiàss#Lombard|baiàss]]</span> |<span class="Latn" lang="lmo">[[baiàssom#Lombard|baiàssom]]</span> |<span class="Latn" lang="lmo">[[baiàssov#Lombard|baiàssov]]</span> |<span class="Latn" lang="lmo">[[baiàssen#Lombard|baiàssen]]</span> |- ! colspan="2" rowspan="2" style="background%3A%23e4d4c0" |imperative ! style="background%3A%23e4d4c0" |– ! style="background%3A%23e4d4c0" |<del>tì</del> ! style="background%3A%23e4d4c0" |<del>lù / lee</del><br>che el ! style="background%3A%23e4d4c0" |<del>nun</del> ! style="background%3A%23e4d4c0" |<del>violter / vialter</del> ! style="background%3A%23e4d4c0" |<del>lor</del><br>che el |- |– |<span class="Latn" lang="lmo">[[bàia#Lombard|bàia]]</span> |<span class="Latn" lang="lmo">[[bàia#Lombard|bàia]]</span> |<span class="Latn" lang="lmo">[[baièmm#Lombard|baièmm]]</span> |<span class="Latn" lang="lmo">[[baiee#Lombard|baiee]]</span> |<span class="Latn" lang="lmo">[[bàien#Lombard|bàien]]</span> |} </div></div><div class="NavFrame" style="text-align%3Acenter"><div class="NavHead">[[File:Flag of Bergamo.svg|20px]] Eastern Lombard conjugation of baià ([[:Category:Lombard transitive verbs|transitive]])</div><div class="NavContent"> {| style="text-align%3Acenter%3Bbackground%3A%23F9F9F9" |- ! colspan="3" style="background%3A%23e2e4c0" |infinitive | colspan="7" |<span class="Latn" lang="lmo">[[baià#Lombard|baià]]</span> |- ! colspan="3" style="background%3A%23e2e4c0" |past participle | colspan="7" |<span class="Latn" lang="lmo">[[baiàt#Lombard|baiàt]]</span> |- ! colspan="3" style="background%3A%23e2e4c0" |auxiliary verb | colspan="7" |<span class="Latn" lang="lmo">[[ìga#Lombard|ìga]]</span> |- ! rowspan="2" colspan="2" style="background%3A%23DEDEDE" | ! colspan="3" style="background%3A%23DEDEDE" |singular ! colspan="3" style="background%3A%23DEDEDE" |plural |- ! style="background%3A%23DEDEDE" |first ! style="background%3A%23DEDEDE" |second ! style="background%3A%23DEDEDE" |third ! style="background%3A%23DEDEDE" |first ! style="background%3A%23DEDEDE" |second ! style="background%3A%23DEDEDE" |third |- ! rowspan="4" style="background%3A%23c0cfe4" |indicative ! style="background%3A%23c0cfe4" | ! style="background%3A%23c0cfe4" |mé ! style="background%3A%23c0cfe4" |té ! style="background%3A%23c0cfe4" |lü / le ! style="background%3A%23c0cfe4" |nóter ! style="background%3A%23c0cfe4" |vóter ! style="background%3A%23c0cfe4" |lur / lùre |- ! style="background%3A%23c0cfe4%3Bheight%3A3em" |present |<span class="Latn" lang="lmo">[[bàie#Lombard|bàie]]</span> |<span class="Latn" lang="lmo">[[bàiet#Lombard|bàiet]]</span> |<span class="Latn" lang="lmo">[[bàia#Lombard|bàia]]</span> |<span class="Latn" lang="lmo">[[baióm#Lombard|baióm]]</span> |<span class="Latn" lang="lmo">[[baiìf#Lombard|baiìf]]</span> |<span class="Latn" lang="lmo">[[bàia#Lombard|bàia]]</span> |- ! style="background%3A%23c0cfe4%3Bheight%3A3em" |imperfect |<span class="Latn" lang="lmo">[[baiàe#Lombard|baiàe]]</span> |<span class="Latn" lang="lmo">[[baiàet#Lombard|baiàet]]</span> |<span class="Latn" lang="lmo">[[baiàa#Lombard|baiàa]]</span> |<span class="Latn" lang="lmo">[[baiàem#Lombard|baiàem]]</span> |<span class="Latn" lang="lmo">[[baiàef#Lombard|baiàef]]</span> |<span class="Latn" lang="lmo">[[baiàa#Lombard|baiàa]]</span> |- ! style="background%3A%23c0cfe4%3Bheight%3A3em" |future |<span class="Latn" lang="lmo">[[baiaró#Lombard|baiaró]]</span> |<span class="Latn" lang="lmo">[[baiarét#Lombard|baiarét]]</span> |<span class="Latn" lang="lmo">[[baiarà#Lombard|baiarà]]</span> |<span class="Latn" lang="lmo">[[baiaróm#Lombard|baiaróm]]</span> |<span class="Latn" lang="lmo">[[baiarìf#Lombard|baiarìf]]</span> |<span class="Latn" lang="lmo">[[baiarà#Lombard|baiarà]]</span> |- ! rowspan="2" style="background%3A%23c0d8e4" |conditional ! style="background%3A%23c0d8e4" | ! style="background%3A%23c0d8e4" |mé ! style="background%3A%23c0d8e4" |té ! style="background%3A%23c0d8e4" |lü / lé ! style="background%3A%23c0d8e4" |nóter ! style="background%3A%23c0d8e4" |vóter ! style="background%3A%23c0d8e4" |lur / lúre |- ! style="background%3A%23c0d8e4%3Bheight%3A3em" |present |<span class="Latn" lang="lmo">[[baiarèse#Lombard|baiarèse]]</span> |<span class="Latn" lang="lmo">[[baiarèset#Lombard|baiarèset]]</span> |<span class="Latn" lang="lmo">[[baiarès#Lombard|baiarès]]</span> |<span class="Latn" lang="lmo">[[baiarèsem#Lombard|baiarèsem]]</span> |<span class="Latn" lang="lmo">[[baiarèsef#Lombard|baiarèsef]]</span> |<span class="Latn" lang="lmo">[[baiarès#Lombard|baiarès]]</span> |- ! rowspan="3" style="background%3A%23c0e4c0" |subjunctive ! style="background%3A%23c0e4c0" | ! style="background%3A%23c0e4c0" |(che) mé ! style="background%3A%23c0e4c0" |(che) té ! style="background%3A%23c0e4c0" |(che) lü / lé ! style="background%3A%23c0e4c0" |(che) nóter ! style="background%3A%23c0e4c0" |(che) vóter ! style="background%3A%23c0e4c0" |(che) lur / lùre |- ! style="background%3A%23c0e4c0%3Bheight%3A3em" |present |<span class="Latn" lang="lmo">[[bàies#Lombard|bàies]]</span> |<span class="Latn" lang="lmo">[[bàies#Lombard|bàies]]</span> |<span class="Latn" lang="lmo">[[bàie#Lombard|bàie]]</span> |<span class="Latn" lang="lmo">[[baiómes#Lombard|baiómes]]</span> |<span class="Latn" lang="lmo">[[baiìghes#Lombard|baiìghes]]</span> |<span class="Latn" lang="lmo">[[bàie#Lombard|bàie]]</span> |- ! style="background%3A%23c0e4c0%3Bheight%3A3em" |past |<span class="Latn" lang="lmo">[[baièse#Lombard|baièse]]</span> |<span class="Latn" lang="lmo">[[baièset#Lombard|baièset]]</span> |<span class="Latn" lang="lmo">[[baiès#Lombard|baiès]]</span> |<span class="Latn" lang="lmo">[[baièsem#Lombard|baièsem]]</span> |<span class="Latn" lang="lmo">[[baièsef#Lombard|baièsef]]</span> |<span class="Latn" lang="lmo">[[baiès#Lombard|baiès]]</span> |- ! colspan="2" style="background%3A%23e4d4c0" |imperative ! style="background%3A%23e4d4c0" |– ! style="background%3A%23e4d4c0" |<del>té</del> ! style="background%3A%23e4d4c0" |– ! style="background%3A%23e4d4c0" |<del>nóter</del> ! style="background%3A%23e4d4c0" |<del>vóter</del> ! style="background%3A%23e4d4c0" |– |- | colspan="2" style="background%3A%23e4d4c0" | |– |<span class="Latn" lang="lmo">[[bàia#Lombard|bàia]]</span> |– |<span class="Latn" lang="lmo">[[baiómm#Lombard|baiómm]]</span> |<span class="Latn" lang="lmo">[[baiì#Lombard|baiì]]</span> |– |} </div></div> """) expected = { "forms": [{ "form": "Western-Lombard transitive", "source": "Conjugation", "tags": ["table-tags"] }, { "form": "baià", "source": "Conjugation", "tags": ["infinitive"] }, { "form": "baiànd", "source": "Conjugation", "tags": ["gerund"] }, { "form": "baiàndo", "source": "Conjugation", "tags": ["gerund"] }, { "form": "baiàa", "source": "Conjugation", "tags": ["participle", "past"] }, { "form": "avè", "source": "Conjugation", "tags": ["auxiliary"] }, { "form": "bàii", "source": "Conjugation", "tags": ["first-person", "indicative", "present", "singular"] }, { "form": "bàiet", "source": "Conjugation", "tags": ["indicative", "present", "second-person", "singular"] }, { "form": "bàia", "source": "Conjugation", "tags": ["indicative", "present", "singular", "third-person"] }, { "form": "bàiom", "source": "Conjugation", "tags": ["first-person", "indicative", "plural", "present"] }, { "form": "bàiov", "source": "Conjugation", "tags": ["indicative", "plural", "present", "second-person"] }, { "form": "baiee", "source": "Conjugation", "tags": ["indicative", "plural", "present", "second-person"] }, { "form": "bàien", "source": "Conjugation", "tags": ["indicative", "plural", "present", "third-person"] }, { "form": "baiàvi", "source": "Conjugation", "tags": ["first-person", "imperfect", "indicative", "singular"] }, { "form": "baiàvet", "source": "Conjugation", "tags": ["imperfect", "indicative", "second-person", "singular"] }, { "form": "baiàva", "source": "Conjugation", "tags": ["imperfect", "indicative", "singular", "third-person"] }, { "form": "baiàvom", "source": "Conjugation", "tags": ["first-person", "imperfect", "indicative", "plural"] }, { "form": "baiàvov", "source": "Conjugation", "tags": ["imperfect", "indicative", "plural", "second-person"] }, { "form": "baiàven", "source": "Conjugation", "tags": ["imperfect", "indicative", "plural", "third-person"] }, { "form": "baiaróo", "source": "Conjugation", "tags": ["first-person", "future", "indicative", "singular"] }, { "form": "baiaré", "source": "Conjugation", "tags": ["future", "indicative", "second-person", "singular"] }, { "form": "baiarét", "source": "Conjugation", "tags": ["future", "indicative", "second-person", "singular"] }, { "form": "baiarà", "source": "Conjugation", "tags": ["future", "indicative", "singular", "third-person"] }, { "form": "baiarèmm", "source": "Conjugation", "tags": ["first-person", "future", "indicative", "plural"] }, { "form": "baiarii", "source": "Conjugation", "tags": ["future", "indicative", "plural", "second-person"] }, { "form": "baiarànn", "source": "Conjugation", "tags": ["future", "indicative", "plural", "third-person"] }, { "form": "baiarìa", "source": "Conjugation", "tags": ["conditional", "first-person", "present", "singular"] }, { "form": "baiarìss", "source": "Conjugation", "tags": ["conditional", "first-person", "present", "singular"] }, { "form": "baiarìssi", "source": "Conjugation", "tags": ["conditional", "first-person", "present", "singular"] }, { "form": "baiarìet", "source": "Conjugation", "tags": ["conditional", "present", "second-person", "singular"] }, { "form": "baiarìsset", "source": "Conjugation", "tags": ["conditional", "present", "second-person", "singular"] }, { "form": "baiarìa", "source": "Conjugation", "tags": ["conditional", "present", "singular", "third-person"] }, { "form": "baiarìss", "source": "Conjugation", "tags": ["conditional", "present", "singular", "third-person"] }, { "form": "baiarìom", "source": "Conjugation", "tags": ["conditional", "first-person", "plural", "present"] }, { "form": "baiarìssom", "source": "Conjugation", "tags": ["conditional", "first-person", "plural", "present"] }, { "form": "baiarìov", "source": "Conjugation", "tags": ["conditional", "plural", "present", "second-person"] }, { "form": "baiarìssov", "source": "Conjugation", "tags": ["conditional", "plural", "present", "second-person"] }, { "form": "baiarìen", "source": "Conjugation", "tags": ["conditional", "plural", "present", "third-person"] }, { "form": "baiarìssen", "source": "Conjugation", "tags": ["conditional", "plural", "present", "third-person"] }, { "form": "bàii", "source": "Conjugation", "tags": ["first-person", "present", "singular", "subjunctive"] }, { "form": "bàiet", "source": "Conjugation", "tags": ["present", "second-person", "singular", "subjunctive"] }, { "form": "bàia", "source": "Conjugation", "tags": ["present", "singular", "subjunctive", "third-person"] }, { "form": "bàiom", "source": "Conjugation", "tags": ["first-person", "plural", "present", "subjunctive"] }, { "form": "bàiov", "source": "Conjugation", "tags": ["plural", "present", "second-person", "subjunctive"] }, { "form": "baiii", "source": "Conjugation", "tags": ["plural", "present", "second-person", "subjunctive"] }, { "form": "bàien", "source": "Conjugation", "tags": ["plural", "present", "subjunctive", "third-person"] }, { "form": "baiàssi", "source": "Conjugation", "tags": ["first-person", "past", "singular", "subjunctive"] }, { "form": "baiàsset", "source": "Conjugation", "tags": ["past", "second-person", "singular", "subjunctive"] }, { "form": "baiàss", "source": "Conjugation", "tags": ["past", "singular", "subjunctive", "third-person"] }, { "form": "baiàssom", "source": "Conjugation", "tags": ["first-person", "past", "plural", "subjunctive"] }, { "form": "baiàssov", "source": "Conjugation", "tags": ["past", "plural", "second-person", "subjunctive"] }, { "form": "baiàssen", "source": "Conjugation", "tags": ["past", "plural", "subjunctive", "third-person"] }, { "form": "bàia", "source": "Conjugation", "tags": ["imperative", "second-person", "singular"] }, { "form": "bàia", "source": "Conjugation", "tags": ["imperative", "singular", "third-person"] }, { "form": "baièmm", "source": "Conjugation", "tags": ["first-person", "imperative", "plural"] }, { "form": "baiee", "source": "Conjugation", "tags": ["imperative", "plural", "second-person"] }, { "form": "bàien", "source": "Conjugation", "tags": ["imperative", "plural", "third-person"] }, { "form": "Eastern-Lombard transitive", "source": "Conjugation", "tags": ["table-tags"] }, { "form": "baià", "source": "Conjugation", "tags": ["infinitive"] }, { "form": "baiàt", "source": "Conjugation", "tags": ["participle", "past"] }, { "form": "ìga", "source": "Conjugation", "tags": ["auxiliary"] }, { "form": "bàie", "source": "Conjugation", "tags": ["first-person", "indicative", "present", "singular"] }, { "form": "bàiet", "source": "Conjugation", "tags": ["indicative", "present", "second-person", "singular"] }, { "form": "bàia", "source": "Conjugation", "tags": ["indicative", "present", "singular", "third-person"] }, { "form": "baióm", "source": "Conjugation", "tags": ["first-person", "indicative", "plural", "present"] }, { "form": "baiìf", "source": "Conjugation", "tags": ["indicative", "plural", "present", "second-person"] }, { "form": "bàia", "source": "Conjugation", "tags": ["indicative", "plural", "present", "third-person"] }, { "form": "baiàe", "source": "Conjugation", "tags": ["first-person", "imperfect", "indicative", "singular"] }, { "form": "baiàet", "source": "Conjugation", "tags": ["imperfect", "indicative", "second-person", "singular"] }, { "form": "baiàa", "source": "Conjugation", "tags": ["imperfect", "indicative", "singular", "third-person"] }, { "form": "baiàem", "source": "Conjugation", "tags": ["first-person", "imperfect", "indicative", "plural"] }, { "form": "baiàef", "source": "Conjugation", "tags": ["imperfect", "indicative", "plural", "second-person"] }, { "form": "baiàa", "source": "Conjugation", "tags": ["imperfect", "indicative", "plural", "third-person"] }, { "form": "baiaró", "source": "Conjugation", "tags": ["first-person", "future", "indicative", "singular"] }, { "form": "baiarét", "source": "Conjugation", "tags": ["future", "indicative", "second-person", "singular"] }, { "form": "baiarà", "source": "Conjugation", "tags": ["future", "indicative", "singular", "third-person"] }, { "form": "baiaróm", "source": "Conjugation", "tags": ["first-person", "future", "indicative", "plural"] }, { "form": "baiarìf", "source": "Conjugation", "tags": ["future", "indicative", "plural", "second-person"] }, { "form": "baiarà", "source": "Conjugation", "tags": ["future", "indicative", "plural", "third-person"] }, { "form": "baiarèse", "source": "Conjugation", "tags": ["conditional", "first-person", "present", "singular"] }, { "form": "baiarèset", "source": "Conjugation", "tags": ["conditional", "present", "second-person", "singular"] }, { "form": "baiarès", "source": "Conjugation", "tags": ["conditional", "present", "singular", "third-person"] }, { "form": "baiarèsem", "source": "Conjugation", "tags": ["conditional", "first-person", "plural", "present"] }, { "form": "baiarèsef", "source": "Conjugation", "tags": ["conditional", "plural", "present", "second-person"] }, { "form": "baiarès", "source": "Conjugation", "tags": ["conditional", "plural", "present", "third-person"] }, { "form": "bàies", "source": "Conjugation", "tags": ["first-person", "present", "singular", "subjunctive"] }, { "form": "bàies", "source": "Conjugation", "tags": ["present", "second-person", "singular", "subjunctive"] }, { "form": "bàie", "source": "Conjugation", "tags": ["present", "singular", "subjunctive", "third-person"] }, { "form": "baiómes", "source": "Conjugation", "tags": ["first-person", "plural", "present", "subjunctive"] }, { "form": "baiìghes", "source": "Conjugation", "tags": ["plural", "present", "second-person", "subjunctive"] }, { "form": "bàie", "source": "Conjugation", "tags": ["plural", "present", "subjunctive", "third-person"] }, { "form": "baièse", "source": "Conjugation", "tags": ["first-person", "past", "singular", "subjunctive"] }, { "form": "baièset", "source": "Conjugation", "tags": ["past", "second-person", "singular", "subjunctive"] }, { "form": "baiès", "source": "Conjugation", "tags": ["past", "singular", "subjunctive", "third-person"] }, { "form": "baièsem", "source": "Conjugation", "tags": ["first-person", "past", "plural", "subjunctive"] }, { "form": "baièsef", "source": "Conjugation", "tags": ["past", "plural", "second-person", "subjunctive"] }, { "form": "baiès", "source": "Conjugation", "tags": ["past", "plural", "subjunctive", "third-person"] }, { "form": "bàia", "source": "Conjugation", "tags": ["imperative", "second-person", "singular"] }, { "form": "baiómm", "source": "Conjugation", "tags": ["first-person", "imperative", "plural"] }, { "form": "baiì", "source": "Conjugation", "tags": ["imperative", "plural", "second-person"] }], } self.assertEqual(expected, ret)
class InflTests(unittest.TestCase): def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def xinfl(self, word, lang, pos, section, text): """Runs a single inflection table parsing test, and returns ``data``.""" self.ctx.start_page(word) self.ctx.start_section(lang) self.ctx.start_subsection(pos) tree = self.ctx.parse(text) data = {} parse_inflection_section(self.config, self.ctx, data, word, lang, pos, section, tree) return data def test_Portuguese_verb1(self): ret = self.xinfl( "viajar", "Portuguese", "verb", "Conjugation", """ <div class="NavFrame" style="clear%3Aboth%3B+white-space%3A+nowrap"> <div class="NavHead"> Conjugation of the [[Appendix:Portuguese verbs|Portuguese ''-ar'' verb]] ''viajar''</div> <div class="NavContent" align="left"> {| class="inflection-table" style="background%3A%23F6F6F6%3B+text-align%3A+left%3B+border%3A+1px+solid+%23999999%3B" cellpadding="3" cellspacing="0" |- | style="border%3A+1px+solid+%23999999%3B" colspan="7" | '''Notes''':<sup class="plainlinks">[//wiki.local/w/index.php?action=edit&title=Module%3Apt-conj%2Fdata%2F-ar [edit]]</sup> * This is a regular verb of the '''-ar''' group. * * Verbs with this conjugation include: <i class="Latn+mention" lang="pt">[[amar#Portuguese|amar]]</i>, <i class="Latn+mention" lang="pt">[[cantar#Portuguese|cantar]]</i>, <i class="Latn+mention" lang="pt">[[gritar#Portuguese|gritar]]</i>, <i class="Latn+mention" lang="pt">[[marchar#Portuguese|marchar]]</i>, <i class="Latn+mention" lang="pt">[[mostrar#Portuguese|mostrar]]</i>, <i class="Latn+mention" lang="pt">[[nadar#Portuguese|nadar]]</i>, <i class="Latn+mention" lang="pt">[[parar#Portuguese|parar]]</i>, <i class="Latn+mention" lang="pt">[[participar#Portuguese|participar]]</i>, <i class="Latn+mention" lang="pt">[[retirar#Portuguese|retirar]]</i>, <i class="Latn+mention" lang="pt">[[separar#Portuguese|separar]]</i>, <i class="Latn+mention" lang="pt">[[viajar#Portuguese|viajar]]</i>. |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23B0B0B0" rowspan="2" | ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0" colspan="3" | Singular ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0" colspan="3" | Plural |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0%3B+width%3A12.5%25" | First-person<br>([[eu#Portuguese|eu]]) ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0%3B+width%3A12.5%25" | Second-person<br>([[tu#Portuguese|tu]]) ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0%3B+width%3A12.5%25" | Third-person<br>([[ele#Portuguese|ele]] / [[ela#Portuguese|ela]] / [[você#Portuguese|você]]) ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0%3B+width%3A12.5%25" | First-person<br>([[nós#Portuguese|nós]]) ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0%3B+width%3A12.5%25" | Second-person<br>([[vós#Portuguese|vós]]) ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0%3B+width%3A12.5%25" | Third-person<br>([[eles#Portuguese|eles]] / [[elas#Portuguese|elas]] / [[vocês#Portuguese|vocês]]) |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23c498ff" colspan="7" | ''<span title="infinitivo">Infinitive</span>'' |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23a478df" | '''<span title="infinitivo+impessoal">Impersonal</span>''' | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" colspan="6" | <span class="Latn" lang="pt">[[viajar#Portuguese|viajar]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23a478df" | '''<span title="infinitivo+pessoal">Personal</span>''' | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajar#Portuguese|viajar]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajares#Portuguese|viajares]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajar#Portuguese|viajar]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajarmos#Portuguese|viajarmos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajardes#Portuguese|viajardes]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajarem#Portuguese|viajarem]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%2398ffc4" colspan="7" | ''<span title="ger%C3%BAndio">Gerund</span>'' |- | style="border%3A+1px+solid+%23999999%3B+background%3A%2378dfa4" | | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" colspan="6" | <span class="Latn" lang="pt">[[viajando#Portuguese|viajando]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23ffc498" colspan="7" | ''<span title="partic%C3%ADpio+passado">Past participle</span>'' |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23dfa478" | Masculine | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" colspan="3" | <span class="Latn" lang="pt">[[viajado#Portuguese|viajado]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" colspan="3" | <span class="Latn" lang="pt">[[viajados#Portuguese|viajados]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23dfa478" | Feminine | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" colspan="3" | <span class="Latn" lang="pt">[[viajada#Portuguese|viajada]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" colspan="3" | <span class="Latn" lang="pt">[[viajadas#Portuguese|viajadas]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23d0dff4" colspan="7" | ''<span title="indicativo">Indicative</span>'' |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0bfd4" | <span title="presente">Present</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajo#Portuguese|viajo]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajas#Portuguese|viajas]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viaja#Portuguese|viaja]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajamos#Portuguese|viajamos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajais#Portuguese|viajais]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajam#Portuguese|viajam]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0bfd4" | <span title="pret%C3%A9rito+imperfeito">Imperfect</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajava#Portuguese|viajava]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajavas#Portuguese|viajavas]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajava#Portuguese|viajava]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajávamos#Portuguese|viajávamos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajáveis#Portuguese|viajáveis]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajavam#Portuguese|viajavam]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0bfd4" | <span title="pret%C3%A9rito+perfeito">Preterite</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajei#Portuguese|viajei]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajaste#Portuguese|viajaste]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajou#Portuguese|viajou]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajamos#Portuguese|viajamos]]</span><br><span class="Latn" lang="pt">[[viajámos#Portuguese|viajámos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajastes#Portuguese|viajastes]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajaram#Portuguese|viajaram]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0bfd4" | <span title="pret%C3%A9rito+mais-que-perfeito+simples">Pluperfect</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajara#Portuguese|viajara]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajaras#Portuguese|viajaras]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajara#Portuguese|viajara]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajáramos#Portuguese|viajáramos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajáreis#Portuguese|viajáreis]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajaram#Portuguese|viajaram]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0bfd4" | <span title="futuro+do+presente">Future</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajarei#Portuguese|viajarei]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajarás#Portuguese|viajarás]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajará#Portuguese|viajará]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajaremos#Portuguese|viajaremos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajareis#Portuguese|viajareis]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajarão#Portuguese|viajarão]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23ffffaa" colspan="7" | ''<span title="condicional+%2F+futuro+do+pret%C3%A9rito">Conditional</span>'' |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23ddddaa" | | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajaria#Portuguese|viajaria]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajarias#Portuguese|viajarias]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajaria#Portuguese|viajaria]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajaríamos#Portuguese|viajaríamos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajaríeis#Portuguese|viajaríeis]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajariam#Portuguese|viajariam]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23d0f4d0" colspan="7" | ''<span title="conjuntivo+%28pt%29+%2F+subjuntivo+%28br%29">Subjunctive</span>'' |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0d4b0" | <span title="+presente+do+conjuntivo+%28pt%29+%2F+subjuntivo+%28br%29">Present</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viaje#Portuguese|viaje]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajes#Portuguese|viajes]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viaje#Portuguese|viaje]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajemos#Portuguese|viajemos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajeis#Portuguese|viajeis]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajem#Portuguese|viajem]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0d4b0" | <span title="pret%C3%A9rito+imperfeito+do+conjuntivo+%28pt%29+%2F+subjuntivo+%28br%29">Imperfect</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajasse#Portuguese|viajasse]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajasses#Portuguese|viajasses]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajasse#Portuguese|viajasse]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajássemos#Portuguese|viajássemos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajásseis#Portuguese|viajásseis]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajassem#Portuguese|viajassem]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0d4b0" | <span title="futuro+do+conjuntivo+%28pt%29+%2F+subjuntivo+%28br%29">Future</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajar#Portuguese|viajar]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajares#Portuguese|viajares]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajar#Portuguese|viajar]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajarmos#Portuguese|viajarmos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajardes#Portuguese|viajardes]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajarem#Portuguese|viajarem]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23f4e4d0" colspan="7" | ''<span title="imperativo">Imperative</span>'' |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23d4c4b0" | <span title="imperativo+afirmativo">Affirmative</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | - | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viaja#Portuguese|viaja]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viaje#Portuguese|viaje]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajemos#Portuguese|viajemos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajai#Portuguese|viajai]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajem#Portuguese|viajem]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23d4c4b0" | <span title="imperativo+negativo">Negative</span> ([[não#Portuguese|não]]) | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | - | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajes#Portuguese|viajes]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viaje#Portuguese|viaje]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajemos#Portuguese|viajemos]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajeis#Portuguese|viajeis]]</span> | style="border%3A+1px+solid+%23999999%3B+vertical-align%3A+top%3B" | <span class="Latn" lang="pt">[[viajem#Portuguese|viajem]]</span> |} </div> </div> """) expected = { "forms": [{ "form": "", "source": "Conjugation", "tags": ["table-tags"] }, { "form": "-ar verb", "source": "Conjugation", "tags": ["class"] }, { "form": "viajar", "source": "Conjugation", "tags": ["impersonal", "infinitive"] }, { "form": "viajar", "source": "Conjugation", "tags": ["first-person", "infinitive", "singular"] }, { "form": "viajares", "source": "Conjugation", "tags": ["infinitive", "second-person", "singular"] }, { "form": "viajar", "source": "Conjugation", "tags": ["infinitive", "singular", "third-person"] }, { "form": "viajarmos", "source": "Conjugation", "tags": ["first-person", "infinitive", "plural"] }, { "form": "viajardes", "source": "Conjugation", "tags": ["infinitive", "plural", "second-person"] }, { "form": "viajarem", "source": "Conjugation", "tags": ["infinitive", "plural", "third-person"] }, { "form": "viajando", "source": "Conjugation", "tags": ["gerund"] }, { "form": "viajado", "source": "Conjugation", "tags": ["masculine", "participle", "past", "singular"] }, { "form": "viajados", "source": "Conjugation", "tags": ["masculine", "participle", "past", "plural"] }, { "form": "viajada", "source": "Conjugation", "tags": ["feminine", "participle", "past", "singular"] }, { "form": "viajadas", "source": "Conjugation", "tags": ["feminine", "participle", "past", "plural"] }, { "form": "viajo", "source": "Conjugation", "tags": ["first-person", "indicative", "present", "singular"] }, { "form": "viajas", "source": "Conjugation", "tags": ["indicative", "present", "second-person", "singular"] }, { "form": "viaja", "source": "Conjugation", "tags": ["indicative", "present", "singular", "third-person"] }, { "form": "viajamos", "source": "Conjugation", "tags": ["first-person", "indicative", "plural", "present"] }, { "form": "viajais", "source": "Conjugation", "tags": ["indicative", "plural", "present", "second-person"] }, { "form": "viajam", "source": "Conjugation", "tags": ["indicative", "plural", "present", "third-person"] }, { "form": "viajava", "source": "Conjugation", "tags": ["first-person", "imperfect", "indicative", "singular"] }, { "form": "viajavas", "source": "Conjugation", "tags": ["imperfect", "indicative", "second-person", "singular"] }, { "form": "viajava", "source": "Conjugation", "tags": ["imperfect", "indicative", "singular", "third-person"] }, { "form": "viajávamos", "source": "Conjugation", "tags": ["first-person", "imperfect", "indicative", "plural"] }, { "form": "viajáveis", "source": "Conjugation", "tags": ["imperfect", "indicative", "plural", "second-person"] }, { "form": "viajavam", "source": "Conjugation", "tags": ["imperfect", "indicative", "plural", "third-person"] }, { "form": "viajei", "source": "Conjugation", "tags": ["first-person", "indicative", "preterite", "singular"] }, { "form": "viajaste", "source": "Conjugation", "tags": ["indicative", "preterite", "second-person", "singular"] }, { "form": "viajou", "source": "Conjugation", "tags": ["indicative", "preterite", "singular", "third-person"] }, { "form": "viajamos", "source": "Conjugation", "tags": ["first-person", "indicative", "plural", "preterite"] }, { "form": "viajámos", "source": "Conjugation", "tags": ["first-person", "indicative", "plural", "preterite"] }, { "form": "viajastes", "source": "Conjugation", "tags": ["indicative", "plural", "preterite", "second-person"] }, { "form": "viajaram", "source": "Conjugation", "tags": ["indicative", "plural", "preterite", "third-person"] }, { "form": "viajara", "source": "Conjugation", "tags": ["first-person", "indicative", "pluperfect", "singular"] }, { "form": "viajaras", "source": "Conjugation", "tags": ["indicative", "pluperfect", "second-person", "singular"] }, { "form": "viajara", "source": "Conjugation", "tags": ["indicative", "pluperfect", "singular", "third-person"] }, { "form": "viajáramos", "source": "Conjugation", "tags": ["first-person", "indicative", "pluperfect", "plural"] }, { "form": "viajáreis", "source": "Conjugation", "tags": ["indicative", "pluperfect", "plural", "second-person"] }, { "form": "viajaram", "source": "Conjugation", "tags": ["indicative", "pluperfect", "plural", "third-person"] }, { "form": "viajarei", "source": "Conjugation", "tags": ["first-person", "future", "indicative", "singular"] }, { "form": "viajarás", "source": "Conjugation", "tags": ["future", "indicative", "second-person", "singular"] }, { "form": "viajará", "source": "Conjugation", "tags": ["future", "indicative", "singular", "third-person"] }, { "form": "viajaremos", "source": "Conjugation", "tags": ["first-person", "future", "indicative", "plural"] }, { "form": "viajareis", "source": "Conjugation", "tags": ["future", "indicative", "plural", "second-person"] }, { "form": "viajarão", "source": "Conjugation", "tags": ["future", "indicative", "plural", "third-person"] }, { "form": "viajaria", "source": "Conjugation", "tags": ["conditional", "first-person", "singular"] }, { "form": "viajarias", "source": "Conjugation", "tags": ["conditional", "second-person", "singular"] }, { "form": "viajaria", "source": "Conjugation", "tags": ["conditional", "singular", "third-person"] }, { "form": "viajaríamos", "source": "Conjugation", "tags": ["conditional", "first-person", "plural"] }, { "form": "viajaríeis", "source": "Conjugation", "tags": ["conditional", "plural", "second-person"] }, { "form": "viajariam", "source": "Conjugation", "tags": ["conditional", "plural", "third-person"] }, { "form": "viaje", "source": "Conjugation", "tags": ["first-person", "present", "singular", "subjunctive"] }, { "form": "viajes", "source": "Conjugation", "tags": ["present", "second-person", "singular", "subjunctive"] }, { "form": "viaje", "source": "Conjugation", "tags": ["present", "singular", "subjunctive", "third-person"] }, { "form": "viajemos", "source": "Conjugation", "tags": ["first-person", "plural", "present", "subjunctive"] }, { "form": "viajeis", "source": "Conjugation", "tags": ["plural", "present", "second-person", "subjunctive"] }, { "form": "viajem", "source": "Conjugation", "tags": ["plural", "present", "subjunctive", "third-person"] }, { "form": "viajasse", "source": "Conjugation", "tags": ["first-person", "imperfect", "singular", "subjunctive"] }, { "form": "viajasses", "source": "Conjugation", "tags": ["imperfect", "second-person", "singular", "subjunctive"] }, { "form": "viajasse", "source": "Conjugation", "tags": ["imperfect", "singular", "subjunctive", "third-person"] }, { "form": "viajássemos", "source": "Conjugation", "tags": ["first-person", "imperfect", "plural", "subjunctive"] }, { "form": "viajásseis", "source": "Conjugation", "tags": ["imperfect", "plural", "second-person", "subjunctive"] }, { "form": "viajassem", "source": "Conjugation", "tags": ["imperfect", "plural", "subjunctive", "third-person"] }, { "form": "viajar", "source": "Conjugation", "tags": ["first-person", "future", "singular", "subjunctive"] }, { "form": "viajares", "source": "Conjugation", "tags": ["future", "second-person", "singular", "subjunctive"] }, { "form": "viajar", "source": "Conjugation", "tags": ["future", "singular", "subjunctive", "third-person"] }, { "form": "viajarmos", "source": "Conjugation", "tags": ["first-person", "future", "plural", "subjunctive"] }, { "form": "viajardes", "source": "Conjugation", "tags": ["future", "plural", "second-person", "subjunctive"] }, { "form": "viajarem", "source": "Conjugation", "tags": ["future", "plural", "subjunctive", "third-person"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['first-person', 'imperative', 'singular'] }, { "form": "viaja", "source": "Conjugation", "tags": ["imperative", "second-person", "singular"] }, { "form": "viaje", "source": "Conjugation", "tags": ["imperative", "singular", "third-person"] }, { "form": "viajemos", "source": "Conjugation", "tags": ["first-person", "imperative", "plural"] }, { "form": "viajai", "source": "Conjugation", "tags": ["imperative", "plural", "second-person"] }, { "form": "viajem", "source": "Conjugation", "tags": ["imperative", "plural", "third-person"] }, { 'form': '-', 'source': 'Conjugation', 'tags': ['first-person', 'imperative', 'negative', 'singular'] }, { "form": "viajes", "source": "Conjugation", "tags": ["imperative", "negative", "second-person", "singular"] }, { "form": "viaje", "source": "Conjugation", "tags": ["imperative", "negative", "singular", "third-person"] }, { "form": "viajemos", "source": "Conjugation", "tags": ["first-person", "imperative", "negative", "plural"] }, { "form": "viajeis", "source": "Conjugation", "tags": ["imperative", "negative", "plural", "second-person"] }, { "form": "viajem", "source": "Conjugation", "tags": ["imperative", "negative", "plural", "third-person"] }], } self.assertEqual(expected, ret) def test_Portuguese_adj1(self): ret = self.xinfl( "lindo", "Portuguese", "adj", "Conjugation", """ <div class="NavFrame" style="clear%3Aboth%3B+white-space%3A+nowrap%3B+max-width%3A+50em"> <div class="NavHead">Inflection of <i class="Latn+mention" lang="pt">lindo</i></div> <div class="NavContent"> {| style="border%3A+1px+solid+%23999999%3B+width%3A+100%25%3B+background%3A%23F6F6F6%3B" cellpadding="3" cellspacing="0" class="inflection-table" |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23B0B0B0" rowspan="2" | ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0" colspan="2" | singular ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0" colspan="2" | plural |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0%3B+width%3A21%25" | masculine ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0%3B+width%3A21%25" | feminine ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0%3B+width%3A21%25" | masculine ! style="border%3A+1px+solid+%23999999%3B+background%3A%23D0D0D0%3B+width%3A21%25" | feminine |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0bfd4" | [[Appendix:Glossary#positive|positive]] | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindo#Portuguese|lindo]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[linda#Portuguese|linda]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindos#Portuguese|lindos]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindas#Portuguese|lindas]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0bfd4" | [[Appendix:Glossary#comparative|comparative]] | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[mais#Portuguese|mais]] lindo</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[mais#Portuguese|mais]] linda</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[mais#Portuguese|mais]] lindos</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[mais#Portuguese|mais]] lindas</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0bfd4" | [[Appendix:Glossary#superlative|superlative]] | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[o#Portuguese|o]] [[mais#Portuguese|mais]] lindo</span><br><span class="Latn" lang="pt">[[lindíssimo#Portuguese|lindíssimo]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[a#Portuguese|a]] [[mais#Portuguese|mais]] linda</span><br><span class="Latn" lang="pt">[[lindíssima#Portuguese|lindíssima]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[os#Portuguese|os]] [[mais#Portuguese|mais]] lindos</span><br><span class="Latn" lang="pt">[[lindíssimos#Portuguese|lindíssimos]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[as#Portuguese|as]] [[mais#Portuguese|mais]] lindas</span><br><span class="Latn" lang="pt">[[lindíssimas#Portuguese|lindíssimas]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0bfd4" | [[Appendix:Glossary#augmentative|augmentative]] | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindão#Portuguese|lindão]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindona#Portuguese|lindona]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindões#Portuguese|lindões]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindonas#Portuguese|lindonas]]</span> |- ! style="border%3A+1px+solid+%23999999%3B+background%3A%23b0bfd4" | [[Appendix:Glossary#diminutive|diminutive]] | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindinho#Portuguese|lindinho]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindinha#Portuguese|lindinha]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindinhos#Portuguese|lindinhos]]</span> | style="border%3A+1px+solid+%23999999%3B" valign="top" | <span class="Latn" lang="pt">[[lindinhas#Portuguese|lindinhas]]</span> |} </div></div> """) expected = { "forms": [{ "form": "", "source": "Conjugation", "tags": ["table-tags"] }, { "form": "lindo", "source": "Conjugation", "tags": ["masculine", "positive", "singular"] }, { "form": "linda", "source": "Conjugation", "tags": ["feminine", "positive", "singular"] }, { "form": "lindos", "source": "Conjugation", "tags": ["masculine", "plural", "positive"] }, { "form": "lindas", "source": "Conjugation", "tags": ["feminine", "plural", "positive"] }, { "form": "mais lindo", "source": "Conjugation", "tags": ["comparative", "masculine", "singular"] }, { "form": "mais linda", "source": "Conjugation", "tags": ["comparative", "feminine", "singular"] }, { "form": "mais lindos", "source": "Conjugation", "tags": ["comparative", "masculine", "plural"] }, { "form": "mais lindas", "source": "Conjugation", "tags": ["comparative", "feminine", "plural"] }, { "form": "o mais lindo", "source": "Conjugation", "tags": ["masculine", "singular", "superlative"] }, { "form": "lindíssimo", "source": "Conjugation", "tags": ["masculine", "singular", "superlative"] }, { "form": "a mais linda", "source": "Conjugation", "tags": ["feminine", "singular", "superlative"] }, { "form": "lindíssima", "source": "Conjugation", "tags": ["feminine", "singular", "superlative"] }, { "form": "os mais lindos", "source": "Conjugation", "tags": ["masculine", "plural", "superlative"] }, { "form": "lindíssimos", "source": "Conjugation", "tags": ["masculine", "plural", "superlative"] }, { "form": "as mais lindas", "source": "Conjugation", "tags": ["feminine", "plural", "superlative"] }, { "form": "lindíssimas", "source": "Conjugation", "tags": ["feminine", "plural", "superlative"] }, { "form": "lindão", "source": "Conjugation", "tags": ["augmentative", "masculine", "singular"] }, { "form": "lindona", "source": "Conjugation", "tags": ["augmentative", "feminine", "singular"] }, { "form": "lindões", "source": "Conjugation", "tags": ["augmentative", "masculine", "plural"] }, { "form": "lindonas", "source": "Conjugation", "tags": ["augmentative", "feminine", "plural"] }, { "form": "lindinho", "source": "Conjugation", "tags": ["diminutive", "masculine", "singular"] }, { "form": "lindinha", "source": "Conjugation", "tags": ["diminutive", "feminine", "singular"] }, { "form": "lindinhos", "source": "Conjugation", "tags": ["diminutive", "masculine", "plural"] }, { "form": "lindinhas", "source": "Conjugation", "tags": ["diminutive", "feminine", "plural"] }], } self.assertEqual(expected, ret)
class InflTests(unittest.TestCase): def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English") def xinfl(self, word, lang, pos, section, text): """Runs a single inflection table parsing test, and returns ``data``.""" self.ctx.start_page(word) self.ctx.start_section(lang) self.ctx.start_subsection(pos) tree = self.ctx.parse(text) data = {} parse_inflection_section(self.config, self.ctx, data, word, lang, pos, section, tree) return data def test_Russian_adj1(self): ret = self.xinfl( "следующий", "Russian", "adj", "Declension", """ <div> <div class="NavFrame" style="display%3A+inline-block%3B+min-width%3A+70em"> <div class="NavHead" style="background%3A%23eff7ff">Declension of <b lang="ru" class="Cyrl"><span class="Cyrl" lang="ru">сле́дующий</span></b> (unknown short forms)</div> <div class="NavContent"> {| style="background%3A%23F9F9F9%3Btext-align%3Acenter%3B+min-width%3A70em" class="inflection-table" |- ! style="width%3A20%25%3Bbackground%3A%23d9ebff" colspan="2" | ! style="background%3A%23d9ebff" | masculine ! style="background%3A%23d9ebff" | neuter ! style="background%3A%23d9ebff" | feminine ! style="background%3A%23d9ebff" | plural |- ! style="background%3A%23eff7ff" colspan="2" | nominative | <span class="Cyrl+form-of+lang-ru+nom%7Cm%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующий#Russian|сле́дующий]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščij</span> | <span class="Cyrl+form-of+lang-ru+nom%7Cn%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующее#Russian|сле́дующее]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščeje</span> | <span class="Cyrl+form-of+lang-ru+nom%7Cf%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующая#Russian|сле́дующая]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščaja</span> | <span class="Cyrl+form-of+lang-ru+nom%7Cp-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующие#Russian|сле́дующие]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščije</span> |- ! style="background%3A%23eff7ff" colspan="2" | genitive | colspan="2" | <span class="Cyrl+form-of+lang-ru+gen%7Cm%2F%2Fn%7Cs-form-of+++transliteration-sl%C3%A9duju%C5%A1%C4%8Devo+origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующего#Russian|сле́дующего]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščevo</span> | <span class="Cyrl+form-of+lang-ru+gen%7Cf%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующей#Russian|сле́дующей]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščej</span> | <span class="Cyrl+form-of+lang-ru+gen%7Cp-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующих#Russian|сле́дующих]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščix</span> |- ! style="background%3A%23eff7ff" colspan="2" | dative | colspan="2" | <span class="Cyrl+form-of+lang-ru+dat%7Cm%2F%2Fn%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующему#Russian|сле́дующему]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščemu</span> | <span class="Cyrl+form-of+lang-ru+dat%7Cf%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующей#Russian|сле́дующей]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščej</span> | <span class="Cyrl+form-of+lang-ru+dat%7Cp-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующим#Russian|сле́дующим]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščim</span> |- ! style="background%3A%23eff7ff" rowspan="2" | accusative ! style="background%3A%23eff7ff" | animate | <span class="Cyrl+form-of+lang-ru+an%7Cacc%7Cm%7Cs-form-of+++transliteration-sl%C3%A9duju%C5%A1%C4%8Devo+origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующего#Russian|сле́дующего]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščevo</span> | rowspan="2" | <span class="Cyrl+form-of+lang-ru+acc%7Cn%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующее#Russian|сле́дующее]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščeje</span> | rowspan="2" | <span class="Cyrl+form-of+lang-ru+acc%7Cf%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующую#Russian|сле́дующую]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščuju</span> | <span class="Cyrl+form-of+lang-ru+an%7Cacc%7Cp-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующих#Russian|сле́дующих]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščix</span> |- ! style="background%3A%23eff7ff" | inanimate | <span class="Cyrl+form-of+lang-ru+in%7Cacc%7Cm%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующий#Russian|сле́дующий]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščij</span> | <span class="Cyrl+form-of+lang-ru+in%7Cacc%7Cp-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующие#Russian|сле́дующие]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščije</span> |- ! style="background%3A%23eff7ff" colspan="2" | instrumental | colspan="2" | <span class="Cyrl+form-of+lang-ru+ins%7Cm%2F%2Fn%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующим#Russian|сле́дующим]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščim</span> | <span class="Cyrl+form-of+lang-ru+ins%7Cf%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующей#Russian|сле́дующей]]</span>, <span class="Cyrl+form-of+lang-ru+ins%7Cf%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующею#Russian|сле́дующею]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščej</span>, <span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščeju</span> | <span class="Cyrl+form-of+lang-ru+ins%7Cp-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующими#Russian|сле́дующими]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščimi</span> |- ! style="background%3A%23eff7ff" colspan="2" | prepositional | colspan="2" | <span class="Cyrl+form-of+lang-ru+pre%7Cm%2F%2Fn%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующем#Russian|сле́дующем]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščem</span> | <span class="Cyrl+form-of+lang-ru+pre%7Cf%7Cs-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующей#Russian|сле́дующей]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščej</span> | <span class="Cyrl+form-of+lang-ru+pre%7Cp-form-of++++origin-%D1%81%D0%BB%D0%B5%CC%81%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0%B9+++" lang="ru">[[следующих#Russian|сле́дующих]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888%3B">slédujuščix</span> |- |} </div></div></div>[[Category:Russian sibilant-stem stem-stressed adjectives|СЛЕДУЮЩИЙ]] """) expected = { "forms": [{ "form": "", "source": "Declension", "tags": ["table-tags"] }, { "form": "сле́дующий", "roman": "slédujuščij", "source": "Declension", "tags": ["masculine", "nominative"] }, { "form": "сле́дующее", "roman": "slédujuščeje", "source": "Declension", "tags": ["neuter", "nominative"] }, { "form": "сле́дующая", "roman": "slédujuščaja", "source": "Declension", "tags": ["feminine", "nominative"] }, { "form": "сле́дующие", "roman": "slédujuščije", "source": "Declension", "tags": ["nominative", "plural"] }, { "form": "сле́дующего", "roman": "slédujuščevo", "source": "Declension", "tags": ["genitive", "masculine", "neuter"] }, { "form": "сле́дующей", "roman": "slédujuščej", "source": "Declension", "tags": ["feminine", "genitive"] }, { "form": "сле́дующих", "roman": "slédujuščix", "source": "Declension", "tags": ["genitive", "plural"] }, { "form": "сле́дующему", "roman": "slédujuščemu", "source": "Declension", "tags": ["dative", "masculine", "neuter"] }, { "form": "сле́дующей", "roman": "slédujuščej", "source": "Declension", "tags": ["dative", "feminine"] }, { "form": "сле́дующим", "roman": "slédujuščim", "source": "Declension", "tags": ["dative", "plural"] }, { "form": "сле́дующего", "roman": "slédujuščevo", "source": "Declension", "tags": ["accusative", "animate", "masculine"] }, { "form": "сле́дующее", "roman": "slédujuščeje", "source": "Declension", "tags": ["accusative", "neuter"] }, { "form": "сле́дующую", "roman": "slédujuščuju", "source": "Declension", "tags": ["accusative", "feminine"] }, { "form": "сле́дующих", "roman": "slédujuščix", "source": "Declension", "tags": ["accusative", "animate", "plural"] }, { "form": "сле́дующий", "roman": "slédujuščij", "source": "Declension", "tags": ["accusative", "inanimate", "masculine"] }, { "form": "сле́дующие", "roman": "slédujuščije", "source": "Declension", "tags": ["accusative", "inanimate", "plural"] }, { "form": "сле́дующим", "roman": "slédujuščim", "source": "Declension", "tags": ["instrumental", "masculine", "neuter"] }, { "form": "сле́дующей", "roman": "slédujuščej", "source": "Declension", "tags": ["feminine", "instrumental"] }, { "form": "сле́дующею", "roman": "slédujuščeju", "source": "Declension", "tags": ["feminine", "instrumental"] }, { "form": "сле́дующими", "roman": "slédujuščimi", "source": "Declension", "tags": ["instrumental", "plural"] }, { "form": "сле́дующем", "roman": "slédujuščem", "source": "Declension", "tags": ["masculine", "neuter", "prepositional"] }, { "form": "сле́дующей", "roman": "slédujuščej", "source": "Declension", "tags": ["feminine", "prepositional"] }, { "form": "сле́дующих", "roman": "slédujuščix", "source": "Declension", "tags": ["plural", "prepositional"] }], } self.assertEqual(expected, ret) def test_Russian_verb1(self): ret = self.xinfl( "произносить", "Russian", "verb", "Conjugation", """ <templatestyles src="Module%3Aru-verb%2Fstyle.css"><div class="NavFrame" style="width%3A49.6em%3B"> <div class="NavHead" style="text-align%3Aleft%3B+background%3A%23e0e0ff%3B">Conjugation of <span lang="ru" class="Cyrl">''произноси́ть''</span> (class 4c imperfective transitive)</div> <div class="NavContent"> {| class="inflection+inflection-ru+inflection-verb+inflection-table" |+ Note: For declension of participles, see their entries. Adverbial participles are indeclinable. |- class="rowgroup" ! colspan="3" | [[несовершенный вид|imperfective aspect]] |- ! [[неопределённая форма|infinitive]] | colspan="2" | <span class="Cyrl+form-of+lang-ru+inf-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносить#Russian|произноси́ть]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosítʹ</span> |- class="rowgroup" ! style="width%3A15em" | [[причастие|participles]] ! [[настоящее время|present tense]] ! [[прошедшее время|past tense]] |- ! [[действительный залог|active]] | <span class="Cyrl+form-of+lang-ru+pres%7Cact%7Cpart-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносящий#Russian|произнося́щий]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosjáščij</span> | <span class="Cyrl+form-of+lang-ru+past%7Cact%7Cpart-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносивший#Russian|произноси́вший]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosívšij</span> |- ! [[страдательный залог|passive]] | <span class="Cyrl+form-of+lang-ru+pres%7Cpass%7Cpart-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносимый#Russian|произноси́мый]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosímyj</span> | — |- ! [[деепричастие|adverbial]] | <span class="Cyrl+form-of+lang-ru+pres%7Cadv%7Cpart-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произнося#Russian|произнося́]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosjá</span> | <span class="Cyrl+form-of+lang-ru+past%7Cadv%7Cpart-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносив#Russian|произноси́в]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosív</span>,<br><span class="Cyrl+form-of+lang-ru+past%7Cadv%7Cpart-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносивши#Russian|произноси́вши]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosívši</span> |- class="rowgroup" ! ! [[настоящее время|present tense]] ! [[будущее время|future tense]] |- ! [[первое лицо|1st]] [[единственное число|singular]] (<span lang="ru" class="Cyrl">я</span>) | <span class="Cyrl+form-of+lang-ru+1%7Cs%7Cpres%7Cind-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произношу#Russian|произношу́]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznošú</span> | <span class="Cyrl" lang="ru">[[буду#Russian|бу́ду]]</span><span lang="ru" class="Cyrl"> произноси́ть</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">búdu proiznosítʹ</span> |- ! [[второе лицо|2nd]] [[единственное число|singular]] (<span lang="ru" class="Cyrl">ты</span>) | <span class="Cyrl+form-of+lang-ru+2%7Cs%7Cpres%7Cind-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносишь#Russian|произно́сишь]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznósišʹ</span> | <span class="Cyrl" lang="ru">[[будешь#Russian|бу́дешь]]</span><span lang="ru" class="Cyrl"> произноси́ть</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">búdešʹ proiznosítʹ</span> |- ! [[третье лицо|3rd]] [[единственное число|singular]] (<span lang="ru" class="Cyrl">он/она́/оно́</span>) | <span class="Cyrl+form-of+lang-ru+3%7Cs%7Cpres%7Cind-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносит#Russian|произно́сит]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznósit</span> | <span class="Cyrl" lang="ru">[[будет#Russian|бу́дет]]</span><span lang="ru" class="Cyrl"> произноси́ть</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">búdet proiznosítʹ</span> |- ! [[первое лицо|1st]] [[множественное число|plural]] (<span lang="ru" class="Cyrl">мы</span>) | <span class="Cyrl+form-of+lang-ru+1%7Cp%7Cpres%7Cind-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносим#Russian|произно́сим]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznósim</span> | <span class="Cyrl" lang="ru">[[будем#Russian|бу́дем]]</span><span lang="ru" class="Cyrl"> произноси́ть</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">búdem proiznosítʹ</span> |- ! [[второе лицо|2nd]] [[множественное число|plural]] (<span lang="ru" class="Cyrl">вы</span>) | <span class="Cyrl+form-of+lang-ru+2%7Cp%7Cpres%7Cind-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносите#Russian|произно́сите]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznósite</span> | <span class="Cyrl" lang="ru">[[будете#Russian|бу́дете]]</span><span lang="ru" class="Cyrl"> произноси́ть</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">búdete proiznosítʹ</span> |- ! [[третье лицо|3rd]] [[множественное число|plural]] (<span lang="ru" class="Cyrl">они́</span>) | <span class="Cyrl+form-of+lang-ru+3%7Cp%7Cpres%7Cind-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносят#Russian|произно́сят]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznósjat</span> | <span class="Cyrl" lang="ru">[[будут#Russian|бу́дут]]</span><span lang="ru" class="Cyrl"> произноси́ть</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">búdut proiznosítʹ</span> |- class="rowgroup" ! [[повелительное наклонение|imperative]] ! [[единственное число|singular]] ! [[множественное число|plural]] |- ! | <span class="Cyrl+form-of+lang-ru+2%7Cs%7Cimp-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произноси#Russian|произноси́]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosí</span> | <span class="Cyrl+form-of+lang-ru+2%7Cp%7Cimp-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносите#Russian|произноси́те]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosíte</span> |- class="rowgroup" ! [[прошедшее время|past tense]] ! [[единственное число|singular]] ! [[множественное число|plural]]<br>(<span lang="ru" class="Cyrl">мы/вы/они́</span>) |- ! [[мужской род|masculine]] (<span lang="ru" class="Cyrl">я/ты/он</span>) | <span class="Cyrl+form-of+lang-ru+m%7Cs%7Cpast%7Cind-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносил#Russian|произноси́л]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosíl</span> | rowspan="3" | <span class="Cyrl+form-of+lang-ru+p%7Cpast%7Cind-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносили#Russian|произноси́ли]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosíli</span> |- ! [[женский род|feminine]] (<span lang="ru" class="Cyrl">я/ты/она́</span>) | <span class="Cyrl+form-of+lang-ru+f%7Cs%7Cpast%7Cind-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносила#Russian|произноси́ла]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosíla</span> |- ! style="background-color%3A+%23ffffe0%3B" | [[средний род|neuter]] (<span lang="ru" class="Cyrl">оно́</span>) | <span class="Cyrl+form-of+lang-ru+n%7Cs%7Cpast%7Cind-form-of++++origin-%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%BD%D0%BE%D1%81%D0%B8%CC%81%D1%82%D1%8C+++" lang="ru">[[произносило#Russian|произноси́ло]]</span><br><span lang="ru-Latn" class="tr+Latn" style="color%3A+%23888">proiznosílo</span> |} </div> </div>[[Category:Russian class 4 verbs|ПРОИЗНОСИТЬ]][[Category:Russian class 4c verbs|ПРОИЗНОСИТЬ]][[Category:Russian imperfective verbs|ПРОИЗНОСИТЬ]][[Category:Russian transitive verbs|ПРОИЗНОСИТЬ]] """) expected = { "forms": [{ "form": "imperfective transitive", "source": "Conjugation", "tags": ["table-tags"] }, { "form": "4c imperfective transitive", "source": "Conjugation", "tags": ["class"] }, { "form": "произноси́ть", "roman": "proiznosítʹ", "source": "Conjugation", "tags": ["imperfective", "infinitive"] }, { "form": "произнося́щий", "roman": "proiznosjáščij", "source": "Conjugation", "tags": ["active", "participle", "present"] }, { "form": "произноси́вший", "roman": "proiznosívšij", "source": "Conjugation", "tags": ["active", "participle", "past"] }, { "form": "произноси́мый", "roman": "proiznosímyj", "source": "Conjugation", "tags": ["participle", "passive", "present"] }, { "form": "-", "source": "Conjugation", "tags": ["participle", "passive", "past"] }, { "form": "произнося́", "roman": "proiznosjá", "source": "Conjugation", "tags": ["adverbial", "participle", "present"] }, { "form": "произноси́в", "roman": "proiznosív", "source": "Conjugation", "tags": ["adverbial", "participle", "past"] }, { "form": "произноси́вши", "roman": "proiznosívši", "source": "Conjugation", "tags": ["adverbial", "participle", "past"] }, { "form": "произношу́", "roman": "proiznošú", "source": "Conjugation", "tags": ["first-person", "present", "singular"] }, { "form": "бу́ду произноси́ть", "roman": "búdu proiznosítʹ", "source": "Conjugation", "tags": ["first-person", "future", "singular"] }, { "form": "произно́сишь", "roman": "proiznósišʹ", "source": "Conjugation", "tags": ["present", "second-person", "singular"] }, { "form": "бу́дешь произноси́ть", "roman": "búdešʹ proiznosítʹ", "source": "Conjugation", "tags": ["future", "second-person", "singular"] }, { "form": "произно́сит", "roman": "proiznósit", "source": "Conjugation", "tags": ["present", "singular", "third-person"] }, { "form": "бу́дет произноси́ть", "roman": "búdet proiznosítʹ", "source": "Conjugation", "tags": ["future", "singular", "third-person"] }, { "form": "произно́сим", "roman": "proiznósim", "source": "Conjugation", "tags": ["first-person", "plural", "present"] }, { "form": "бу́дем произноси́ть", "roman": "búdem proiznosítʹ", "source": "Conjugation", "tags": ["first-person", "future", "plural"] }, { "form": "произно́сите", "roman": "proiznósite", "source": "Conjugation", "tags": ["plural", "present", "second-person"] }, { "form": "бу́дете произноси́ть", "roman": "búdete proiznosítʹ", "source": "Conjugation", "tags": ["future", "plural", "second-person"] }, { "form": "произно́сят", "roman": "proiznósjat", "source": "Conjugation", "tags": ["plural", "present", "third-person"] }, { "form": "бу́дут произноси́ть", "roman": "búdut proiznosítʹ", "source": "Conjugation", "tags": ["future", "plural", "third-person"] }, { "form": "произноси́", "roman": "proiznosí", "source": "Conjugation", "tags": ["imperative", "singular"] }, { "form": "произноси́те", "roman": "proiznosíte", "source": "Conjugation", "tags": ["imperative", "plural"] }, { "form": "произноси́л", "roman": "proiznosíl", "source": "Conjugation", "tags": ["masculine", "past", "singular"] }, { "form": "произноси́ли", "roman": "proiznosíli", "source": "Conjugation", "tags": ["masculine", "past", "plural"] }, { "form": "произноси́ла", "roman": "proiznosíla", "source": "Conjugation", "tags": ["feminine", "past", "singular"] }, { "form": "произноси́ли", "roman": "proiznosíli", "source": "Conjugation", "tags": ["feminine", "past", "plural"] }, { "form": "произноси́ло", "roman": "proiznosílo", "source": "Conjugation", "tags": ["neuter", "past", "singular"] }, { "form": "произноси́ли", "roman": "proiznosíli", "source": "Conjugation", "tags": ["neuter", "past", "plural"] }], } self.assertEqual(expected, ret)
def setUp(self): self.maxDiff = 100000 self.ctx = Wtp() self.config = WiktionaryConfig() self.ctx.start_page("testpage") self.ctx.start_section("English")
if node.kind not in (NodeKind.LEVEL2, NodeKind.LEVEL3, NodeKind.LEVEL4, NodeKind.LEVEL5, NodeKind.LEVEL6): continue if (len(node.args) != 1 or len(node.args[0]) != 1 or not isinstance(node.args[0][0], str)): print(" {} - {}: {}".format(title, node.kind, node.children)) continue t = node.args[0][0] assert isinstance(t, str) print(" {} - {}".format(title, t)) titles.append(t) sys.stdout.flush() return title, titles, ctx.errors ctx = Wtp() ret = ctx.process(path, page_handler) counts = collections.defaultdict(int) titles_ht = collections.defaultdict(list) for page_title, titles, errors in ret: for title in titles: titles_ht[title].append(page_title) for err in errors: msg = err["msg"] counts[msg] += 1 print("=== MOST COMMON ERRORS") errors = list(sorted(counts.items(), key=lambda x: x[1], reverse=True)) for err, cnt in errors[:40]: print(cnt, err)