Subversion Repositories navi

Compare Revisions

Ignore whitespace Rev 186 → Rev 187

/tsimapiak/parse.py
26,6 → 26,8
 
wordlist = dbconnector.getnavilist()
 
 
brokenwords = ((u"sami", u"si", u"", u"am", u"", None, None, False), (u"to", u"to", u"", u"", u"", False), (u"poltxe", u"plltxe", u"", u"ol", u"", None, None, 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! The order is - original, Na'vi root, 0-pos infix, 1-pos infix, 2-pos infix, prefixes, suffixes
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"")
38,6 → 40,15
lenit = ((u"px", u"p"), (u"tx", u"t"), (u"kx", u"k"), (u"ts", u"s"), (u"t", u"s"), (u"p", u"f"), (u"k", u"h"), (u"'", u""))
 
def parseword(wordin):
tempid = 0
temptype = u""
for brokenword in brokenwords:
if wordin == brokenword[0]:
for word in wordlist:
if wordin == word["navi"]:
tempid = word["id"]
temptype = word["partOfSpeech"]
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:
foundit = True
/tsimapiak/translate.py
23,6 → 23,7
import parse
import dbconnector
 
brokenwords = ((u"to", u"than")) # words not in EE
infixes1 = ((u"awn", u"P.PART"), (u"eyk", u"CAUS"), (u"us", u"A.PART"), (u"äp", u"REFL."))
infixes2 = ((u"ìyev", u"FUT.SUBJ"), (u"iyev", u"FUT.SUBJ"), (u"ìmìy", u"REC.PAST.REC.FUT"), (u"arm", u"IMPF.PAST"), (u"asy", u"FUT.D"), (u"ilv", u"PRES.PER.SUBJ"), (u"ìmv", u"REC.PAST.SUBJ"), (u"imv", u"PAST.SUBJ"), (u"ìrm", u"IMPF.REC.PAST"), (u"irv", u"PRES.IMPF.SUBJ"), (u"ìsy", u"IMM.FUT.D"), (u"aly", u"PERF.FUT"), (u"ary", u"IMPF.FUT"), (u"ìly", u"PERF.IMM.FUT"), (u"ìry", u"IMPF.IMM.FUT"), (u"ìlm", u"PERF.REC.PAST"), (u"alm", u"PERF.PAST"), (u"am", u"PAST."), (u"ay", u"FUT."), (u"er", u"IMPF."), (u"ìm", u"REC.PAST"), (u"iv", u"SUBJ."), (u"ìy", u"IMM.FUT"), (u"ol", u"PERF."))
infixes3 = ((u"äng", u"PEJ."), (u"ats", u"INFR."), (u"eiy", u"LAUD."), (u"ei", u"LAUD."), (u"uy", u"HON."))
32,11 → 33,16
 
def translatesent(sent, lang):
sent = parse.parsesent(sent)
word["translated"] = ""
for word in sent:
if word["word"]["id"] != 0:
word["translated"] = dbconnector.translate(word["word"]["id"],lang)
else:
word["translated"] = word["word"]["navi"]
for brokenword in brokenwords:
if brokenword[0] == word["word"]["navi"]:
word["translated"] = brokenword[1]
if word["translated"] = "":
word["translated"] = word["word"]["navi"]
if word["inf"][0] != u"":
for fix in infixes1:
if fix[0] == word["inf"][0]:
49,12 → 55,12
for fix in infixes3:
if fix[0] == word["inf"][2]:
word["translated"] += '-' + fix[1]
for temp in word["pref"]: # double array? WTF?
for temp in word["pref"]: # double array? WTF? EDIT: I get it now
for navf in temp:
for fix in prefixes:
if fix[0] == navf:
word["translated"] += '-' + fix[1]
for temp in word["post"]: # double array? WTF?
for temp in word["post"]: # double array? WTF? EDIT: I get it now
for navf in temp:
for fix in postfixes:
if fix[0] == navf: