Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # the sounds in the language
- vowels = ["a", "e", "i", "o", "u"]
- consonants = ["m", "p", "f","t","s","k"]
- sounds = vowels+consonants
- #initial settings
- wordlength = 5
- line=1
- numberofsounds = len(sounds)
- #imports
- from array import *
- from numpy import *
- #initial array settings
- a = zeros([pow(numberofsounds,wordlength),wordlength])
- #entire addition loop
- end = 0
- while line < pow(numberofsounds,wordlength):
- #var used for loop
- n = 0
- #print "n="+str(n)
- while n <= wordlength-1:
- a[line,n] = a[line-1,n]
- n = n+1
- #print "n="+str(n)
- #print a
- #add 1 to the last
- a[line,wordlength-1] = a[line,wordlength-1]+1
- #loop that detect if a the number is too large
- m = wordlength-1
- while m >= 0:
- if a[line, m] > numberofsounds-1 and m != 0:
- a[line,m] = 0
- a[line,m-1] = a[line,m-1]+1
- m=m-1
- line=line+1
- #print "line="+str(line)
- #displaying the representation
- print "numerical representation is"
- print a
- #remove non-possible words
- #code goes here
- #generating the words from the representation
- #converter
- def convert(input):
- return sounds[input]
- #fetcher
- def fetch(input1,input2):
- return a[input1,input2]
- #print words
- line = 0
- while line < pow(numberofsounds,wordlength):
- word = ""
- n = 0
- while n < wordlength:
- word = word + convert(int(fetch(line,n)))
- n=n+1
- #print str(n)
- #print "line="+str(line)
- print word
- line=line+1
- print "number of different words is "+(str(pow(numberofsounds,wordlength)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement