-- welcome to code hell :3 require "quick-terminal-customization" require "strings" require "get_words" -- lets get the words words = getWords("heonian-content/words") -- lets slice up the multiple types a word can be into lists ListNouns = {} ListModifiers = {} ListVerbs = {} ListMarkers = {} ListInterrogativePronouns = {} ListPersonalPronouns = {} for _, v in pairs(words) do -- v 1 = word / v 3 = type / v 2 = meaning. v[1] = find_n_replace(v[1], "[.]","'") v[1] = minimum_apostrophes(v[1]) if v[1] == "re" or v[1] == "ba" or v[1] == "i'ma" then table.insert(ListPersonalPronouns, {v[1], v[3], v[2]}) end if string.find(v[3],"pronoun") then table.insert(ListInterrogativePronouns, {v[1], v[3], v[2]}) --print("pronoun") elseif string.find(v[3],"noun") then table.insert(ListNouns, {v[1], v[3], v[2]}) --print("noun") end if string.find(v[3],"verb") then table.insert(ListVerbs, {v[1], v[3], v[2]}) --print("verb") end if string.find(v[3],"modifier") then table.insert(ListModifiers, {v[1], v[3], v[2]}) --print("modifier") end if string.find(v[3],"marker") then table.insert(ListMarkers, {v[1], v[3], v[2]}) --print("modifier") end end function SentenceConstruct() local sentence = "" local r = 0 local formal = false -- formal or not? local r = math.random(4) if r == 1 then formal = true end formal = true -- lets get subject -- 80% pronoun -- 20% noun local subject = "" local subject_unmodified = "" r = math.random(10) if r < 3 then subject = ListNouns[math.random(#ListNouns)][1] else subject = ListPersonalPronouns[math.random(#ListPersonalPronouns)][1] if formal then subject = subject .. "lfur" end subject_unmodified = subject end -- lets modify subject 30% of times r = math.random(10) if r < 4 then subject = ListModifiers[math.random(#ListModifiers)][1] .. " ".. subject end sentence = sentence .. subject .. " chu" -- objects? -- lets refer to the something 30% of the time r = math.random(10) if r < 4 then local rr = math.random(3) if subject_unmodified and rr > 1 then -- refer to subject sentence = sentence .. " " .. subject_unmodified .. "la " .. ListNouns[math.random(#ListNouns)][1] else -- lets make up sentence = sentence .. " " .. ListPersonalPronouns[math.random(#ListPersonalPronouns)][1] print(sentence) if formal then sentence = sentence .. "lfur" end sentence = sentence .. "la " .. ListNouns[math.random(#ListNouns)][1] end elseif r < 8 then sentence = sentence .. " " .. ListNouns[math.random(#ListNouns)][1] sentence = sentence .. " " .. ListMarkers[math.random(#ListMarkers)][1] end -- verb local verb = ListVerbs[math.random(#ListVerbs)][1] -- lets conjugate -- 5% infinitive -- 30% past -- 65% present print(verb) r = math.random(20) if r == 1 then -- infinitive elseif r < 7 then -- past if formal then verb = string.sub(verb,1,#verb-1) .. "ome" else verb = string.sub(verb,1,#verb-2) .. "'me" end else -- present if formal then verb = string.sub(verb,1,#verb-1) .. "a'nya" else verb = string.sub(verb,1,#verb-2) .. "'nya" end end -- 20% modify verb r = math.random(5) if r == 1 then verb = ListModifiers[math.random(#ListModifiers)][1] .. " ".. verb end sentence = sentence .. " " .. verb return sentence end function LoopStart() os.execute("clear") print(string.color(TERMINAL_COLOR.HighYellow,"-- HEONIAN LANGUAGE EXERCISES (HLE) --")) end while 1 do LoopStart() print(SentenceConstruct()) io.read() end