/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 == 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 |
58,9 → 69,21 |
pre = [] |
post = [] |
if u"<1>" in splitword[wor]: |
tempin1 = [] |
tempin2 = [] |
tempin3 = [] |
for in1 in infixes1: |
for in2 in infixes2: |
for in3 in infixes3: |
if in1 in wordin[wor]: |
tempin1.append(in1) |
for in2 in infixes2: |
if in2 in wordin[wor]: |
tempin2.append(in2) |
for in3 in infixes3: |
if in3 in wordin[wor]: |
tempin3.append(in3) |
for in1 in tempin1: |
for in2 in tempin2: |
for in3 in tempin3: |
if splitword[wor].replace(u"<1><2>",in1+in2).replace(u"<3>",in3) in wordin[wor]: |
center = splitword[wor].replace(u"<1><2>",in1+in2).replace(u"<3>",in3) |
foundins = [in1, in2, in3] |
/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.")) |
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: |
/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. |
26,6 → 26,6 |
--> |
<a href="/number"><b>Number translator</b></a> - this webapp allows you to translate written-out Na'vi numbers into decimal and octal.<br /> |
<a href="/parse"><b>Parser</b></a> - this webapp can parse Na'vi sentences into the base words, prefixes, infixes and suffixes. It does not translate the words. |
<a href="/parse"><b>Parser</b></a> - this webapp can parse Na'vi sentences into the base words, prefixes, infixes and suffixes. It does not translate the words.<br /> |
<a href="/translate"><b>Translator</b></a> - this webapp translates full Na'vi sentences into human languages, as well as any affixes into the technical abbreviations. |
{% end %} |
/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. |
52,7 → 52,7 |
<body> |
<div id="center"> |
<h1>Tsim Apiak</h1> |
<h2>By Muzer and szabot</h2> |
<h2>By Sh4rK and Muzer</h2> |
<h2>{% block title %}Title{% end %}</h2> |
{% block body %}Body{% end %} |
</div> |
/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. |