Created
January 27, 2018 19:07
-
-
Save cyborgsphinx/d5aed54214c4f645ca3cb208b9b3efd1 to your computer and use it in GitHub Desktop.
A simple English-sounding word generator, based on the phonemes that exist in the language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
phonemes = { 'ay', 'a', 'b', 'k', 'd', 'ee', 'ea', | |
'f', 'g', 'h', 'igh', 'i', 'j', 'l', | |
'm', 'n', 'oa', 'o', 'p', 'qu', 'r', | |
's', 't', 'ew', 'u', 'v', 'w', 'x', | |
'y', 'z', 'oo', 'oi', 'ou', 'aw', 'ar', | |
'sh', 'wh', 'ch', 'th', 'ng', 'er' } | |
math.randomseed(os.time()) | |
num = 3 | |
if arg[1] ~= nil then | |
n = tonumber(arg[1]) | |
num = (n > 3) and n or 3 | |
end | |
out = '' | |
for i=1,num do | |
val = math.random(table.getn(phonemes)) | |
out = out .. phonemes[val] | |
end | |
io.write(out, '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment