24,10 → 24,11 |
import dbconnector |
import parsenum |
|
wordlist = [{"id": 0, "navi": u"tawtute", "infix": u"tawtute", "type": u"n."}] + dbconnector.getnavilist() + [{"id": 0, "navi": u"na'vi", "infix": u"na'vi", "type": u"n."}] |
#wordlist = [{"id": 0, "navi": u"tawtute", "infix": u"tawtute", "type": u"n."}] + dbconnector.getnavilist() + [{"id": 0, "navi": u"na'vi", "infix": u"na'vi", "type": u"n."}] # XXX HACK - extra proper nouns |
wordlist = dbconnector.getnavilist() |
|
|
brokenwords = ((u"sami", u"si", u"", u"am", u"", (()), (()), False), (u"to", u"to", u"", u"", u"", (()), (()), False), (u"poltxe", u"plltxe", u"", u"ol", u"", (()), (()), False)) # 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 |
brokenwords = ((u"sami", u"si", u"", u"am", u"", (()), (()), False), (u"to", u"to", u"", u"", u"", (()), (()), False), (u"frato", u"to", u"", u"", u"", (((u"fra"))), (()), False), (u"poltxe", u"plltxe", u"", u"ol", u"", (()), (()), False)) # 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. |
infixes1 = (u"awn", u"eyk", u"us", u"äp", u"") |
infixes2 = (u"ìyev", u"iyev", u"ìmìy", u"arm", u"asy", u"ilv", u"ìmv", u"imv", u"ìrm", u"irv", u"ìsy", u"aly", u"ary", u"ìly", u"ìry", u"ìlm", u"alm", u"am", u"ay", u"er", u"ìm", u"iv", u"ìy", u"ol", u"") |
infixes3 = (u"äng", u"ats", u"eiy", u"ei", u"uy", u"") |
42,7 → 43,7 |
def parseword(wordin): |
tempid = 0 |
temptype = u"" |
for brokenword in brokenwords: |
for brokenword in brokenwords: # XXX HACK - this is all code to work around bugs that shouldn't exist |
if wordin[0] == brokenword[0]: |
for word in wordlist: |
if brokenword[1] == word["navi"]: |
51,6 → 52,7 |
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""}} |
for word in wordlist: |
word["navi"] = word["navi"].lower() |
foundit = True |
foundprefs = [] |
foundposts = [] |
93,7 → 95,7 |
else: |
if splitword[wor] in wordin[wor]: |
center = splitword[wor] |
if center == u"" and (wordin[wor] == u"paya" or splitword[wor] != u"pxay"): # XXX - maybe fixable without hardcoding? |
if center == u"" and (wordin[wor] == u"paya" or splitword[wor] != u"pxay"): # XXX HACK - workaround to fix pay being lenited pxay. Maybe fixable without hardcoding? |
for i in lenit: |
temp = u"" |
if splitword[wor].startswith(i[0]): |
140,7 → 142,7 |
if posf.startswith(pos): |
if pos in foundposts[wor]: |
break |
if pos != u"ä" or word["navi"] != u"pey": |
if pos != u"ä" or word["navi"] != u"pey": # XXX HACK - fix for peyä. THIS SHOULD NOT BE HERE! |
foundposts[wor].append(pos) |
posf = posf[len(pos):] |
break |