32,14 → 32,14 |
|
# XXX HACK - These are words that are either not in Eana Eltu, or that get interpreted wrongly for whatever reason. The latter should be removed from this list when the parser gets more sophisticated. The former should also have an entry in the equivalent array in the translator! If it can take infixes, consider adding it to the main wordlist above (see the examples). The order is - original, Na'vi root, 0-pos infix, 1-pos infix, 2-pos infix, prefixes, suffixes. Things that can take affixes should go in the above list instead. |
BROKENWORDS = ( |
(u"sami", u"si", u"", u"am", u"", (()), (()), False), # otherwise parses as sa (tsa-lenited) + mi |
(u"sami", u"si", u"", u"am", u"", (()), (()), False, "si"), # otherwise parses as sa (tsa-lenited) + mi |
#(u"to", u"to", u"", u"", u"", (()), (()), False), |
#(u"frato", u"to", u"", u"", u"", [[u"fra"]], (()), False), |
(u"soaiä", u"soaia", u"", u"", u"", (()), [[(u"ä", None)]], False), # does not parse, irregular form |
(u"soaiä", u"soaia", u"", u"", u"", (()), [[(u"ä", None)]], False, "soaia"), # does not parse, irregular form |
#(u"mengenga", u"ngenga", u"", u"", u"", [[u"me"]], (()), False), |
#(u"pxengenga", u"ngenga", u"", u"", u"", [[u"pxe"]], (()), False), |
(u"kìmä", u"kä", u"", u"ìm", u"", (()), (()), False), # otherwise parses as kìm (spin) + ä (genitive) |
(u"apxay", u"pxay", u"", u"", u"", [[u"a"]], (()), False), # otherwise parses as apxa + -y (genitive) |
(u"kìmä", u"kä", u"", u"ìm", u"", (()), (()), False, "kä"), # otherwise parses as kìm (spin) + ä (genitive) |
(u"apxay", u"pxay", u"", u"", u"", [[(u"a", "a")]], (()), False, "pxay"), # otherwise parses as apxa + -y (genitive) |
#(u"akawng", u"kawng", u"", u"", u"", [[u"a"]], (()), False), |
#(u"kawnga", u"kawng", u"", u"", u"", (()), [[(u"a", None)]], False), |
#(u"kawng", u"kawng", u"", u"", u"", (()), (()), False), |
47,7 → 47,7 |
#(u"uo", u"uo", u"", u"", u"", (()), (()), False), |
#(u"sìk", u"sìk", u"", u"", u"", (()), (()), False), |
#(u"sim", u"sim", u"", u"", u"", (()), (()), False), # probably not tsim lenited |
(u"tse", u"tse", u"", u"", u"", (()), (()), False), # otherwise parses as tsa'u abbreviated (special case) |
(u"tse", u"tse", u"", u"", u"", (()), (()), False, "tse"), # otherwise parses as tsa'u abbreviated (special case) |
) |
|
#INFIXES1 = (u"awn", u"eyk", u"us", u"äp", u"") |
60,12 → 60,12 |
#prefixesv = ur"(?P<vpr>(?:nì|sä|tì|rä'ä |ke )?)" |
|
EXTRAINFIXES = [ |
{"id": "-1", "navi": "eiy", "gloss": "LAUD.", "position": 2}, |
{"id": "-2", "navi": "eng", "gloss": "PEJ.", "position": 2}, |
{"id": "-1", "navi": "eiy", "orig_navi": "ei", "gloss": "LAUD.", "position": 2}, |
{"id": "-2", "navi": "eng", "orig_navi": "äng", "gloss": "PEJ.", "position": 2}, |
] |
|
EXTRAPOSTFIXES = [ |
{"id": "-3", "navi": "eyä", "gloss": "GEN."}, |
{"id": "-3", "navi": "eyä", "orig_navi": "yä", "gloss": "GEN."}, |
] |
|
EXTRAADP = (("to", [x["id"] for x in wordlist if x["navi"] == "to"][0]), ("sì", [x["id"] for x in wordlist if x["navi"] == "sì"][0])) # words that act like adpositions but technically aren't |
79,7 → 79,7 |
if prefix["navi"].startswith(letter): |
new_prefix = prefix["navi"].replace(letter, replacement, 1) |
if not [x for x in prefixes if x["navi"] == new_prefix]: # always assume a dictionary word over a lenited prefix |
extraprefixes.append({"id": prefix["id"], "navi": new_prefix, "gloss": prefix["gloss"] + ".LENTD"}) |
extraprefixes.append({"id": prefix["id"], "navi": new_prefix, "gloss": prefix["gloss"] + ".LENTD", "orig_navi": prefix["navi"]}) |
break |
|
prefixes = sorted(prefixes + extraprefixes, key=lambda x: len(x["navi"]), reverse=True) |
116,7 → 116,7 |
print(f"Generated lenited {new_word} from {word['navi']}") |
new_word = new_word[:-1] |
new_infix = new_infix[:-1] |
extrawords.append({"id": word["id"], "navi": new_word, "infix": new_infix, "type": word["type"], "lenited": True}) |
extrawords.append({"id": word["id"], "navi": new_word, "infix": new_infix, "type": word["type"], "lenited": True, "orig_navi": word["navi"]}) |
|
wordlist = sorted(wordlist + extrawords, key=lambda x: len(x["navi"]) * 2 + (0 if x["lenited"] else 1), reverse=True) |
|
129,8 → 129,8 |
if brokenword[1] == word["navi"]: |
tempid = word["id"] |
temptype = word["type"] |
return {"word": {"id": tempid, "navi": brokenword[1], "infix": u"", "type": temptype}, "pref": brokenword[5], "post": brokenword[6], "len": brokenword[7], "inf": (brokenword[2], brokenword[3], brokenword[4]) } |
ret = {"word": {"id": 0, "navi": u"[" + wordin[0] + u"]", "infix": u"", "type": u""}, "len": False} |
return {"word": {"id": tempid, "navi": brokenword[1], "infix": u"", "type": temptype, "orig_navi": brokenword[8]}, "pref": brokenword[5], "post": brokenword[6], "len": brokenword[7], "inf": (brokenword[2], brokenword[3], brokenword[4]) } |
ret = {"word": {"id": 0, "navi": u"[" + wordin[0] + u"]", "infix": u"", "type": u"", "orig_navi": "[" + wordin[0] + "]"}, "len": False} |
for word in wordlist: |
word["navi"] = word["navi"].lower() |
foundit = True |
222,13 → 222,13 |
last = u"" |
while last != pref: |
last = pref |
for pre in [x["navi"] for x in prefixes]: |
for pre in prefixes: |
if pref != u"": |
if pref.endswith(pre): |
if pre in foundprefs[wor]: |
if pref.endswith(pre["navi"]): |
if pre["navi"] in foundprefs[wor]: |
break |
foundprefs[wor].append(pre) |
pref = pref[:-len(pre)] |
foundprefs[wor].append((pre["navi"], pre["orig_navi"])) # only needed here, to handle lenition |
pref = pref[:-len(pre["navi"])] |
break |
if pref != u"": |
foundit = False |
242,7 → 242,7 |
if posf.startswith(pos): |
if (pos, posid) in foundposts[wor]: |
break |
if pos != u"ä" or (word["navi"] != u"pey" and word["navi"] != "fey"): # XXX HACK - fix for peyä. THIS SHOULD NOT BE HERE! |
if pos != u"ä" or word["orig_navi"] != u"pey": # XXX HACK - fix for peyä. THIS SHOULD NOT BE HERE! |
foundposts[wor].append((pos, posid)) |
posf = posf[len(pos):] |
break |