Subversion Repositories navi

Compare Revisions

Ignore whitespace Rev 70 → Rev 74

/tsimapiak/parse2.py
11,17 → 11,16
infixes3 = [u"äng", u"ats", u"eiy", u"ei", u"uy", u""]
#prefixesn = ur"(?P<npr>(?:(?:fì|tsa)?(?:me|pxe|ay|fra)?|(?:fay)?|(?:tsay)?)(?:fne)?(?:tì|sä)?"
prefixes = [u"ay", u"me", u"pxe", u"pe", u"a", u"le", u"nì", u"sä", u"tì", u"ke", u"fì", u"fay", u"tsa", u"tsay", u"fra"]
#postfixesv = ur"(?P<vpr>(?:nì|sä|tì|rä'ä |ke )?)"
#prefixesv = ur"(?P<vpr>(?:nì|sä|tì|rä'ä |ke )?)"
 
def parseword(wordin):
ret = {"word": {"id": 0, "navi": u" ".join(wordin), "infix": u"", "type": u""}}
foundword = u""
for word in wordlist:
foundinf = False
foundit = True
foundprefs = []
foundposts = []
splitword = word["infix"].split(" ")
splitword = word["infix"].split(u" ")
if len(wordin) < len(splitword):
foundit = False
next
40,7 → 39,6
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]
foundinf = True
break
if foundinf: break
if foundinf: break
47,8 → 45,7
else:
if splitword[wor] in wordin[wor]:
center = splitword[wor]
foundinf = True
if not foundinf:
if center == u"":
foundit = False
break
pref, posf = wordin[wor].split(center)
64,8 → 61,8
foundword = word
break
if foundit == True:
ret[0]["pref"] = foundprefs
ret[0]["post"] = foundposts
ret[0]["inf"] = foundins
ret[0]["word"] = foundword
ret["pref"] = foundprefs
ret["post"] = foundposts
ret["inf"] = foundins
ret["word"] = foundword
return ret
/webapp/main.py
62,10 → 62,10
def post(self):
try:
word = self.get_argument("word").strip(u" ")
word = self.get_argument("word").strip()
except:
self.redirect("/parse2")
out = parse2.parseword(word.split(u" "))
out = parse2.parseword(word)
self.render("templates/parse2.html", last=word, out=out)
 
application = tornado.web.Application([