User:Darkicebot/eov

From Wiktionary, the free dictionary
Jump to navigation Jump to search
# -*- coding: utf-8 -*-  
# Script to make eo-forms

import os
import codecs
import sys

template = u"""
{{-start-}}
<<<{STEM}as>>>
{{subst:new eo form|{STEM}|as}}
{{-stop-}}
{{-start-}}
<<<{STEM}is>>>
{{subst:new eo form|{STEM}|is}}
{{-stop-}}
{{-start-}}
<<<{STEM}os>>>
{{subst:new eo form|{STEM}|os}}
{{-stop-}}
{{-start-}}
<<<{STEM}us>>>
{{subst:new eo form|{STEM}|us}}
{{-stop-}}
{{-start-}}
<<<{STEM}u>>>
{{subst:new eo form|{STEM}|u}}
{{-stop-}}
{{-start-}}
<<<{STEM}anta>>>
{{subst:new eo form|{STEM}|anta}}
{{-stop-}}
{{-start-}}
<<<{STEM}antaj>>>
{{subst:new eo form|{STEM}|antaj}}
{{-stop-}}
{{-start-}}
<<<{STEM}antan>>>
{{subst:new eo form|{STEM}|antan}}
{{-stop-}}
{{-start-}}
<<<{STEM}antajn>>>
{{subst:new eo form|{STEM}|antajn}}
{{-stop-}}
{{-start-}}
<<<{STEM}inta>>>
{{subst:new eo form|{STEM}|inta}}
{{-stop-}}
{{-start-}}
<<<{STEM}intaj>>>
{{subst:new eo form|{STEM}|intaj}}
{{-stop-}}
{{-start-}}
<<<{STEM}intan>>>
{{subst:new eo form|{STEM}|intan}}
{{-stop-}}
{{-start-}}
<<<{STEM}intajn>>>
{{subst:new eo form|{STEM}|intajn}}
{{-stop-}}
{{-start-}}
<<<{STEM}onta>>>
{{subst:new eo form|{STEM}|onta}}
{{-stop-}}
{{-start-}}
<<<{STEM}ontaj>>>
{{subst:new eo form|{STEM}|ontaj}}
{{-stop-}}
{{-start-}}
<<<{STEM}ontan>>>
{{subst:new eo form|{STEM}|ontan}}
{{-stop-}}
{{-start-}}
<<<{STEM}ontajn>>>
{{subst:new eo form|{STEM}|ontajn}}
{{-stop-}}
{{-start-}}
<<<{STEM}ata>>>
{{subst:new eo form|{STEM}|ata}}
{{-stop-}}
{{-start-}}
<<<{STEM}ataj>>>
{{subst:new eo form|{STEM}|ataj}}
{{-stop-}}
{{-start-}}
<<<{STEM}atan>>>
{{subst:new eo form|{STEM}|atan}}
{{-stop-}}
{{-start-}}
<<<{STEM}atajn>>>
{{subst:new eo form|{STEM}|atajn}}
{{-stop-}}
{{-start-}}
<<<{STEM}ita>>>
{{subst:new eo form|{STEM}|ita}}
{{-stop-}}
{{-start-}}
<<<{STEM}itaj>>>
{{subst:new eo form|{STEM}|itaj}}
{{-stop-}}
{{-start-}}
<<<{STEM}itan>>>
{{subst:new eo form|{STEM}|itan}}
{{-stop-}}
{{-start-}}
<<<{STEM}itajn>>>
{{subst:new eo form|{STEM}|itajn}}
{{-stop-}}
{{-start-}}
<<<{STEM}ota>>>
{{subst:new eo form|{STEM}|ota}}
{{-stop-}}
{{-start-}}
<<<{STEM}otaj>>>
{{subst:new eo form|{STEM}|otaj}}
{{-stop-}}
{{-start-}}
<<<{STEM}otan>>>
{{subst:new eo form|{STEM}|otan}}
{{-stop-}}
{{-start-}}
<<<{STEM}otajn>>>
{{subst:new eo form|{STEM}|otajn}}
{{-stop-}}
{{-start-}}
<<<{STEM}anto>>>
{{subst:new eo form|{STEM}|anto}}
{{-stop-}}
{{-start-}}
<<<{STEM}antoj>>>
{{subst:new eo form|{STEM}|antoj}}
{{-stop-}}
{{-start-}}
<<<{STEM}anton>>>
{{subst:new eo form|{STEM}|anton}}
{{-stop-}}
{{-start-}}
<<<{STEM}antojn>>>
{{subst:new eo form|{STEM}|antojn}}
{{-stop-}}
{{-start-}}
<<<{STEM}into>>>
{{subst:new eo form|{STEM}|into}}
{{-stop-}}
{{-start-}}
<<<{STEM}intoj>>>
{{subst:new eo form|{STEM}|intoj}}
{{-stop-}}
{{-start-}}
<<<{STEM}inton>>>
{{subst:new eo form|{STEM}|inton}}
{{-stop-}}
{{-start-}}
<<<{STEM}intojn>>>
{{subst:new eo form|{STEM}|intojn}}
{{-stop-}}
{{-start-}}
<<<{STEM}onto>>>
{{subst:new eo form|{STEM}|onto}}
{{-stop-}}
{{-start-}}
<<<{STEM}ontoj>>>
{{subst:new eo form|{STEM}|ontoj}}
{{-stop-}}
{{-start-}}
<<<{STEM}onton>>>
{{subst:new eo form|{STEM}|onton}}
{{-stop-}}
{{-start-}}
<<<{STEM}ontojn>>>
{{subst:new eo form|{STEM}|ontojn}}
{{-stop-}}
{{-start-}}
<<<{STEM}ato>>>
{{subst:new eo form|{STEM}|ato}}
{{-stop-}}
{{-start-}}
<<<{STEM}atoj>>>
{{subst:new eo form|{STEM}|atoj}}
{{-stop-}}
{{-start-}}
<<<{STEM}aton>>>
{{subst:new eo form|{STEM}|aton}}
{{-stop-}}
{{-start-}}
<<<{STEM}atojn>>>
{{subst:new eo form|{STEM}|atojn}}
{{-stop-}}
{{-start-}}
<<<{STEM}ito>>>
{{subst:new eo form|{STEM}|ito}}
{{-stop-}}
{{-start-}}
<<<{STEM}itoj>>>
{{subst:new eo form|{STEM}|itoj}}
{{-stop-}}
{{-start-}}
<<<{STEM}iton>>>
{{subst:new eo form|{STEM}|iton}}
{{-stop-}}
{{-start-}}
<<<{STEM}itojn>>>
{{subst:new eo form|{STEM}|itojn}}
{{-stop-}}
{{-start-}}
<<<{STEM}oto>>>
{{subst:new eo form|{STEM}|oto}}
{{-stop-}}
{{-start-}}
<<<{STEM}otoj>>>
{{subst:new eo form|{STEM}|otoj}}
{{-stop-}}
{{-start-}}
<<<{STEM}oton>>>
{{subst:new eo form|{STEM}|oton}}
{{-stop-}}
{{-start-}}
<<<{STEM}otojn>>>
{{subst:new eo form|{STEM}|otojn}}
{{-stop-}}
{{-start-}}
<<<{STEM}ante>>>
{{subst:new eo form|{STEM}|ante}}
{{-stop-}}
{{-start-}}
<<<{STEM}inte>>>
{{subst:new eo form|{STEM}|inte}}
{{-stop-}}
{{-start-}}
<<<{STEM}onte>>>
{{subst:new eo form|{STEM}|onte}}
{{-stop-}}
{{-start-}}
<<<{STEM}ate>>>
{{subst:new eo form|{STEM}|ate}}
{{-stop-}}
{{-start-}}
<<<{STEM}ite>>>
{{subst:new eo form|{STEM}|ite}}
{{-stop-}}
{{-start-}}
<<<{STEM}ote>>>
{{subst:new eo form|{STEM}|ote}}
{{-stop-}}

"""

def main():
    global template
    if len(sys.argv) != 2:
        print "Usage: %s STEM" % sys.argv[0]
        return

    sys.argv[1] = sys.argv[1].replace("{c}", u"ĉ").replace("{g}", u"ĝ").replace("{h}", u"ĥ").replace("{j}", u"ĵ").replace("{s}", u"ŝ").replace("{u}", u"ŭ")
    f = codecs.open("eo.txt", "a", "utf-8")
    f.write(template.replace(u"{STEM}", sys.argv[1])) 
    f.close()
    print "Done [[%s]]! now `python eo.py`" % sys.argv[1].encode('utf-8')

if __name__ == "__main__":
    main()