User:SemperBlottoBot/adjectives

Hello, you have come here looking for the meaning of the word User:SemperBlottoBot/adjectives. In DICTIOUS you will not only get to know all the dictionary meanings for the word User:SemperBlottoBot/adjectives, but we will also tell you about its etymology, its characteristics and you will know how to say User:SemperBlottoBot/adjectives in singular and plural. Everything you need to know about the word User:SemperBlottoBot/adjectives you have here. The definition of the word User:SemperBlottoBot/adjectives will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofUser:SemperBlottoBot/adjectives, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
  • itadjs.py
#coding: utf-8
"""
This module reads a file of Italian adjectives and generates the feminine and plural forms.
"""
__version__='$Id: Exp $'

import wikipedia, config
import re, sys, codecs

mysite = wikipedia.getSite()
commenttext = 'Auto-generated Italian adjective forms'
global itadjs, fs, mp, fp, mfp
itadjs = 
fs = ""
mp = ""
fp = ""
mfp = ""

def doargform(form, ms, type):
    if form == "":
        return
    if type == "fs":
        gender = "f"
        text1 = "{{feminine of|[["
        text2 = "]]}}"
    elif type == "mp":
        gender = "m"
        text1 = "Plural form of [["
        text2 = "]]"
    elif type == "fp":
        gender = "f"
        text1 = "Feminine plural form of [["
        text2 = "]]"
    else:
        gender = "m|f"
        text1 = "Plural form of [["
        text2 = "]]"
    newpage = "==Italian==" + '\n\n' + "===Adjective===" + '\n'
    newpage = newpage + "'''" + form + "'''" + " {{" + gender + "}}" + '\n\n'
    newpage = newpage + "# " + text1 + ms + text2 + '\n' + "]"
    page = wikipedia.Page(mysite, form)
    if page.exists():
        old_text = page.get()
        if not re.search(r'==\s*Italian\s*==', old_text):
            contents = old_text + '\n\n----\n'  + newpage + '\n{{rfc-auto}}\n'
            commenttext_add = commenttext + " - appended"
            wikipedia.output(u"Page %s already exists, adding to entry!"%form)
            page.put(contents, comment = commenttext_add, minorEdit = False)
        else:
            wikipedia.output(u"Page %s already exists with Italian section, not adding!"%form)
    else:
        page.put(newpage, comment = commenttext, minorEdit = True) # was False (see above)

def findadjforms(ms):
    global itadjs, fs, mp, fp, mfp
    page = wikipedia.Page(mysite, ms)
    text = page.get()
    x = text.find("{{it-adj|")
    if x == -1:
        print "No template found"
        itadjs.append(ms)
        return ""
    text = text
    x = text.find("}}")
    text = text
    x = text.find("|")
    if x > 0:
        stem = text
    else:
        stem = text
    text = text
    x = text.find("|")
    if x < 1: # No extra parameters
        fs = stem + "a"
        mp = stem + "i"
        fp = stem + "e"
        mfp = ""
    else:
        text = text
        x = text.find("|")
        if x < 1: # mfs + mfp
            fs = ""
            mp = ""
            fp = ""
            mfp = stem + text
        else: # All parameters specified
            fs = stem + text
            text = text
            x = text.find("|")
            mp = stem + text
            fp = stem + text
            mfp = ""
    doargform(fs, ms, "fs")
    doargform(mp, ms, "mp")
    doargform(fp, ms, "fp")
    doargform(mfp, ms, "mfp")
    return

    
adjs = open('itadjs.txt', 'r')
ms = adjs.readline() # First line strange
while len(ms) > 1:
    ms = adjs.readline()
    if len(ms) > 1:
        findadjforms(ms)
adjs.close()
for I in itadjs:
    print I