/tsimapiak/parsenum.py |
---|
12,6 → 12,15 |
u"pukap", |
u"kinä"] |
numord = [u"kewve", |
u"'awve", |
u"muve", |
u"pxeyve", |
u"tsìve", |
u"mrrve", |
u"puve", |
u"kive"] |
rem = [u"aw", |
u"mun", |
u"pey", |
20,6 → 29,14 |
u"fu", |
u"hin"] |
remord = [u"awve", |
u"muve", |
u"peyve", |
u"sìve", |
u"mrrve", |
u"fuve", |
u"hive"] |
base = [u"", |
u"me", |
u"pxe", |
30,12 → 47,12 |
numre = \ |
u"^(a?)(?:(" + "|".join(base) + u")zazam??)?" + \ |
u"(?:(" + "|".join(base) + u")vozam??)?" + \ |
u"(?:(" + "|".join(base) + u")zam??)?" + \ |
u"(?:(" + "|".join(base) + u")vo(?:l(?=a|))?)?" + \ |
u"((?:" + "|".join(rem) + u")|" + \ |
u"(?:" + "|".join(num) + u"))?((?:ve)?)(a?)$" |
u"^(a?)(?:(?:(" + "|".join(base) + u")zaza(?=m)(?:ve(?=$))?)?" + \ |
u"(?:(" + "|".join(base) + u")voza(?=m)(?:ve(?=$))?)?" + \ |
u"(?:(" + "|".join(base) + u")za(?=m)(?:ve(?=$))?)?" + \ |
u"(?:(" + "|".join(base) + u")(?:vol|vo(?=a|$))(?:ve(?=$))?)?" + \ |
u"(?:" + "|".join(remord + rem) + u"))|" + \ |
u"(?:" + "|".join(numord + num) + u")?(a?)$" |
numre = re.compile(numre) |
def parse(numin): |
/tsimapiak/parse.py |
---|
128,4 → 128,4 |
word = parseword(sent[-left:]) |
left -= len(word["word"]["navi"].split(" ")) |
ret.append(word) |
return ret |
return ret |
/tsimapiak/dbconnector.py |
---|
32,18 → 32,4 |
else: |
ret.append({"id": row["id"], "navi": row["navi"], "infix": row["navi"].lower(), "type": row["partOfSpeech"]}) |
db.close() |
return ret |
#def gettrans(id, cod): |
#ret = [] |
#if cod not in (u"est",u"ptbr",u"de",u"eng",u"all"): |
#return ret |
#db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi") |
#if cod == "all": |
#for row in db.query(""" |
#SELECT * |
#FROM `metaWords` |
#WHERE id = ?""",idd): |
#infix = makeinfix(row) |
#ret.append([row["id"],row["navi"], infix, row["partOfSpeech"]]) |
#db.close() |
return ret |
/webapp/static/favicon.ico |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/webapp/static/favicon.ico |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: webapp/templates/parse.html |
=================================================================== |
--- webapp/templates/parse.html (revision 121) |
+++ webapp/templates/parse.html (revision 133) |
@@ -1,9 +1,9 @@ |
{% extends "base.html" %} |
-{% block title %}Word parser{% end %} |
+{% block title %}Sentence parser{% end %} |
{% block body %} |
-Na'vi word: |
+Na'vi sentence: |
@@ -36,8 +36,8 @@ |
{% end %} |
This program uses Eana Eltu for the list of words and infix positions (but nothing else), created by Tuiq and Taronyu. Thanks also go to the rest of the Learn Na'vi community!
This program uses Eana Eltu for the list of words and infix positions (but nothing else), created by Tuiq and Taronyu. Thanks also go to the rest of the Learn Na'vi community!
/webapp/templates/base.html |
---|
1,6 → 1,7 |
<html> |
<head> |
<title>Tsim Apiak - {% block title %}Title{% end %}</title> |
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" /> |
<style type="text/css"> |
body { |
background: #145179; |
/webapp/templates/index.html |
---|
0,0 → 1,8 |
{% extends "base.html" %} |
{% block title %}Home{% end %} |
{% block body %} |
<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 currently translate the words, but that will come. |
{% end %} |
/webapp/templates/number.html |
---|
17,4 → 17,4 |
<script type="text/javascript"> |
document.getElementById("num").focus(); |
</script> |
{% end %} |
{% end %} |
/webapp/main.py |
---|
15,7 → 15,7 |
class Index(tornado.web.RequestHandler): |
def get(self): |
self.redirect("/number") |
self.render("templates/index.html") |
class Number(tornado.web.RequestHandler): |
def get(self): |
57,6 → 57,10 |
out = parse.parsesent(word) |
self.render("templates/parse.html", last=word, out=out) |
settings = { |
"static_path": os.path.join(os.path.dirname(__file__), "static") |
} |
application = tornado.web.Application([ |
("/", Index), |
("/number", Number), |
63,10 → 67,10 |
("/restart", Restart), |
("/testdb", TestDB), |
("/parse", Parse) |
]) |
], **settings) |
if __name__ == "__main__": |
http_server = tornado.httpserver.HTTPServer(application) |
http_server.listen(1337) |
#tornado.autoreload.start() |
tornado.ioloop.IOLoop.instance().start() |
tornado.ioloop.IOLoop.instance().start() |