[Spellyans] Plural forms

David Trethewey davidtreth at gmail.com
Mon Jun 4 22:57:42 IST 2012


Gmail doesn't like me sending the .exe attachment  - so you'll need to 
download the Python interpreter to run this.

Apologies the previous .py file had a small error in it.

David

On 04/06/2012 21:52, David Trethewey wrote:
> Here's the python script for it - this version requires a download of 
> a python interpreter from www.python.org
>
>  I'll send as an executable as well, but when clicked on from Windows 
> the terminal window closes before you have a chance to read it, so 
> you'll need to open it in an already open command prompt.
>
> David

-------------- next part --------------
# coding=utf-8
import sys
import string

# David Trethewey 04-06-2012


number = raw_input("Enter number as integer:")
noun = raw_input("Enter noun:")


number_int = int(number)
numarray = ["onan","dew","tri","peswar","pymp","hwegh","seyth","eth","naw","deg","unnek","dewdhek","trydhek","peswardhek","pymthek","hwetek","seytek","etek","nownsek","ugens"]

def mutate(word, state):
    if state ==1:
        return word
    if state ==2:
        newword = word
        if (word[0] == "b")or(word[0] == "m"):
            newword = "v"+word[1:]
        if word[0] == "k":
            newword = "g"+word[1:]
        if word[0:2] == "ch":
            newword = "j"+word[2:]
        if word[0] == "d":
            newword = "dh" + word[1:]
        if (word[0:2] == "go")or(word[0:2] == "gu")or(word[0:3] == "gro")or(word[0:3]=="gru"):
            newword = "w" + word[1:]
            return newword
        if word[0] == "g":
            newword = word[1:]
        if word[0] == "p":
            newword = "b"+word[1:]
        if word[0] == "t":
            newword = "d"+word[1:]
        return newword
    if state == 3:
        newword = word
        if word[0] == "k":
            newword = "h"+word[1:]
        if word[0] == "p":
            newword = "f"+word[1:]
        if word[0] == "t":
            newword = "th"+word[1:]
        return newword
    if state == 4:
        newword = word
        if word[0] == "b":
            newword = "p"+word[1:]
        if word[0] == "d":
            newword = "t"+word[1:]
        if word[0] == "g":
            newword = "k"+word[1:]
        return newword
    if state ==5:
        newword = word
        if word[0] == "b":
            newword = "f"+word[1:]
        if word[0] == "d":
            newword = "t"+word[1:]
        if word[0] == "m":
            newword = "f"+word[1:]
        if (word[0:2] == "go")or(word[0:2] == "gu")or(word[0:3] == "gro")or(word[0:3]=="gru"):
            newword = "hw" + word[1:]
            return newword
        if word[0] == "g":
            newword = "h"+word[1:]
        return newword

def number_kernewek(num, noun):
    if num == 0:
        num_k = ""
    if num >0 and num < 21:
        num_k = numarray[num-1] +" "+ noun
        if num == 1:
            num_k = "unn " + mutate(noun,2)
        if num == 2:
            num_k = "dew " + mutate(noun,2)
        if num == 3:
            num_k = "tri " + mutate(noun,3)
    if num>20 and num<40:
        num_k = numarray[num-21] + " "+ noun + " warn ugens"
        if num == 21:
            num_k = "unn " + mutate(noun,2) + " warn ugens"
        if num == 22:
            num_k = "dew " + mutate(noun,2) + " warn ugens"
        if num == 23:
            num_k = "tri " + mutate(noun,3) + " warn ugens"
    if num>39 and num<100:
        firstpart = num % 20
        secondpart = num / 20
        if firstpart == 1:
            num_k = "unn " + mutate(noun,2) + " ha " + numarray[secondpart-1] + " ugens"
        if firstpart == 2:
            num_k = numarray[firstpart-1] + " "+ mutate(noun,2) + " ha " + numarray[secondpart-1] + " ugens"
        if firstpart == 3:
            num_k = numarray[firstpart-1] + " "+ mutate(noun,3) + " ha " + numarray[secondpart-1] + " ugens"
        num_k = numarray[firstpart-1] +" "+ noun + " ha " + numarray[secondpart-1] + " ugens"
        if firstpart == 0:
            num_k = numarray[secondpart-1] + " ugens " + noun
    if num==100:
        num_k = "kans " + noun
    if num>100 and num < 120:
        num_k = "kans "+noun+" ha "+numarray[num-101]
    if num>119 and num<200:
        # uses traditional counting by 20s up to 200 
        firstpart = num % 20
        secondpart = num / 20
        if firstpart == 1:
            num_k = "unn " + mutate(noun,2) + " ha " + numarray[secondpart-1] + " ugens"
        if firstpart == 2:
            num_k = numarray[firstpart-1] + " "+ mutate(noun,2) + " ha " + numarray[secondpart-1] + " ugens"
        if firstpart == 3:
            num_k = numarray[firstpart-1] + " " +mutate(noun,3) + " ha " + numarray[secondpart-1] + " ugens"
        num_k = numarray[firstpart-1] +" "+ noun + " ha " + numarray[secondpart-1] + " ugens"
        if firstpart == 0:
            num_k = numarray[secondpart-1] + " ugens " + noun

##  if num>119 and num<200:
##      num_k = "kans ha " + number_kernewek_nonoun(num % 100)
    if num>199 and num<1000:
        kansow = num / 100
        num_k = numarray[kansow-1] + " kans " + noun + " ha " + number_kernewek_nonoun(num % 100)
        if kansow == 3:
            num_k = "tri hans " + noun + " ha " + number_kernewek_nonoun(num % 100)

    if num>999 and num < 2000:
        num_k = "mil " + mutate(noun,2)+ " ha "+ number_kernewek_nonoun(num % 1000)
    if num>1999 and num<21000:
        num_k = number_kernewek_nonoun(num/1000) + " mil " +mutate(noun,2) + " ha " + number_kernewek_nonoun(num % 1000)
    if num>20999 and num<40000:
#        num_k = number_kernewek_nonoun((num % 20000)/1000) + " mil " + mutate(noun,2)+ " warn ugens" + number_kernewek_nonoun(num % 1000)
        num_k = number_kernewek_nonoun((num % 20000)/1000)+" warn ugens a vilyow ha " + number_kernewek_nonoun(num % 1000) + " a " + mutate(noun,2)+"ow"
        if num % 1000 == 0:
            num_k = number_kernewek_nonoun((num % 20000)/1000)+" warn ugens a vilyow a " + mutate(noun,2)+"ow"
    if num>39999 and num<100000:
#        num_k = number_kernewek_nonoun((num % 20000)/1000) + " mil "+ mutate(noun,2) + " ha " + number_kernewek_nonoun(num/20000) + " ugens " + number_kernewek_nonoun(num % 1000)
        num_k = number_kernewek_nonoun((num % 20000)/1000) +  " ha " + number_kernewek_nonoun(num/20000) + " ugens a vilyow ha " + number_kernewek_nonoun(num % 1000) + " a " + mutate(noun,2)+"ow"
        if num % 1000 == 0:
            num_k = number_kernewek_nonoun((num % 20000)/1000) +  " ha " + number_kernewek_nonoun(num/20000) + " ugens a vilyow a " + mutate(noun,2)+"ow"

    if num>99999 and num<1000000:
        num_k = number_kernewek_nonoun(num/1000) + " a vilyow ha " + number_kernewek_nonoun(num % 1000) +" a " + mutate(noun,2) + "ow"
        if (num % 1000) == 0:
            num_k = number_kernewek_nonoun(num/1000) + " a vilyow a " + mutate(noun,2) + "ow"
        if num < 200000:
            num_k = "kans ha "+ number_kernewek_nonoun((num-100000)/1000) + " a vilyow ha " + number_kernewek_nonoun(num % 1000) + " a " + mutate(noun,2) + "ow"
            if (num % 1000) == 0:
                num_k = "kans ha "+ number_kernewek_nonoun((num-100000)/1000) + " a vilyow a " + mutate(noun,2) + "ow"
        if (num % 100000) == 0:
            num_k = number_kernewek_nonoun(num/100000) + " kans mil " + mutate(noun,2)
        if num == 100000:
            num_k = "kans mil "+ mutate(noun,2)
    if num>999999 and num<2000000:
        num_k = "milyon " + number_kernewek_nonoun(num-1000000) + " a " + mutate(noun,2) + "ow" 
    if num>1999999 and num<20000001:
        num_k = number_kernewek_nonoun(num/1000000) + " milyon " + number_kernewek_nonoun(num % 1000000) + " a " + mutate(noun,2) + "ow"
    if num>20000000 and num<1000000000:
        num_k = number_kernewek_nonoun(num/1000000) + " a vilyonow " + number_kernewek_nonoun(num % 1000000) + " a " + mutate(noun,2) + "ow"
    if num>999999999 and num<2000000000:
        num_k = "bilyon " + number_kernewek_nonoun(num-1000000000) + " a " + mutate(noun,2) + "ow"
    if num>1999999999 and num<20000000001:
        num_k = number_kernewek_nonoun(num/1000000000) + " bilyon " + number_kernewek_nonoun(num % 1000000000) + " a " + mutate(noun,2) + "ow"
    if num>2e10 and num < 1e12:
        num_k = number_kernewek_nonoun(num/1000000000) + " a bilyonow " + number_kernewek_nonoun(num % 1000000000) + " a " + mutate(noun,2) + "ow"
    num_k = num_k.replace("  "," ")
    num_k = num_k.replace("ha u","hag u")
    num_k = num_k.replace("ha e","hag e")
    num_k = num_k.replace("ha o","hag o")
    num_k = num_k.replace("tri kans","tri hans")
    num_k = num_k.replace("deg ha dew ugens","hanterkans")

    return num_k    

def number_kernewek_nonoun(num):
    if num == 0:
        num_k = ""
    if num >0 and num < 21:
        num_k = numarray[num-1]

    if num>20 and num<40:
        num_k = numarray[num-21] + " warn ugens"

    if num>39 and num<100:
        firstpart = num % 20
        secondpart = num / 20

        num_k = numarray[firstpart-1] +" ha " + numarray[secondpart-1] + " ugens"
        if firstpart == 0:
            num_k = numarray[secondpart-1] + " ugens"
    if num==100:
        num_k = "kans"
    if num>100 and num < 120:
        num_k = "kans ha "+numarray[num-101]
    if num>119 and num<200:
        # uses traditional counting by 20s up to 200 
        firstpart = num % 20
        secondpart = num / 20

        num_k = numarray[firstpart-1] +" ha " + numarray[secondpart-1] + " ugens"
        if firstpart == 0:
            num_k = numarray[secondpart-1] + " ugens"

##  if num>119 and num<200:
##      num_k = "kans ha " + number_kernewek_nonoun(num % 100)
    if num>199 and num<1000:
        kansow = num / 100
        num_k = numarray[kansow-1] + " kans " + number_kernewek_nonoun(num % 100)
        if kansow == 3:
            num_k = "tri hans " + number_kernewek_nonoun(num % 100)

    if num>999 and num < 2000:
        num_k = "mil ha "+ number_kernewek_nonoun(num % 1000)
    if num>1999 and num<21000:
        num_k = number_kernewek_nonoun(num/1000) + " mil ha " + number_kernewek_nonoun(num % 1000)
    if num>20999 and num<40000:
#        num_k = number_kernewek_nonoun((num % 20000)/1000) + " mil warn ugens" + number_kernewek_nonoun(num % 1000)
        num_k = number_kernewek_nonoun((num % 20000)/1000) + " warn ugens a vilyow ha" + number_kernewek_nonoun(num % 1000)
    if num>39999 and num<100000:
#        num_k = number_kernewek_nonoun((num % 20000)/1000) + " mil ha " + number_kernewek_nonoun(num/20000) + " ugens " + number_kernewek_nonoun(num % 1000)
        num_k = number_kernewek_nonoun((num % 20000)/1000) +  " ha " + number_kernewek_nonoun(num/20000) + " ugens a vilyow ha " + number_kernewek_nonoun(num % 1000)

    if num>99999 and num<1000000:
        num_k = number_kernewek_nonoun(num/1000) + " a vilyow ha " + number_kernewek_nonoun(num % 1000)
        if (num % 1000) == 0:
            num_k = number_kernewek_nonoun(num/1000) + " a vilyow"
        if num < 200000:
            num_k = "kans ha "+ number_kernewek_nonoun((num-100000)/1000) + " a vilyow ha " + number_kernewek_nonoun(num % 1000)
            if (num % 1000) == 0:
                num_k = "kans ha "+ number_kernewek_nonoun((num-100000)/1000) + " a vilyow"
        if (num % 100000) == 0:
            num_k = number_kernewek_nonoun(num/100000) + " kans mil"
        if num == 100000:
            num_k = "kans mil"
    if num>999999 and num<2000000:
        num_k = "milyon " + number_kernewek_nonoun(num-1000000)
    if num>1999999 and num<20000001:
        num_k = number_kernewek_nonoun(num/1000000) + " milyon " + number_kernewek_nonoun(num % 1000000)
    if num>20000000 and num<1000000000:
        num_k = number_kernewek_nonoun(num/1000000) + " a vilyonow " + number_kernewek_nonoun(num % 1000000)
    if num>999999999 and num<2000000000:
        num_k = "bilyon " + number_kernewek_nonoun(num-1000000000) + " a " + mutate(noun,2) + "ow"
    if num>1999999999 and num<20000000001:
        num_k = number_kernewek_nonoun(num/1000000000) + " bilyon " + number_kernewek_nonoun(num % 1000000000)
    if num>2e10 and num < 1e12:
        num_k = number_kernewek_nonoun(num/1000000000) + " a bilyonow " + number_kernewek_nonoun(num % 1000000000)
    
    num_k = num_k.replace("  "," ")
    num_k = num_k.replace("ha u","hag u")
    num_k = num_k.replace("ha e","hag e")
    num_k = num_k.replace("ha o","hag o")
    num_k = num_k.replace("tri kans","tri hans")
    num_k = num_k.replace("deg ha dew ugens","hanterkans")

    return num_k    
    

print number_kernewek(number_int,noun)


More information about the Spellyans mailing list