30,12 → 30,12 |
|
|
numre = \ |
u"^(?:(" + "|".join(base) + u")zazam??)?" + \ |
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"))?$" |
u"(?:" + "|".join(num) + u"))?(ve?)(a?)$" |
numre = re.compile(numre) |
|
def parse(numin): |
51,30 → 51,34 |
numout = 0 |
numoct = 0 |
try: |
numout += rem.index(mat[4]) + 1 |
numoct += rem.index(mat[4]) + 1 |
numout += rem.index(mat[5]) + 1 |
numoct += rem.index(mat[5]) + 1 |
except: |
try: |
numout += num.index(mat[4]) |
numoct += num.index(mat[4]) |
numout += num.index(mat[5]) |
numoct += num.index(mat[5]) |
except: pass |
try: |
numout += (base.index(mat[3]) + 1) * 8 |
numoct += (base.index(mat[3]) + 1) * 10 |
numout += (base.index(mat[4]) + 1) * 8 |
numoct += (base.index(mat[4]) + 1) * 10 |
except: pass |
try: |
numout += (base.index(mat[2]) + 1) * 8**2 |
numoct += (base.index(mat[2]) + 1) * 10**2 |
numout += (base.index(mat[3]) + 1) * 8**2 |
numoct += (base.index(mat[3]) + 1) * 10**2 |
except: pass |
try: |
numout += (base.index(mat[1]) + 1) * 8**3 |
numoct += (base.index(mat[1]) + 1) * 10**3 |
numout += (base.index(mat[2]) + 1) * 8**3 |
numoct += (base.index(mat[2]) + 1) * 10**3 |
except: pass |
try: |
numout += (base.index(mat[0]) + 1) * 8**4 |
numoct += (base.index(mat[0]) + 1) * 10**4 |
numout += (base.index(mat[1]) + 1) * 8**4 |
numoct += (base.index(mat[1]) + 1) * 10**4 |
except: pass |
return numout, numoct |
retnum = unicode(numout) |
if mat[6] != u"": |
retnum += u"." |
return {"word": {"id": 0, "navi": retnum, "infix": u"", "type": u""}, "pref": [mat[0]], "post": [mat[6], mat[7]], "inf": [u"", u"", u""], "len": False, "dec": numout, "oct": numdec} |
#return numout, numoct |
|
|
if __name__ == "__main__": |