/tsimapiak/parse.py |
---|
12,7 → 12,7 |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar is distributed in the hope that it will be useful, |
# Tsim Apiak is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
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[0] == brokenword[0]: |
for word in wordlist: |
if wordin[0] == 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 |
46,9 → 57,6 |
lenited = False |
splitword = word["infix"].split(u" ") |
foundins = [u"", u"", u""] |
tempin1 = [] |
tempin2 = [] |
tempin3 = [] |
if len(wordin) < len(splitword): |
foundit = False |
next |
61,6 → 69,9 |
pre = [] |
post = [] |
if u"<1>" in splitword[wor]: |
tempin1 = [] |
tempin2 = [] |
tempin3 = [] |
for in1 in infixes1: |
if in1 in wordin[wor]: |
tempin1.append(in1) |
/tsimapiak/translate.py |
---|
12,7 → 12,7 |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar is distributed in the hope that it will be useful, |
# Tsim Apiak is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
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.")) |
33,9 → 34,14 |
def translatesent(sent, lang): |
sent = parse.parsesent(sent) |
for word in sent: |
word["translated"] = "" |
if word["word"]["id"] != 0: |
word["translated"] = dbconnector.translate(word["word"]["id"],lang) |
else: |
for brokenword in brokenwords: |
if brokenword[0] == word["word"]["navi"]: |
word["translated"] = brokenword[1] |
if word["translated"] == u"": |
word["translated"] = word["word"]["navi"] |
if word["inf"][0] != u"": |
for fix in infixes1: |
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: |
/tsimapiak/parsenum.py |
---|
12,7 → 12,7 |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar is distributed in the hope that it will be useful, |
# Tsim Apiak is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
/tsimapiak/dbconnector.py |
---|
12,7 → 12,7 |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar is distributed in the hope that it will be useful, |
# Tsim Apiak is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
/LICENCE |
---|
8,7 → 8,7 |
is a contradiction between the two licences, the GPL |
takes preference. |
Foobar is distributed in the hope that it will be useful, |
Tsim Apiak is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
/webapp/main.py |
---|
12,7 → 12,7 |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar is distributed in the hope that it will be useful, |
# Tsim Apiak is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
/webapp/templates/translate.html |
---|
16,7 → 16,7 |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar is distributed in the hope that it will be useful, |
# Tsim Apiak is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
/webapp/templates/index.html |
---|
16,7 → 16,7 |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar is distributed in the hope that it will be useful, |
# Tsim Apiak is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
/webapp/templates/number.html |
---|
16,7 → 16,7 |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar is distributed in the hope that it will be useful, |
# Tsim Apiak is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
/webapp/templates/base.html |
---|
12,7 → 12,7 |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar is distributed in the hope that it will be useful, |
# Tsim Apiak is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
/webapp/templates/parse.html |
---|
16,7 → 16,7 |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar is distributed in the hope that it will be useful, |
# Tsim Apiak is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |