def addallmutatedforms(listwords): """ add all possible mutated forms to a list of words """ mutatedwords = [] for w in listwords: for i in [2,3,4,5,6]: mutatedwords.append(mutatya.mutate(w,i)) for w in mutatedwords: if w not in listwords: listwords.append(w)
def termyn_exact(hour, minute): if minute == 0: termyn = get_hour(hour, minute) elif minute == 15: termyn = "kwarter wosa " + get_hour(hour, minute) elif minute == 30: termyn = "hanter wosa " + get_hour(hour, minute) elif minute == 45: termyn = "kwarter dhe " + mutatya.mutate(get_hour(hour + 1, minute), 2) else: if minute < 30: termyn = niverow.numberkw_noun(minute, "mynysenn", fem=True) + " wosa " + get_hour( hour, minute) else: termyn = niverow.numberkw_noun( 60 - minute, "mynysenn", fem=True) + " dhe " + mutatya.mutate( get_hour(hour + 1, minute), 2) return termyn
def numberkw_float_noun(num, noun, fem=False, npl="ow"): if num == int(abs(num)): return numberkw_noun(num, noun, fem, npl) else: num_k = numberkw_float(num) num_k += " a " # default plural suffix -ow if npl == "ow": npl = noun + npl num_k += mutatya.mutate(npl, 2) return num_k
def termyn_approx(hour, minute): hoursfrac = hour + minute / 60.0 hoursfrac *= 4.0 hoursfrac = round(hoursfrac) hoursfrac /= 4.0 # print(hoursfrac) hourint = math.floor(hoursfrac) if hoursfrac % 1 == 0: termyn = get_hour(hourint, 0) if hoursfrac % 1 == 0.25: termyn = "kwarter wosa " + get_hour(hourint, 0) if hoursfrac % 1 == 0.5: termyn = "hanter wosa " + get_hour(hourint, 0) if hoursfrac % 1 == 0.75: termyn = "kwarter dhe " + mutatya.mutate(get_hour(hourint + 1, 0), 2) return termyn
def printmform(): """ show the mutated form of whatever has been input in the entry bar """ if intmstate() < 7: #print(mutatya.mutate(ent.fetch(),intmstate())) mutatys = mutatya.mutate(ent.fetch(), intmstate(), tradgraph.state()[0]) mutatys = textwrap.fill(mutatys, 60) print(mutatys) msg2.config(text=mutatys, font=('Courier', 16, 'bold')) else: dimutatys = mutatya.format_rev_mutate( mutatya.rev_mutate(ent.fetch(), False, tradgraph.state()[0]), True) #print(mutatya.format_rev_mutate(mutatya.rev_mutate(ent.fetch(), False, tradgraph.state()[0]), True)) mutatys = textwrap.fill(dimutatys, 60) print(dimutatys) msg2.config(text=dimutatys, font=('Courier', 14, 'bold'))
def numberkw_noun(num, noun, fem=False, npl="ow"): """ Returns numeral <num> in Cornish compounded with <noun> <fem> is a boolean variable specifying whether the noun is feminine <npl> is the plural of <noun>. if it isn't specified default to <noun>+'ow' """ # default plural suffix -ow if npl == "ow": npl = noun + npl if not (isinstance(num, int)): print("num is not an integer. attempting conversion...") num = int(num) if num < 0: print("num is negative, multiplying by -1") num = num * -1 print("num={n}".format(n=num)) if num == 0: num_k = "zero a {n}".format(n=mutatya.mutate(npl, 2)) return num_k if num > 0 and num < 21: num_k = firstpartnoun(num, noun, fem) if num > 20 and num < 40: # numbers 21 to 39 num_k = firstpartnoun(num - 20, noun, fem) + " warn ugens" if (num > 39 and num < 100) or (num > 119 and num < 200): # numbers 40 to 199 excluding 100-119 firstpart = num % 20 secondpart = num // 20 if firstpart == 0: num_k = numarray[secondpart - 1] + " ugens " + noun else: num_k = firstpartnoun( firstpart, noun, fem) + " ha " + numarray[secondpart - 1] + " ugens" if num == 50: # override for num=50 num_k = "hanterkans " + noun if num == 100: num_k = "kans " + noun if num > 100 and num < 120: num_k = "kans " + noun + " ha " + numarray[num - 101] if num > 199 and num < 1000: ha = " ha " kansow = num // 100 if num % 100 == 0: num_k = numarray[kansow - 1] + " kans " + noun else: if num % 100 < 21 or num % 20 == 0: num_k = numarray[kansow - 1] + " kans " + noun + ha + numberkw( num % 100) else: num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) if num > 999 and num < 21000: if num == 1000: num_k = "mil " + mutatya.mutate(noun, 2) else: if num % 1000 == 0: num_k = numberkw(1000 * num // 1000) + " " + mutatya.mutate( noun, 2) else: if num % 1000 < 21 or (num % 1000 < 200 and num % 20 == 0) or num % 100 == 0: num_k = numberkw( 1000 * (num // 1000)) + " " + mutatya.mutate( noun, 2) + " ha " + numberkw(num % 1000) else: num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) if num > 20999 and num < 40000: num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) if num > 39999 and (num < 100000) or (num % 20000 == 0 and num < 200000): num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) if num % 20000 == 0: num_k = numberkw(num // 20000) + " ugens mil " + mutatya.mutate( noun, 2) elif num > 99999 and num < 1000000: num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) if num % 100000 == 0: num_k = numberkw(num // 100000) + " kans mil " + mutatya.mutate( noun, 2) if num == 100000: num_k = "kans mil " + mutatya.mutate(noun, 2) if num > 999999 and num < 2000000: if num == 1000000: num_k = "milvil " + mutatya.mutate(noun, 2) else: num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) if num > 1999999 and num < 20000001: if num % 1000000 == 0: num_k = numberkw(num // 1000000) + " milvil " + mutatya.mutate( noun, 2) return num_k else: num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) if num > 20000000 and num < 1000000000: if num % 20000000 == 0 and num < 200000000: num_k = numberkw(num // 1000000) + " milvil " + mutatya.mutate( noun, 2) else: num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) if num > 999999999 and num < 2000000000: num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) if num > 1999999999 and num < 20000000001: num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) if num > 2e10: num_k = numberkw(num) + " a " + mutatya.mutate(npl, 2) 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 the result return num_k
def trinoun(noun, fem=False): if fem: return "teyr " + mutatya.mutate(noun, 3) #feminine form else: return "tri " + mutatya.mutate(noun, 3)
def dewnoun(noun, fem=False): if fem: return "diw " + mutatya.mutate(noun, 2) #feminine form else: return "dew " + mutatya.mutate(noun, 2)
def unnnoun(noun, fem=False): if fem: mstate = 2 else: mstate = 1 return "unn " + mutatya.mutate(noun, mstate)