예제 #1
0
 def test_head2(self):
     data = {}
     parse_word_head(self.ctx, "noun", "testpage", data, False)
     self.assertEqual(self.ctx.errors, [])
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(data, {})
예제 #2
0
 def test_head4(self):
     data = {}
     parse_word_head(self.ctx, "noun", "testpage f", data, False)
     self.assertEqual(self.ctx.errors, [])
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(data, {"tags": ["feminine"]})
예제 #3
0
 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"]})
예제 #4
0
 def test_head27(self):
     data = {}
     self.ctx.start_page("أَبْلَعَ")
     self.ctx.start_section("Arabic")
     self.ctx.start_subsection("Verb")
     parse_word_head(
         self.ctx, "verb",
         "أَبْلَعَ (ʾablaʿa) IV, non-past يُبْلِعُ‎‎ (yubliʿu)", data,
         False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {
             "forms": [
                 {
                     "form": "يُبْلِعُ‎‎",
                     "roman": "yubliʿu",
                     "tags": ["non-past"]
                 },
                 {
                     "form": "ʾablaʿa",
                     "tags": ["romanization"]
                 },
             ],
             "tags": ["form-iv"]
         })
예제 #5
0
 def test_head8(self):
     data = {}
     self.ctx.start_section("Zulu")
     parse_word_head(self.ctx, "noun", "testpage 1", data, False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(data, {"tags": ["class-1"]})
예제 #6
0
 def test_reconstruction3(self):
     data = {}
     parse_word_head(self.ctx, "noun", "*testpage", data, False)
     self.assertEqual(
         data, {"forms": [{
             "form": "*testpage",
             "tags": ["canonical"]
         }]})
예제 #7
0
 def test_head9(self):
     data = {}
     parse_word_head(self.ctx, "noun",
                     "testpage f (plurale tantum, inanimate)", data, False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {"tags": ["feminine", "inanimate", "plural", "plural-only"]})
예제 #8
0
 def test_head17(self):
     data = {}
     self.ctx.start_page("index")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Noun")
     parse_word_head(self.ctx, "noun", "index n", data, False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(data, {"tags": ["neuter"]})
예제 #9
0
 def test_reconstruction1(self):
     data = {}
     self.ctx.start_page("Reconstruction:Proto-Germanic/testpage")
     self.ctx.start_section("Proto-Germanic")
     parse_word_head(self.ctx, "noun", "*testpage", data, True)
     self.assertEqual(self.ctx.errors, [])
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(data, {})
예제 #10
0
 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"]
         }]})
예제 #11
0
 def test_head23(self):
     data = {}
     self.ctx.start_page("indubitables")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Adjective")
     parse_word_head(self.ctx, "adj", "indubitables m pl or f pl", data,
                     False)
     # print(json.dumps(data, indent=2))
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(data, {"tags": ["feminine", "masculine", "plural"]})
예제 #12
0
 def test_head3(self):
     data = {}
     parse_word_head(self.ctx, "noun", "testpAge", data, False)
     self.assertEqual(self.ctx.errors, [])
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {"forms": [{
             "form": "testpAge",
             "tags": ["canonical"]
         }]})
예제 #13
0
 def test_head5(self):
     data = {}
     parse_word_head(self.ctx, "noun", "testpAge m", data)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(
         data, {
             "forms": [{
                 "form": "testpAge",
                 "tags": ["canonical"]
             }],
             "tags": ["masculine"]
         })
예제 #14
0
 def test_head8b(self):
     # Trying to parse suffix 1 in English - should not get parsed
     data = {}
     parse_word_head(self.ctx, "noun", "testpage 1", data, False)
     self.assertEqual(self.ctx.errors, [])
     self.assertEqual(self.ctx.warnings, [])
     self.assertNotEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {"forms": [{
             "form": "testpage 1",
             "tags": ["canonical"]
         }]})
예제 #15
0
 def test_reconstruction2(self):
     data = {}
     self.ctx.start_page("Reconstruction:Proto-Germanic/testpage")
     self.ctx.start_section("Proto-Germanic")
     parse_word_head(self.ctx, "noun", "*testfoo", data, True)
     self.assertEqual(self.ctx.errors, [])
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {"forms": [{
             "form": "testfoo",
             "tags": ["canonical"]
         }]})
예제 #16
0
 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"
             }]
         })
예제 #17
0
 def test_head24(self):
     data = {}
     self.ctx.start_page("foo")
     self.ctx.start_section("Japanese")
     self.ctx.start_subsection("Noun")
     parse_word_head(self.ctx, "noun", "foo (12 strokes)", data, False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(data,
                      {"forms": [
                          {
                              "tags": ["strokes"],
                              "form": "12"
                          },
                      ]})
예제 #18
0
 def test_head26(self):
     data = {}
     self.ctx.start_page("foos")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Noun")
     parse_word_head(self.ctx, "noun", "foos (plural of foo)", data, False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(data,
                      {"forms": [
                          {
                              "tags": ["plural-of"],
                              "form": "foo"
                          },
                      ]})
예제 #19
0
 def test_head30(self):
     data = {}
     self.maxDiff = 10000
     self.ctx.start_page("burn")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Noun")
     parse_word_head(
         self.ctx, "noun",
         "burn (third-person singular simple present burns, present participle burning, simple past and past participle burned or (mostly Commonwealth) burnt or (obsolete) brent)",
         data, False)
     print(json.dumps(data, indent=2, sort_keys=True))
     self.assertEqual(
         data, {
             "forms": [
                 {
                     "form": "burns",
                     "tags": ["present", "singular", "third-person"]
                 },
                 {
                     "form": "burning",
                     "tags": ["participle", "present"]
                 },
                 {
                     "form": "burned",
                     "tags": ["participle", "past"]
                 },
                 {
                     "form": "burned",
                     "tags": ["past"]
                 },
                 {
                     "form": "burnt",
                     "tags": ["Commonwealth", "participle", "past"]
                 },
                 {
                     "form": "burnt",
                     "tags": ["Commonwealth", "past"]
                 },
                 {
                     "form": "brent",
                     "tags": ["obsolete", "participle", "past"]
                 },
                 {
                     "form": "brent",
                     "tags": ["obsolete", "past"]
                 },
             ],
         })
예제 #20
0
 def test_head12(self):
     # McCune-Reischauer is used in Korean characters; we're really testing
     # the hyphen in keyword names
     data = {}
     parse_word_head(self.ctx, "noun", "foo (McCune-Reischauer bar)", data,
                     False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {
             "forms": [{
                 "form": "foo",
                 "tags": ["canonical"]
             }, {
                 "form": "bar",
                 "tags": ["McCune-Reischauer"]
             }]
         })
예제 #21
0
 def test_head32(self):
     data = {}
     self.maxDiff = 10000
     self.ctx.start_page("rive")
     self.ctx.start_section("Danish")
     self.ctx.start_subsection("Noun")
     parse_word_head(
         self.ctx, "noun",
         "rive (past tense rev, past participle revet, common gender attributive reven, plural or definite attributive revne)",
         data, False)
     print(json.dumps(data, indent=2, sort_keys=True))
     self.assertEqual(
         data, {
             "forms": [
                 {
                     "form": "rev",
                     "tags": ["past"]
                 },
                 {
                     "form": "revet",
                     "tags": ["participle", "past"]
                 },
                 {
                     "form":
                     "reven",
                     "tags":
                     ["attributive", "common-gender", "participle", "past"]
                 },
                 {
                     "form":
                     "revne",
                     "tags": [
                         "attributive", "definite", "participle", "past",
                         "singular"
                     ]
                 },
                 {
                     "form": "revne",
                     "tags":
                     ["attributive", "participle", "past", "plural"]
                 },
             ],
         })
예제 #22
0
 def test_head11(self):
     data = {}
     parse_word_head(
         self.ctx, "noun",
         "testpage f (plurale tantum, stem testpag, inanimate) "
         "(+ dative)", data, False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     print(data)
     self.assertEqual(
         data, {
             "tags": [
                 "feminine", "inanimate", "plural", "plural-only",
                 "with-dative"
             ],
             "forms": [{
                 "tags": ["stem"],
                 "form": "testpag"
             }]
         })
예제 #23
0
 def test_head18(self):
     data = {}
     self.ctx.start_page("index")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Noun")
     parse_word_head(self.ctx, "noun",
                     "index m or f (genitive indicis); third declension",
                     data, False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {
             "tags": ["declension-3", "feminine", "masculine"],
             "forms": [
                 {
                     "tags": ["genitive"],
                     "form": "indicis"
                 },
             ]
         })
예제 #24
0
 def test_head22(self):
     data = {}
     parse_word_head(self.ctx, "noun", "testpage f or testpage2 m; person",
                     data, False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {
             "tags": ["person"],
             "forms": [
                 {
                     "tags": ["canonical", "feminine"],
                     "form": "testpage"
                 },
                 {
                     "tags": ["canonical", "masculine"],
                     "form": "testpage2"
                 },
             ]
         })
예제 #25
0
 def test_head20(self):
     data = {}
     self.ctx.start_page("index")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Noun")
     parse_word_head(self.ctx, "noun", "foo or bar", data, False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {
             "forms": [
                 {
                     "form": "foo",
                     "tags": ["canonical"]
                 },
                 {
                     "form": "bar",
                     "tags": ["canonical"]
                 },
             ]
         })
예제 #26
0
 def test_head28(self):
     data = {}
     self.maxDiff = 10000
     self.ctx.start_page("tell")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Noun")
     parse_word_head(
         self.ctx, "noun",
         "tell (third-person singular simple present tells, present participle telling, simple past and past participle told or (dialectal or nonstandard) telled)",
         data, False)
     print(json.dumps(data, indent=2, sort_keys=True))
     self.assertEqual(
         data, {
             "forms": [
                 {
                     "form": "tells",
                     "tags": ["present", "singular", "third-person"]
                 },
                 {
                     "form": "telling",
                     "tags": ["participle", "present"]
                 },
                 {
                     "form": "told",
                     "tags": ["participle", "past"]
                 },
                 {
                     "form": "told",
                     "tags": ["past"]
                 },
                 {
                     "form": "telled",
                     "tags": ["dialectal", "participle", "past"]
                 },
                 {
                     "form": "telled",
                     "tags": ["dialectal", "past"]
                 },
             ],
         })
예제 #27
0
 def test_head31(self):
     data = {}
     self.maxDiff = 10000
     self.ctx.start_page("grind")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Noun")
     parse_word_head(
         self.ctx, "noun",
         "grind (third-person singular simple present grinds, present participle grinding, simple past and past participle ground or grinded) (see usage notes below)",
         data, False)
     print(json.dumps(data, indent=2, sort_keys=True))
     self.assertEqual(
         data, {
             "forms": [
                 {
                     "form": "grinds",
                     "tags": ["present", "singular", "third-person"]
                 },
                 {
                     "form": "grinding",
                     "tags": ["participle", "present"]
                 },
                 {
                     "form": "ground",
                     "tags": ["participle", "past"]
                 },
                 {
                     "form": "ground",
                     "tags": ["past"]
                 },
                 {
                     "form": "grinded",
                     "tags": ["participle", "past"]
                 },
                 {
                     "form": "grinded",
                     "tags": ["past"]
                 },
             ],
         })
예제 #28
0
 def test_head21(self):
     data = {}
     self.ctx.start_page("index")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Noun")
     parse_word_head(self.ctx, "noun", "foo f or n or bar m or c", data,
                     False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {
             "forms": [
                 {
                     "form": "foo",
                     "tags": ["canonical", "feminine", "neuter"]
                 },
                 {
                     "form": "bar",
                     "tags": ["canonical", "common-gender", "masculine"]
                 },
             ]
         })
예제 #29
0
 def test_head25(self):
     data = {}
     self.ctx.start_page("smiley")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Noun")
     parse_word_head(self.ctx, "noun",
                     "smiley m (plural smileys, diminutive smileytje n)",
                     data, False)
     self.assertEqual(self.ctx.warnings, [])
     self.assertEqual(self.ctx.debugs, [])
     self.assertEqual(
         data, {
             "tags": ["masculine"],
             "forms": [
                 {
                     "tags": ["plural"],
                     "form": "smileys"
                 },
                 {
                     "tags": ["diminutive", "neuter"],
                     "form": "smileytje"
                 },
             ]
         })
예제 #30
0
 def test_head29(self):
     data = {}
     self.maxDiff = 10000
     self.ctx.start_page("take")
     self.ctx.start_section("English")
     self.ctx.start_subsection("Noun")
     parse_word_head(
         self.ctx, "noun",
         "take (third-person singular simple present takes, present participle taking, simple past took, past participle taken or (archaic or Scotland) tane)",
         data, False)
     print(json.dumps(data, indent=2, sort_keys=True))
     self.assertEqual(
         data, {
             "forms": [
                 {
                     "form": "takes",
                     "tags": ["present", "singular", "third-person"]
                 },
                 {
                     "form": "taking",
                     "tags": ["participle", "present"]
                 },
                 {
                     "form": "took",
                     "tags": ["past"]
                 },
                 {
                     "form": "taken",
                     "tags": ["participle", "past"]
                 },
                 {
                     "form": "tane",
                     "tags": ["Scotland", "archaic", "participle", "past"]
                 },
             ],
         })