User:Flubot/pagefromfile/ευγενής

generateforms2.py

 * 1) !/usr/bin/python
 * 2) -*- coding: utf-8 -*-

import sys, re reload(sys) sys.setdefaultencoding('utf8')

fin = sys.stdin

ch_apo = u'γγ γχ γξ αυγ αυδ αυλ αυμ αυν αυρ αύγ αύδ αύζ αύλ αύμ αύν αύρ αυ αύ ευβ ευγ ευδ ευζ ευλ ευμ ευν ευρ εύβ εύγ εύδ εύζ εύλ εύμ εύν εύρ ευ εύ ϊ α ά β γ δ ε έ ζ η ή θ ι ί κ λ μ ν ξ ου ού ο π ρ σ ς τ υ ύ ϋ φ χ ψ ω ώ ΐ ΰ' ch_se = u'ng nch nx avg avd avl avm avn avr ávg ávd ávz ávl ávm ávn ávr af áφ ev evg evd evz evl evm evn evr év évg évd évz évl évm évn évr ef éf ï a á v g d e é z i í th i í k l m n x ou οú o p r s s t y ý ÿ f ch ps o ó ḯ ÿ́'

trapo = ch_apo.split(u' ') trse = ch_se.split(u' ')

masc = "ής" kl_apo = u'ς ά ό ί ή έ ώ ύ ϊ ϋ ΐ ΰ' kl_se = u'σ α ο ι η ε ω υ ι υ ι υ'

klapo = kl_apo.split(u' ') klse = kl_se.split(u' ')

katalixeis = 'ούς ή είς ών' ktlx = katalixeis.split(u' ') hme = len(ktlx)

riza = re.compile(u'(.*)') eof=0

s = [[' ' for l1 in range(6)] for l2 in range(hme)] n = [] s[0][0]='|g=m|c=gen|n=s}}' s[0][1]='|g=m|c=gen|n=s}}' s[0][2]='|g=n|c=gen|n=s}}' n.append(3) s[1][0]='|g=m|c=acc|n=s}}' s[1][1]='|g=f|c=acc|n=s}}' s[1][2]='|g=n|c=nom|n=p}}' s[1][3]='|g=n|c=acc|n=p}}' s[1][4]='|g=n|c=voc|n=p}}' n.append(5) s[2][0]='|g=m|c=nom|n=p}}' s[2][1]='|g=m|c=acc|n=p}}' s[2][2]='|g=m|c=voc|n=p}}' s[2][3]='|g=f|c=nom|n=p}}' s[2][4]='|g=f|c=acc|n=p}}' s[2][5]='|g=f|c=voc|n=p}}' n.append(6) s[3][0]='|g=m|c=gen|n=p}}' s[3][1]='|g=f|c=gen|n=p}}' s[3][2]='|g=n|c=gen|n=p}}' n.append(3)
 * 1) ούς
 * ή
 * 1) είς
 * ών

def roman(trnsl): for i in range(len(trapo)): trnsl = trnsl.replace(trapo[i], trse[i]) return trnsl

def sortkey(sort): for i in range(len(klapo)): sort = sort.replace(klapo[i], klse[i]) return sort

def makeentries(ri): l = [ ] for i in range(hme): l.append(ri+ktlx[i]) print "xxxx" print "%s" % (l[i]) print "==Greek==\n\n===Adjective===" print "\n" % (roman(l[i])) for j in range(n[i]): print "# {{el-form-of-nounadj|%s%s%s" % (ri, masc, s[i][j]) print "\n{{DEFAULTSORT:%s}}\n" % (sortkey(l[i])) print "{{count page|Page count}}\nyyyy" return 1

while not eof: line = fin.readline if line == "": eof = 1 else: r0 = riza.search(line) r1 = r0.group(1) if r1 != "": makeentries(r1) fin.close