User:AutoSkull/grades.py

From Wiktionary, the free dictionary
Jump to navigation Jump to search
# print("Importing pywikibot...")
# import pywikibot
# print("Imported!")
#
# site = pywikibot.Site()

grade = {
"first": "one",
"second": "two",
"third": "three",
"fourth": "four",
"fifth": "five",
"sixth": "six",
"seventh": "seven",
"eighth": "eight",
"ninth": "nine",
"tenth": "ten",
"eleventh": "eleven",
"twelfth": "twelve",
"thirteenth": "thirteen",
}

count = 0

def CanadaEh(val):
    if val.endswith("e"):
        return f"{val}r"
    else:
        return f"{val}er"

for key, value in grade.items():
    count = count + 1
    pagename = f"{key} grader"
    pluralpagename = f"{pagename}s"
    th = f"{key[-2:]}"
    canadaer = ""
    coord = []
    for key2, value2 in grade.items():
        if key2 != key:
            coord.append(f"{key2} grader")
    entry = f"""==English==

===Alternative forms===
* {{{{l|en|{count}{th} grader}}}}

===Noun===
{{{{en-noun}}}}

# {{{{lb|en|US|education}}}} A [[pupil]] who is in [[{key} grade]].

====Synonyms====
* {{{{l|en|grade {CanadaEh(value)}}}}} {{{{q|Canada}}}}

====Hyponyms====
* {{{{l|en|gradeschooler}}}}

====Coordinate terms====
{{{{col4-u|en
|{coord[0]}
|{coord[1]}
|{coord[2]}
|{coord[3]}
|{coord[4]}
|{coord[5]}
|{coord[6]}
|{coord[7]}
|{coord[8]}
|{coord[9]}
|{coord[10]}
|{coord[11]}
}}}}

{{{{C|en|People}}}}
"""
    plural = f"""==English==

===Noun===
{{{{head|en|noun form}}}}

# {{{{plural of|en|{key} grader}}}}
"""
    print(entry)
    print("----")
    print(plural)
    print("----")
    # page = pywikibot.Page(site, pagename)
    # page.text = entry
    # page.save(u"Creating grader entry...")
    # pluralpage = pywikibot.Page(site, pluralpagename)
    # pluraltext = pluralpage.text
    # pluralpage.save(u"Creating plural...")