Subversion Repositories navi

Rev

Rev 62 | Rev 66 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/usr/bin/python
# -*- coding: utf-8 -*-

import re
import dbconnector

infixes0 = ur"(?P<in0>(?:awn|eyk|us|äp)?)"
infixes1 = ur"(?P<in1>(?:ìyev|iyev|ìmìy|arm|asy|ilv|ìmv|imv|ìrm|irv|ìsy|aly|ary|ìly|ìry|ìlm|alm|am|ay|er|ìm|iv|ìy|ol)?)"
infixes2 = ur"(?P<in2>(?:äng|ats|eiy|ei|uy)?)"
#prefixesn = ur"(?P<npr>(?:(?:fì|tsa)?(?:me|pxe|ay|fra)?|(?:fay)?|(?:tsay)?)(?:fne)?(?:tì|sä)?"
prefixes = ur"((?:ay|me|pxe|pe|a|le|nì|sä|tì|ke|fì|fay|tsa|tsay|fra|ke |kea |rä'ä )*)"
#postfixesv = ur"(?P<vpr>(?:nì|sä|tì|rä'ä |ke )?)"

def parseword(wordin):
    wordfound = [0, u"", u"", u""]
    wordre = None
    ret = [wordfound, u"", u"", u""]
    for word in dbconnector.getnavilist():
        wordre = u" ".join(prefixes + x + ur"(\w*?)" for x in word[2].split(u" ")).replace(u"<0><1>", infixes0 + infixes1).replace(u"<2>",infixes2)
        rem = re.match(wordre,wordin)
        if rem:
            wordfound = word
            ret = [wordfound] + list(rem.groups())
            break
    return ret