/GPL |
---|
File deleted |
/LICENCE |
---|
File deleted |
/APACHE_LICENCE |
---|
File deleted |
/webapp/main.py |
---|
1,26 → 1,6 |
#!/usr/bin/python |
# -*- coding: utf-8 -*- |
# This file is part of Tsim Apiak. |
# |
# Tsim Apiak is free software: you can redistribute it and/or modify |
# it under the terms of the GNU General Public Licence as published by |
# the Free Software Foundation, either version 3 of the Licence, or |
# (at your option) any later version. |
# |
# In addition to this, you must also comply with clause 4 of the |
# Apache Licence, version 2.0, concerning attribution. Where there |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar 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. |
# |
# You should have received a copy of the GNU General Public License |
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>. |
import tornado.httpserver |
import tornado.ioloop |
import tornado.web |
108,4 → 88,4 |
http_server = tornado.httpserver.HTTPServer(application) |
http_server.listen(1337) |
#tornado.autoreload.start() |
tornado.ioloop.IOLoop.instance().start() |
tornado.ioloop.IOLoop.instance().start() |
/webapp/templates/translate.html |
---|
3,45 → 3,23 |
{% block title %}Translator{% end %} |
{% block body %} |
<!-- |
# This file is part of Tsim Apiak. |
# |
# Tsim Apiak is free software: you can redistribute it and/or modify |
# it under the terms of the GNU General Public Licence as published by |
# the Free Software Foundation, either version 3 of the Licence, or |
# (at your option) any later version. |
# |
# In addition to this, you must also comply with clause 4 of the |
# Apache Licence, version 2.0, concerning attribution. Where there |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar 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. |
# |
# You should have received a copy of the GNU General Public License |
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>. |
--> |
<b>Na'vi sentence:</b><br /> |
<form action="/translate" method="post"> |
<input id="word" name="word" type="text" value="{{last}}" style="width: 100%;" /> |
<select name="lang" id="lang"> |
<option value="eng" selected="selected">English</option> |
<option value="hu">Hungarian - Magyar</option> |
<option value="de">German - Deutsch</option> |
<option value="est">Estonian - Eesti</option> |
<option value="ptbr">Brazilian Portuguese - Português do Brasil</option> |
<select name="lang"> |
<option id="eng" value="eng" selected="selected">English</option> |
<option id="hu" value="hu">Hungarian - Magyar</option> |
<option id="de" value="de">German - Deutsch</option> |
<option id="est" value="est">Estonian - Eesti</option> |
<option id="ptbr" value="ptbr">Brazilian Portuguese - Português do Brasil</option> |
</select> |
<input name="btn" type="submit" value="Translate!" /> |
<input name="btn" type="submit" value="Parse!" /> |
</form> |
{% if out %} |
<table border="1"> |
<tr> |
<th>Words</th> |
<th>Translated</th> |
<th>English</th> |
<th>Parts</th> |
<th>Data</th> |
</tr> |
73,18 → 51,7 |
</script> |
{% if lang != "eng" %} |
<script type="text/javascript"> |
if("{{ lang }}" == "hu"){ |
document.getElementById("lang").selectedIndex = 1 |
} |
if("{{ lang }}" == "de"){ |
document.getElementById("lang").selectedIndex = 2 |
} |
if("{{ lang }}" == "est"){ |
document.getElementById("lang").selectedIndex = 3 |
} |
if("{{ lang }}" == "ptbr"){ |
document.getElementById("lang").selectedIndex = 4 |
} |
document.getElementById(lang).selected = "selected" |
</script> |
{% end %} |
{% end %} |
{% end %} |
/webapp/templates/parse.html |
---|
3,28 → 3,6 |
{% block title %}Sentence parser{% end %} |
{% block body %} |
<!-- |
# This file is part of Tsim Apiak. |
# |
# Tsim Apiak is free software: you can redistribute it and/or modify |
# it under the terms of the GNU General Public Licence as published by |
# the Free Software Foundation, either version 3 of the Licence, or |
# (at your option) any later version. |
# |
# In addition to this, you must also comply with clause 4 of the |
# Apache Licence, version 2.0, concerning attribution. Where there |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar 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. |
# |
# You should have received a copy of the GNU General Public License |
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>. |
--> |
<b>Na'vi sentence:</b><br /> |
<form action="/parse" method="post"> |
<input id="word" name="word" type="text" value="{{last}}" style="width: 100%;" /> |
/webapp/templates/base.html |
---|
1,25 → 1,4 |
<html> |
<!-- |
# This file is part of Tsim Apiak. |
# |
# Tsim Apiak is free software: you can redistribute it and/or modify |
# it under the terms of the GNU General Public Licence as published by |
# the Free Software Foundation, either version 3 of the Licence, or |
# (at your option) any later version. |
# |
# In addition to this, you must also comply with clause 4 of the |
# Apache Licence, version 2.0, concerning attribution. Where there |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar 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. |
# |
# You should have received a copy of the GNU General Public License |
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>. |
--> |
<head> |
<title>Tsim Apiak - {% block title %}Title{% end %}</title> |
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" /> |
52,7 → 31,6 |
<body> |
<div id="center"> |
<h1>Tsim Apiak</h1> |
<h2>By Muzer and szabot</h2> |
<h2>{% block title %}Title{% end %}</h2> |
{% block body %}Body{% end %} |
</div> |
/webapp/templates/index.html |
---|
3,29 → 3,6 |
{% block title %}Home{% end %} |
{% block body %} |
<!-- |
# This file is part of Tsim Apiak. |
# |
# Tsim Apiak is free software: you can redistribute it and/or modify |
# it under the terms of the GNU General Public Licence as published by |
# the Free Software Foundation, either version 3 of the Licence, or |
# (at your option) any later version. |
# |
# In addition to this, you must also comply with clause 4 of the |
# Apache Licence, version 2.0, concerning attribution. Where there |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar 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. |
# |
# You should have received a copy of the GNU General Public License |
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>. |
--> |
<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="/translate"><b>Translator</b></a> - this webapp translates full Na'vi sentences into human languages, as well as any affixes into the technical abbreviations. |
<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 currently translate the words, but that will come. |
{% end %} |
/webapp/templates/number.html |
---|
3,28 → 3,6 |
{% block title %}Number translator{% end %} |
{% block body %} |
<!-- |
# This file is part of Tsim Apiak. |
# |
# Tsim Apiak is free software: you can redistribute it and/or modify |
# it under the terms of the GNU General Public Licence as published by |
# the Free Software Foundation, either version 3 of the Licence, or |
# (at your option) any later version. |
# |
# In addition to this, you must also comply with clause 4 of the |
# Apache Licence, version 2.0, concerning attribution. Where there |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar 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. |
# |
# You should have received a copy of the GNU General Public License |
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>. |
--> |
<b>Na'vi number:</b><br /> |
<form action="/number" method="post"> |
<input id="num" name="num" type="text" value="{{last}}" style="width: 100%;" /> |
39,4 → 17,4 |
<script type="text/javascript"> |
document.getElementById("num").focus(); |
</script> |
{% end %} |
{% end %} |
/webapp/static/favicon.ico |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/tsimapiak/translate.py |
---|
1,35 → 1,5 |
#!/usr/bin/python |
# -*- coding: utf-8 -*- |
# This file is part of Tsim Apiak. |
# |
# Tsim Apiak is free software: you can redistribute it and/or modify |
# it under the terms of the GNU General Public Licence as published by |
# the Free Software Foundation, either version 3 of the Licence, or |
# (at your option) any later version. |
# |
# In addition to this, you must also comply with clause 4 of the |
# Apache Licence, version 2.0, concerning attribution. Where there |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar 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. |
# |
# You should have received a copy of the GNU General Public License |
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>. |
import parse |
import dbconnector |
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.")) |
prefixes = ((u"tsay", u"those"), (u"say", u"those-LENTD"), (u"fay", u"these"), (u"fra", u"every"), (u"pxe", u"TRI."), (u"fne", u"type"), (u"tsa", u"that"), (u"sa", u"that-LENTD"), (u"pe", u"what"), (u"fe", u"what-LENTD"), (u"le", u"ADJD."), (u"nì", u"ADVD."), (u"sä", u"INSTD."), (u"tì", u"NOUND."), (u"sì", u"NOUND.-LENTD"), (u"ay", u"PL."), (u"me", u"DU."), (u"fì", u"this"), (u"ke", u"not"), (u"he", u"not-LENTD"), (u"a", u"ADJ.POST")) |
adpositions = ((u"mungwrr", u"except"), (u"kxamlä", u"through"), (u"pximaw", u"right.after"), (u"pxisre", u"right.before"), (u"tafkip", u"from.up.among"), (u"nemfa", u"into.inside"), (u"takip", u"from among"), (u"mìkam", u"between"), (u"teri", u"about.concerning"), (u"fkip", u"up.among"), (u"luke", u"without"), (u"pxel", u"like.as"), (u"pxaw", u"around"), (u"rofa", u"beside.alongside"), (u"ìlä", u"by.via.following"), (u"fpi", u"for.the.sake/benefit.of"), (u"ftu", u"from.direction"), (u"kip", u"among"), (u"lok", u"close.to"), (u"maw", u"after.time"), (u"sre", u"before.time"), (u"sìn", u"on.onto"), (u"vay", u"up.to"), (u"eo", u"before.in.front.of"), (u"fa", u"with.by.means.of"), (u"hu", u"with.accompaniment"), (u"io", u"above"), (u"ka", u"across"), (u"mì", u"in.on"), (u"na", u"like.as"), (u"ne", u"to.towards"), (u"ro", u"at.locative"), (u"ta", u"from"), (u"uo", u"behind"), (u"wä", u"against.opposition"), (u"äo", u"below"), (u"to", u"than"), (u"sì", u"and")) |
postfixes = adpositions + ((u"tsyìp", u"DIM."), (u"eyä", u"GEN."), (u"ìri", u"TOP."), (u"ìl", u"ERG."), (u"it", u"ACC"), (u"lo", u"MULT."), (u"ri", u"TOP."), (u"ru", u"DAT."), (u"ti", u"ACC."), (u"ur", u"DAT."), (u"ve", u"ORD."), (u"yä", u"GEN."), (u"ya", u"VOC."), (u"tu", u"OBJD."), (u"vi", u"PART."), (u"yu", u"AGENTD."), (u"an", u"MASC."), (u"ng", u"INCL."), (u"ke", u"not"), (u"e", u"FEM."), (u"o", u"INDEF."), (u"l", u"ERG."), (u"t", u"ACC."), (u"y", u"GEN."), (u"a", u"ADJ.PRE"), (u"ä", u"GEN."), (u"r", u"DAT.")) |
def translatesent(sent, lang): |
sent = parse.parsesent(sent) |
for word in sent: |
37,28 → 7,4 |
word["translated"] = dbconnector.translate(word["word"]["id"],lang) |
else: |
word["translated"] = word["word"]["navi"] |
if word["inf"][0] != u"": |
for fix in infixes1: |
if fix[0] == word["inf"][0]: |
word["translated"] += '-' + fix[1] |
if word["inf"][1] != u"": |
for fix in infixes2: |
if fix[0] == word["inf"][1]: |
word["translated"] += '-' + fix[1] |
if word["inf"][2] != u"": |
for fix in infixes3: |
if fix[0] == word["inf"][2]: |
word["translated"] += '-' + fix[1] |
for temp in word["pref"]: # double array? WTF? |
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 navf in temp: |
for fix in postfixes: |
if fix[0] == navf: |
word["translated"] += '-' + fix[1] |
if word["len"]: |
word["translated"] += '-' + 'LENTD' |
return sent |
return sent |
/tsimapiak/parsenum.py |
---|
1,24 → 1,5 |
#!/usr/bin/python |
# -*- coding: utf-8 -*- |
# This file is part of Tsim Apiak. |
# |
# Tsim Apiak is free software: you can redistribute it and/or modify |
# it under the terms of the GNU General Public Licence as published by |
# the Free Software Foundation, either version 3 of the Licence, or |
# (at your option) any later version. |
# |
# In addition to this, you must also comply with clause 4 of the |
# Apache Licence, version 2.0, concerning attribution. Where there |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar 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. |
# |
# You should have received a copy of the GNU General Public License |
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>. |
num = [u"kew", |
u"'aw", |
145,4 → 126,4 |
return None |
if __name__ == "__main__": |
print parse(u"mevolawve") |
print parse(u"mevolawve") |
/tsimapiak/parse.py |
---|
1,24 → 1,5 |
#!/usr/bin/python |
# -*- coding: utf-8 -*- |
# This file is part of Tsim Apiak. |
# |
# Tsim Apiak is free software: you can redistribute it and/or modify |
# it under the terms of the GNU General Public Licence as published by |
# the Free Software Foundation, either version 3 of the Licence, or |
# (at your option) any later version. |
# |
# In addition to this, you must also comply with clause 4 of the |
# Apache Licence, version 2.0, concerning attribution. Where there |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar 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. |
# |
# You should have received a copy of the GNU General Public License |
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>. |
import re |
import dbconnector |
29,8 → 10,8 |
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"") |
prefixes = (u"tsay", u"say", u"fay", u"fra", u"pxe", u"fne", u"tsa", u"sa", u"pe", u"fe", u"le", u"nì", u"sä", u"tì", u"sì", u"ay", u"me", u"fì", u"ke", u"he", u"a") |
adpositions = (u"mungwrr", u"kxamlä", u"pximaw", u"pxisre", u"tafkip", u"nemfa", u"takip", u"mìkam", u"teri", u"fkip", u"luke", u"pxel", u"pxaw", u"rofa", u"ìlä", u"fpi", u"ftu", u"kip", u"lok", u"maw", u"sre", u"sìn", u"vay", u"eo", u"fa", u"hu", u"io", u"ka", u"mì", u"na", u"ne", u"ro", u"ta", u"uo", u"wä", u"äo", u"to", u"sì") |
prefixes = (u"tsay", u"fay", u"fra", u"pxe", u"fne", u"tsa", u"pe", u"le", u"nì", u"sä", u"tì", u"ay", u"me", u"fì", u"ke", u"a") |
adpositions = (u"mungwrr", u"kxamlä", u"pximaw", u"pxisre", u"tafkip", u"nemfa", u"takip", u"mìkam", u"teri", u"fkip", u"luke", u"pxel", u"pxaw", u"rofa", u"ìla", u"fpi", u"ftu", u"kip", u"lok", u"maw", u"sre", u"sìn", u"vay", u"eo", u"fa", u"hu", u"io", u"ka", u"mì", u"na", u"ne", u"ro", u"ta", u"uo", u"wä", u"äo", u"to") |
postfixes = adpositions + (u"tsyìp", u"eyä", u"ìri", u"ìl", u"it", u"lo", u"ri", u"ru", u"ti", u"ur", u"ve", u"yä", u"ya", u"tu", u"vi", u"yu", u"an", u"ng", u"ke", u"e", u"o", u"l", u"t", u"y", u"a", u"ä", u"r") |
#prefixesn = ur"(?P<npr>(?:(?:fì|tsa)?(?:me|pxe|ay|fra)?|(?:fay)?|(?:tsay)?)(?:fne)?(?:tì|sä)?" |
#prefixesv = ur"(?P<vpr>(?:nì|sä|tì|rä'ä |ke )?)" |
45,7 → 26,6 |
foundposts = [] |
lenited = False |
splitword = word["infix"].split(u" ") |
foundins = [u"", u"", u""] |
if len(wordin) < len(splitword): |
foundit = False |
next |
55,6 → 35,7 |
foundprefs.append([]) |
foundposts.append([]) |
center = u"" |
foundins = [u"", u"", u""] |
pre = [] |
post = [] |
if u"<1>" in splitword[wor]: |
84,7 → 65,7 |
if temp in wordin[wor]: |
center = temp |
if splitword[wor].endswith(u"po"): |
temp = splitword[wor][:-2] + u"p" |
temp = splitword[wor][:-3] + u"p" |
if temp in wordin[wor]: |
center = temp |
if center == u"": |
/tsimapiak/dbconnector.py |
---|
1,26 → 1,6 |
#!/usr/bin/python |
# -*- coding: utf-8 -*- |
# This file is part of Tsim Apiak. |
# |
# Tsim Apiak is free software: you can redistribute it and/or modify |
# it under the terms of the GNU General Public Licence as published by |
# the Free Software Foundation, either version 3 of the Licence, or |
# (at your option) any later version. |
# |
# In addition to this, you must also comply with clause 4 of the |
# Apache Licence, version 2.0, concerning attribution. Where there |
# is a contradiction between the two licences, the GPL |
# takes preference. |
# |
# Foobar 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. |
# |
# You should have received a copy of the GNU General Public License |
# along with Tsim Apiak. If not, see <http://www.gnu.org/licenses/>. |
import tornado.database |
import re |
49,4 → 29,4 |
ret = row["localized"] |
break |
db.close() |
return ret |
return ret |