Browse code

added support of another template type used for marking up etymologies

Raymund Zacharias authored on18/08/2017 20:52:34
Showing2 changed files
... ...
@@ -45,4 +45,7 @@ def get_ancestor(title, language_code, ancestor_language_code):
45 45
             # {{inh|en|gem-pro|*hwītaz}}
46 46
             if (parameters[0] == "inh") and (parameters[1] == language_code) and (parameters[2] == ancestor_language_code):
47 47
                 ancestor_words.append({"language": parameters[2], "lemma": parameters[3]})
48
+            # {{der|it|la|alacer||lively; happy, cheerful}}
49
+            if (parameters[0] == "der") and (parameters[1] == language_code) and (parameters[2] == ancestor_language_code):
50
+                ancestor_words.append({"language": parameters[2], "lemma": parameters[3]})
48 51
         return ancestor_words
... ...
@@ -75,11 +75,13 @@ def main(args):
75 75
             if (word1["language"] == word2["language"]): #if languages match
76 76
                 wordpair = (word1, word2)
77 77
                 compare(wordpair) #compare the pair
78
-    result = list(map(lambda word: {"language": word["language"], "lemma": myformat(word["lemma"])}, get_PG_decendants("hrītaną")))
79
-    print(str(result))
80
-    ancestor_word = get_ancestor("white", "en", "gem-pro")[0]["lemma"]
81
-    ancestor_word = ancestor_word.lstrip("*")
82
-    print(get_PG_decendants(ancestor_word))
78
+    # result = list(map(lambda word: {"language": word["language"], "lemma": myformat(word["lemma"])}, get_PG_decendants("hrītaną")))
79
+    # print(str(result))
80
+    # ancestor_word = get_ancestor("allègre", "fr", "la")[0]["lemma"]
81
+    # ancestor_word = ancestor_word.lstrip("*")
82
+    # print(get_PG_decendants(ancestor_word))
83
+    print(get_ancestor("allègre", "fr", "la"))
84
+    print(get_ancestor("allegro", "it", "la"))
83 85
                 
84 86
 main(sys.argv[1:])
85 87