Subversion Repositories navi

Rev

Rev 54 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
56 szabot 1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
 
4
import re
5
import dbconnector
6
 
7
infixes0 = ur"(?P<in0>(?:awn|eyk|us|äp)?)"
8
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)?)"
9
infixes2 = ur"(?P<in2>(?:äng|ats|eiy|ei|uy)?)"
62 szabot 10
#prefixesn = ur"(?P<npr>(?:(?:fì|tsa)?(?:me|pxe|ay|fra)?|(?:fay)?|(?:tsay)?)(?:fne)?(?:tì|sä)?"
11
prefixes = ur"((?:ay|me|pxe|pe|a|le|nì|sä|tì|ke|fì|fay|tsa|tsay|fra|ke |kea |rä'ä )*)"
12
#postfixesv = ur"(?P<vpr>(?:nì|sä|tì|rä'ä |ke )?)"
56 szabot 13
 
14
def parseword(wordin):
15
    wordfound = [0, u"", u"", u""]
16
    wordre = None
17
    ret = [wordfound, u"", u"", u""]
18
    for word in dbconnector.getnavilist():
62 szabot 19
        wordre = u" ".join(prefixes + x + ur"(\w*?)" for x in word[2].split(u" ")).replace(u"<0><1>", infixes0 + infixes1).replace(u"<2>",infixes2)
56 szabot 20
        rem = re.match(wordre,wordin)
21
        if rem:
22
            wordfound = word
63 szabot 23
            ret = [wordfound] + list(rem.groups())
56 szabot 24
            break
25
    return ret