User:Flubot/Replacing infl-el-verb with el-verb template

list-el-verbs-needing-inflexion-line
δεσπόζω δέσποσα δηλώνω δήλωσα διατηρώ διατήρησα

el-verb.py

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

import wikipedia import sys, re, codecs import time

spaces_tag = re.compile('([ \*\.,\'\-\(\)]*)') apost_tag = re.compile(u'\’') page_tag = re.compile('(.*)')

wikipedia.setAction('replacing infl|el|verb with el-verb template')

infl_tag = re.compile('\{\{infl\|el\|verb([^\}]*)\}\}(.*)$')

debug_bul = True

ch_apo = u'γγ γχ γξ αυά αυα αύα αύω αύο αύε αυγ αυδ αυλ αυμ αυν αυρ αύγ αύδ αύζ αύλ αύμ αύν αύρ αυ αύ ευη ευή ευα ευά εύω εύε ευό ευο ευί ευβ ευγ ευδ ευζ ευλ ευμ ευν ευρ εύβ εύγ εύδ εύζ εύλ εύμ εύν εύρ ευ εύ ϊ α ά β γ δ ε έ ζ η ή θ ι ί κ λ μ ν ξ ου ού ο π ρ σ ς τ υ ύ ϋ φ χ ψ ω ώ ΐ ΰ' ch_se = u'ng nch nx avá ava áva ávo ávo áve avg avd avl avm avn avr ávg ávd ávz ávl ávm ávn ávr af áφ evi eví eva evá évo éve evó evo eví 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 ó ḯ ÿ́'
 * 1) πίνακες αντιστοίχισης

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

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

fin = codecs.open('list-el-verbs-needing-inflexion-line', 'r', 'utf-8') eof=0 while not eof: time.sleep(3) line = fin.readline if line == "": eof = 1 else: line8 = fin.readline t1 = page_tag.search(line) t = t1.group(1) print(t) aorist = page_tag.search(line8) aoristos = aorist.group(1)
 * 1) Which entry?

page = wikipedia.Page(wikipedia.getSite, t) arxiko = page.get(get_redirect=True)

seires = arxiko.split("\n") kainoyrio = [] for seira in seires: result1 = infl_tag.search(seira) if (result1): seira = '' + result1.group(2) kainoyrio.append(seira) keimeno = "\n".join(kainoyrio)
 * 1) Αντικαταστάσεις

if keimeno != page.get: # Show the title of the page we're working on. # Highlight the title in purple. wikipedia.output(u"\n\n>>> \03{lightpurple}%s\03{default} <<<" % page.title) ## show what was changed wikipedia.showDiff(page.get, keimeno) #choice= 'y'     if debug_bul: choice = wikipedia.inputChoice(u'Do you want to accept these changes?', ['yes', 'No', 'all'], ['y', 'N', 'a'], 'N') if choice == 'a': choice = 'y'         debug_bul = False elif choice != 'y': choice='n'     if choice == 'y': try: # Save the page page.put(keimeno) except wikipedia.IsRedirectPage: wikipedia.output(u'Skipping %s because it is a redirect' % (page.title)) except wikipedia.EditConflict: wikipedia.output(u'Skipping %s because of edit conflict' % (page.title)) except wikipedia.SpamfilterError, error: wikipedia.output(u'Cannot change %s because of spam blacklist entry %s' % (page.title, error.url))
 * 1) Saving changes

fin.close