Compare commits

...

16 Commits

Author SHA1 Message Date
UndeadMaelys
1b43c52f5d adapted to the new words file 2022-06-06 07:14:01 +02:00
UndeadMaelys
ec76802316 fix badges. fix pronouns duals categorization and generated description 2022-05-10 18:36:05 +02:00
UndeadMaelys
6da5e47e5c better fix for possesion of previous commit 2022-05-10 17:38:15 +02:00
UndeadMaelys
4111112ff3 fixed submodules to include heonian ime and QTC separatedly. Also fixed a bug on the converter (now renamed to generator) so it detects formal possesivess 2022-05-10 17:29:20 +02:00
UndeadMaelys
82b751a9e5 improvements to mood detection, fixed missing word types badges, fixed badge definition 2022-05-09 13:24:28 +02:00
UndeadMaelys
1817ac9d9d fixed misllableed moods in js 2022-05-08 20:16:01 +02:00
87f1a59ceb fix le js 2022-05-08 18:46:56 +02:00
UndeadMaelys
941f701d7d changes to badges and types n stuff 2022-05-08 18:31:09 +02:00
Bizcochito
3d0fc9145f added a word not found allert to stderr when word is not in dictionary 2022-05-07 21:26:44 +02:00
Bizcochito
81d25ec8f1 added 2 moods 2022-05-07 20:40:36 +02:00
Bizcochito
ee20f99f9c added 2 moods 2022-05-07 20:38:33 +02:00
f620bcf1f0 yaaaa 2022-05-07 15:06:20 +02:00
8095cae7cb ime bettter 2022-05-07 14:31:50 +02:00
be9fe1e3a3 finished?! 2022-05-07 12:33:35 +02:00
cddd475909 ariririririririri is now supported 2022-05-07 12:08:35 +02:00
ef877a53bd had too n_n 2022-05-07 11:58:21 +02:00
17 changed files with 2268 additions and 1346 deletions

6
.gitmodules vendored
View File

@@ -1,3 +1,9 @@
[submodule "heonian-content"]
path = heonian-content
url = https://git.succubi.services/lustlion/heonian-content
[submodule "heonian-ime"]
path = heonian-ime
url = git@ssh.succubi.services:remi/heonian-ime.git
[submodule "quick-terminal-customization"]
path = quick-terminal-customization
url = git@ssh.succubi.services:lustlion/quick-terminal-customization.git

85
color.lua Normal file
View File

@@ -0,0 +1,85 @@
function Enum(tbl)
for i = 1, #tbl do
local v = tbl[i]
tbl[v] = i
end
return tbl
end
COLOR = Enum {
"Black",
"Red",
"Green",
"Yellow",
"Blue",
"Purple",
"Cyan",
"LightGray",
"Gray",
"HighRed",
"HighGreen",
"HighYellow",
"HighBlue",
"HighPurple",
"HighCyan",
"White"
}
EFFECT = Enum {
"Normal",
"Bold",
"Dim",
"Italic",
"Underline",
"BlinkSlow",
"BlinkFast",
"Invert",
"Conceal",
"CrossedOut"
}
function effectText(Effect, ...)
local Text = ""
local tab = false
for _, v in pairs({...}) do
if not tab then
tab = true
else
Text = Text .. "\t"
end
Text = Text .. v
end
return "\027["..tostring(Effect-1).."m"..Text.."\027[0;m"
end
function colorText(Color, ...)
local Text = ""
local tab = false
for _, v in pairs({...}) do
if not tab then
tab = true
else
Text = Text .. "\t"
end
Text = Text .. v
end
return "\027[38;5;"..tostring(Color-1).."m"..Text.."\027[0;m"
end
function colorTextBackground(Color, ...)
local Text = ""
local tab = false
for _, v in pairs({...}) do
if not tab then
tab = true
else
Text = Text .. "\t"
end
Text = Text .. v
end
return "\027[48;5;"..tostring(Color-1).."m"..Text.."\027[0;m"
end
function scrollTerminalUp(amount)
return "\027["..amount.."T"
end

View File

@@ -1,12 +1,62 @@
require "r2h2_modified"
require "color"
words = dofile("heonian-content/words.lua")
input = arg[1] or "input.txt"
function apply(text)
print(text)
end
function printD(...)
io.stderr:write(
effectText(
EFFECT.Bold,
colorText(
COLOR.HighPurple,
"\tDEBUG:\t"
)
) ..
colorText(
COLOR.HighPurple,
table.unpack({...}) , "\n"
)
)
end
function printW(...)
io.stderr:write(
effectText(
EFFECT.Bold,
colorText(
COLOR.HighYellow,
"\t WARN:\t"
)
) ..
colorText(
COLOR.HighYellow,
table.unpack({...}) .. "\n"
)
)
end
function printE(...)
io.stderr:write(
effectText(
EFFECT.Bold,
colorText(
COLOR.HighRed,
"\tERROR:\t"
)
) ..
colorText(
COLOR.HighRed,
table.unpack({...}) .. "\n"
)
)
end
function process_content(content)
content = content .. " "
for i=1, 2 do
@@ -31,6 +81,7 @@ function process_content(content)
new_word = strip_symbols(new_word)
new_word, indicators = revert_verbs(new_word, indicators)
new_word, indicators = revert_nouns(new_word,indicators)
new_word, indicators = categorize_word(new_word,indicators)
add_word(new_word)
local html_stuff = [[
@@ -48,7 +99,7 @@ function process_content(content)
html_stuff = string.gsub(html_stuff, "REPLACE_PRINT", REPLACE_PRINT)
end
local REPLACE_WORD = print_text
local REPLACE_WORD = strip_symbols(print_text)
while string.find(REPLACE_WORD, "%\'") do
REPLACE_WORD = string.gsub(REPLACE_WORD, "%\'", "$")
end
@@ -89,7 +140,7 @@ function process_content(content)
ac = string.sub(ac, string.find(ac, " ")+1)
-- now we print the thing with teh appropiate indicators.
--print(print_text, table.unpack(indicators))
-- printD(print_text, table.unpack(indicators))
end
apply_html("html/convo/text/end.html")
end
@@ -126,6 +177,7 @@ function add_word(str)
end
if add then
table.insert(word_list,str)
if not in_dictionary(str) then printW("\"" .. str .. "\" is not known") end
end
end
@@ -159,11 +211,20 @@ function check_symbol(str)
end
end
function find_n_replace(str, tbl,find,repl,indicator)
function find_n_replace(str, tbl,find,repl,indicator, caution)
if not in_dictionary(str) then
if string.find(str, find) then
if caution then
if not string.find(str, caution, string.find(str, find)+string.len(find)-string.len(caution)) then -- sometimes you want to avoid certain false positives
str = string.gsub(str,find, repl)
table.insert(tbl,indicator)
end
else
str = string.gsub(str,find, repl)
table.insert(tbl,indicator)
end
end
end
return str, tbl
end
@@ -173,35 +234,95 @@ function in_dictionary(str)
end
end
function check_morphemes(str, tbl,match,repl,indicator)
function string.split(str, find, tbl)
split = tbl or {}
local p = 0
local continue = true
while continue do
word = string.sub(str,p,string.find(str,find,p+1,-1))
table.insert(split,strip_spaces(word))
if string.find(str,find,p) then
str = string.sub(str,p)
p = string.find(str,find,p)
continue = true
p = p + 1
else
continue = false
end
end
return split
end
function categorize_word(str,indicators)
local ind = {}
for _, v in pairs(words) do
if strip_symbols(v[1]) == strip_spaces(str) then -- if word is present
local ac = string.lower(v[3])
ind = string.split(strip_symbols(ac), " ", ind) -- store types are indicators
end
end
for _, v in pairs(indicators) do
table.insert(ind, v)
end
return str, ind
end
function check_morphemes(str, tbl,match,repl,indicators)
if type(indicators) ~= "table" then
indicators = {indicators}
end
if not in_dictionary(str) then
local flen = string.len(match)
if string.sub(str, -flen) == match
and string.sub(str,-3) ~= "ton" then
str = string.sub(str, 0,string.len(str)-flen)
table.insert(tbl,indicator)
if string.sub(str, -flen) == match then
str = string.sub(str, 0,string.len(str)-flen) .. repl
if tbl then
for _, v in pairs(indicators) do
table.insert(tbl,v)
end
end
end
end
return str, tbl
end
function revert_nouns(str, tbl)
str, tbl = check_morphemes(str,tbl,"lfur","","formal-n1")
str, tbl = check_morphemes(str,tbl,"lafura","","formal-n2")
str, tbl = check_morphemes(str,tbl,"lan","","genitive")
str, tbl = check_morphemes(str,tbl,"la","","possesive")
str, tbl = check_morphemes(str,tbl,"n","","plural")
str, tbl = check_morphemes(str,tbl,"lfur","","formal1")
str, tbl = check_morphemes(str,tbl,"lafura","","formal2")
return str, tbl
end
function revert_verbs(str, tbl)
str, tbl = find_n_replace(str, tbl,"kanya","ku","present-tense")
str, tbl = find_n_replace(str, tbl,"kome","ku","past-tense")
str, tbl = find_n_replace(str, tbl,"kupash","ku","volitional-mood")
str, tbl = find_n_replace(str, tbl,"kudash","ku","imperative-mood")
str, tbl = find_n_replace(str, tbl,"kubash","ku","shy-mood")
str, tbl = find_n_replace(str, tbl,"kutash","ku","threat-mood")
str, tbl = find_n_replace(str, tbl,"faku","ku","negated")
-- moods first
str, tbl = revert_mood(str, tbl,"pash","","volitional-mood")
str, tbl = revert_mood(str, tbl,"dash","","imperative-mood")
str, tbl = revert_mood(str, tbl,"bash","","shy-mood")
str, tbl = revert_mood(str, tbl,"tash","","threat-mood")
str, tbl = revert_mood(str, tbl,"shu","","comfy-mood")
str, tbl = revert_mood(str, tbl,"ha","","excited-mood", "sha")
-- once we've cleaned moods lets try to get tense
str, tbl = check_morphemes(str, tbl,"kanya","ku",{"present-tense-formal","formal-v1"})
str, tbl = check_morphemes(str, tbl,"kome","ku",{"past-tense-formal","formal-v2"})
-- maybe it's informal?
str, tbl = check_morphemes(str, tbl,"nya","",{"present-tense-informal","informal-v1"})
str, tbl = check_morphemes(str, tbl,"me","",{"past-tense-informal","informal-v2"})
for _, v in pairs(tbl) do
if v == "informal-v1"
or v == "informal-v2" then
str = str .. "ku"
end
end
-- negate
str, tbl = check_morphemes(str, tbl,"faku","ku","negated")
return str, tbl
end
function revert_mood(str, tbl,match,repl,indicator, caution)
str, tbl = find_n_replace(str, tbl,"fa"..match,repl,indicator.."-negated",caution)
str, tbl = find_n_replace(str, tbl,match,repl,indicator,caution)
return str, tbl
end
@@ -283,7 +404,7 @@ end
-- lets make the html
apply_html("html/start.html")
-- get text
local file = io.open("input.txt","r")
local file = io.open(input,"r")
local text = file:read("*all")
file:close()

574
generator.lua Normal file
View File

@@ -0,0 +1,574 @@
require "r2h2_modified"
require "quick-terminal-customization"
require "get_words"
words = getWords("heonian-content/words")
input = arg[1] or "input.txt"
function apply(text)
print(text)
end
function printD(...)
io.stderr:write(
string.effect(
TERMINAL_EFFECT.Bold,
string.color(
TERMINAL_COLOR.HighPurple,
"\tDEBUG:\t"
)
) ..
string.color(
TERMINAL_COLOR.HighPurple,
table.unpack({...}) , "\n"
)
)
end
function printW(...)
io.stderr:write(
string.effect(
TERMINAL_EFFECT.Bold,
string.color(
TERMINAL_COLOR.HighYellow,
"\t WARN:\t"
)
) ..
string.color(
TERMINAL_COLOR.HighYellow,
table.unpack({...}) .. "\n"
)
)
end
function printE(...)
io.stderr:write(
string.effect(
TERMINAL_EFFECT.Bold,
string.color(
TERMINAL_COLOR.HighRed,
"\tERROR:\t"
)
) ..
string.color(
TERMINAL_COLOR.HighRed,
table.unpack({...}) .. "\n"
)
)
end
function process_content(content)
content = content .. " "
for i=1, 2 do
if i == 1 then
apply_html("html/convo/text/start_roman.html")
else
apply_html("html/convo/text/start_heonian.html")
end
local ac = check_symbol(content)
while string.find(ac, " ") do
local new_word = string.sub(ac, 0, string.find(ac, " ")-1)
local indicators = {}
if i == 1 then
print_text = new_word
else
print_text = mod_convertToHeonian(new_word)
end
new_word = strip_symbols(new_word)
new_word, indicators = revert_verbs(new_word, indicators)
new_word, indicators = revert_nouns(new_word,indicators)
new_word, indicators = categorize_word(new_word,indicators)
add_word(new_word)
local REPLACE_WORD = strip_symbols(print_text)
local REPLACE_SEARCH = new_word
local REPLACE_PRINT = print_text
local REPLACE_DATA = ""
local k = 0
for _, v in pairs(indicators) do
if k > 0 then
REPLACE_DATA = REPLACE_DATA .. " "
end
REPLACE_DATA = REPLACE_DATA .. v
k = k + 1
end
local html_stuff = [[
<span
class="clickable"
onclick="showPopup('REPLACE_WORD','REPLACE_SEARCH','REPLACE_DATA')"
onmouseover="checkHover('REPLACE_WORD','REPLACE_SEARCH',this,'REPLACE_DATA')"
onmouseout="clearHover()">
REPLACE_PRINT
</span>
]]
while string.find(html_stuff, "REPLACE_PRINT") do
html_stuff = string.gsub(html_stuff, "REPLACE_PRINT", REPLACE_PRINT)
end
while string.find(REPLACE_WORD, "%\'") do
REPLACE_WORD = string.gsub(REPLACE_WORD, "%\'", "$")
end
while string.find(REPLACE_WORD, "%$") do
REPLACE_WORD = string.gsub(REPLACE_WORD, "%$", "\\\'")
end
while string.find(html_stuff, "REPLACE_WORD") do
html_stuff = string.gsub(html_stuff, "REPLACE_WORD", REPLACE_WORD)
end
while string.find(html_stuff, "REPLACE_SEARCH") do
html_stuff = string.gsub(html_stuff, "REPLACE_SEARCH", REPLACE_SEARCH)
end
if REPLACE_DATA and REPLACE_DATA ~= "" then
while string.find(REPLACE_DATA, "\t") do
REPLACE_DATA = string.gsub(REPLACE_DATA, "\t", " ")
end
while string.find(html_stuff, "REPLACE_DATA") do
html_stuff = string.gsub(html_stuff, "REPLACE_DATA", REPLACE_DATA)
end
else
html_stuff = string.gsub(html_stuff, ",'REPLACE_DATA'","")
end
apply(html_stuff)
ac = string.sub(ac, string.find(ac, " ")+1)
-- now we print the thing with teh appropiate indicators.
-- printD(print_text, table.unpack(indicators))
end
apply_html("html/convo/text/end.html")
end
end
function cell_builder(...)
arg = {...}
for i=1, #arg do
apply_html("html/words/definition/cell_start.html")
apply(arg[i])
apply_html("html/words/definition/cell_end.html")
end
end
function print_word_stuff(word)
apply_html("html/words/definition/start.html")
local exit = false
for _, v in pairs(words) do
if strip_symbols(v[1]) == strip_spaces(word) then
cell_builder(mod_convertToHeonian(word),v[1],v[3],v[2])
exit = true
end
end
if not exit then
-- personal pronuns
local PP = {
{"re","re","the speaker"," and someone else the listener doesn't know about"},
{"ba","ba","the listener"," and someone else the speaker doesn't know about"},
{"ima","ma","someone else","s who neither the speaker or the listener know about"}
}
for _, v1 in pairs(PP) do
for _, v2 in pairs(PP) do
if word == v1[1]..v2[2] then
exit = true
cell_builder(
mod_convertToHeonian(word),
word,
"Pronoun",
"This word refers to both "..v1[3] .. v2[4] .. ". \n\nIf in plural form, it refers to a group of people who all fit this definition."
)
end
end
end
if not exit then
cell_builder(mod_convertToHeonian(word),word, "???","???")
printW("\"" .. word .. "\" is not known")
end
end
apply_html("html/words/definition/end.html")
end
function add_word(str)
local add = true
for _, v in pairs(word_list) do
if v == str then
add = false
end
end
if add then
table.insert(word_list,str)
end
end
function strip_spaces(str)
while string.find(str, "% ") do
str = string.gsub(str, " ","")
end
return str
end
function strip_symbols(str)
local symbol_table = "'~()!?:></.,\t"
for i=1, #symbol_table do
while string.find(str, "%"..string.sub(symbol_table,i,i)) do
str = string.gsub(str, "%"..string.sub(symbol_table,i,i),"")
end
end
return str
end
function replace_sign(str)
while string.find(str, "%-") do
str = string.gsub(str, "%-"," ")
end
return str
end
function check_symbol(str)
if not in_dictionary(str) then
return replace_sign(str)
end
end
function find_n_replace(str, tbl,find,repl,indicator, caution)
if not in_dictionary(str) then
if string.find(str, find) then
if caution then
if not string.find(str, caution, string.find(str, find)+string.len(find)-string.len(caution)) then -- sometimes you want to avoid certain false positives
str = string.gsub(str,find, repl)
table.insert(tbl,indicator)
end
else
str = string.gsub(str,find, repl)
table.insert(tbl,indicator)
end
end
end
return str, tbl
end
function in_dictionary(str)
for i=1, #words do
if strip_symbols(words[i][1]) == str then return true end
end
end
function string.split(str, find, tbl)
split = tbl or {}
local p = 0
local continue = true
while continue do
word = string.sub(str,p,string.find(str,find,p+1,-1))
table.insert(split,strip_spaces(word))
if string.find(str,find,p) then
str = string.sub(str,p)
p = string.find(str,find,p)
continue = true
p = p + 1
else
continue = false
end
end
return split
end
function categorize_word(str,indicators)
local ind = {}
for _, v in pairs(words) do
if strip_symbols(v[1]) == strip_spaces(str) then -- if word is present
local ac = string.lower(v[3])
ind = string.split(strip_symbols(ac), " ", ind) -- store types are indicators
end
end
for _, v in pairs(indicators) do
table.insert(ind, v)
end
return str, ind
end
function check_morphemes(str, tbl,match,repl,indicators)
if type(indicators) ~= "table" then
indicators = {indicators}
end
if not in_dictionary(str) then
local flen = string.len(match)
if string.sub(str, -flen) == match then
str = string.sub(str, 0,string.len(str)-flen) .. repl
if tbl then
for _, v in pairs(indicators) do
table.insert(tbl,v)
end
end
end
end
return str, tbl
end
function revert_nouns(str, tbl)
-- possesion first
str, tbl = check_morphemes(str,tbl,"lan","","genitive")
str, tbl = check_morphemes(str,tbl,"la","","possesive")
-- then politeness
str, tbl = check_morphemes(str,tbl,"lfur","","formal-n1")
str, tbl = check_morphemes(str,tbl,"lafura","","formal-n2")
-- then plural
str, tbl = check_morphemes(str,tbl,"n","","plural")
-- personal pronuns
local PP = {
{"re","re"},
{"ba","ba"},
{"ima","ma"}
}
for _, v1 in pairs(PP) do
for _, v2 in pairs(PP) do
if str == v1[1]..v2[2] then
table.insert(tbl,"dual")
for _, vtbl in pairs(tbl) do
if vtbl == "plural" then
table.remove(tbl, #tbl)
break
end
end
table.insert(tbl,"pronoun")
end
end
end
return str, tbl
end
function revert_verbs(str, tbl)
-- moods first
str, tbl = revert_mood(str, tbl,"pash","","volitional-mood")
str, tbl = revert_mood(str, tbl,"dash","","imperative-mood")
str, tbl = revert_mood(str, tbl,"bash","","shy-mood")
str, tbl = revert_mood(str, tbl,"tash","","threat-mood")
str, tbl = revert_mood(str, tbl,"shu","","comfy-mood")
str, tbl = revert_mood(str, tbl,"ha","","excited-mood", "sha")
-- once we've cleaned moods lets try to get tense
str, tbl = check_morphemes(str, tbl,"kanya","ku",{"present-tense-formal","formal-v1"})
str, tbl = check_morphemes(str, tbl,"kome","ku",{"past-tense-formal","formal-v2"})
-- maybe it's informal?
str, tbl = check_morphemes(str, tbl,"nya","",{"present-tense-informal","informal-v1"})
str, tbl = check_morphemes(str, tbl,"me","",{"past-tense-informal","informal-v2"})
for _, v in pairs(tbl) do
if v == "informal-v1"
or v == "informal-v2" then
str = str .. "ku"
end
end
-- negate
str, tbl = check_morphemes(str, tbl,"faku","ku","negated")
return str, tbl
end
function revert_mood(str, tbl,match,repl,indicator, caution)
str, tbl = find_n_replace(str, tbl,"fa"..match,repl,indicator.."-negated",caution)
str, tbl = find_n_replace(str, tbl,match,repl,indicator,caution)
return str, tbl
end
function apply_html(path)
-- copy
local file = io.open(path,"r")
local html = file:read("*all")
file:close()
-- paste
apply(html)
end
function convo_image(string,alt_text)
if string then
apply_html("html/convo/header/image/start.html")
apply(string)
apply_html("html/convo/header/image/middle.html")
apply(alt_text)
apply_html("html/convo/header/image/end.html")
end
end
function convo_notes(string)
apply_html("html/convo/middle.html")
if string then
apply_html("html/convo/notes/start.html")
apply(string)
apply_html("html/convo/notes/end.html")
end
end
function convo_date(string)
if string then
apply_html("html/convo/header/date/start.html")
apply(string)
apply_html("html/convo/header/date/end.html")
end
end
function convo_header_start()
if not header then
header = true
apply_html("html/convo/header/start.html")
end
end
function convo_header_end()
if header then
header = false
apply_html("html/convo/header/end.html")
end
end
function convo_start(color)
convo_header_end()
if not convo then
if color then
apply_html("html/convo/start_green.html")
else
apply_html("html/convo/start_gray.html")
end
convo = true
end
end
function convo_end()
convo_header_end()
if convo then
if not notes then
apply_html("html/convo/middle.html")
end
notes = false
apply_html("html/convo/end.html")
convo = false
end
end
-- lets make the html
apply_html("html/start.html")
-- get text
local file = io.open(input,"r")
local text = file:read("*all")
file:close()
-- first analyze text
-- (this is the fun part)
word_list = {}
local p = 0
local s = 0
local convo = false
local header = false
local notes = false
local green = true
local skip = 1
local user = {}
while p ~= nil do
s = s + 1
local np = string.find(text,"\n",p+1)
if np and p - np ~= 1 then
if p then
skip = 1
if string.sub(text,p+1,p+1) == "\n"
or string.sub(text,p+1,p+1) == "/" then
-- end of new bubble
convo_end()
elseif string.sub(text,p+1,p+1) == "\t" then
-- its tabbed so its spoken?
convo_start()
process_content(string.sub(text,p+2,np-1))
elseif string.sub(text,p+1,p+1) == "h" then
-- spoken but forced to h
convo_start()
apply_html("html/convo/text/start_raw.html")
apply(mod_convertToHeonian(string.sub(text,p+3,np-1)).."")
apply_html("html/convo/text/end.html")
elseif string.sub(text,p+1,p+1) == "r" then
-- spoken but forced to r
convo_start()
apply_html("html/convo/text/start_raw.html")
apply(string.sub(text,p+3,np-1))
apply_html("html/convo/text/end.html")
elseif string.sub(text,p+1,p+1) == "i" then -- independant image, no username
convo_start(green)
convo_header_start()
convo_image(string.sub(text,p+3,np-1))
elseif string.sub(text,p+1,p+1) == "!" then -- independant image, no username
convo_notes(string.sub(text,p+3,np-1))
notes = true
else
-- new user name
convo_end()
if green then
green = false
else
green = true
end
convo_start(green)
-- this is a header section
convo_header_start()
-- lets check for images
local nl = string.find(text,"\n",p+1)
local nlp = string.find(text,"\n",nl+1)
current_user = string.sub(text,p+1,np-1)
user[current_user] = user[current_user] or {image = nil}
if nlp and string.sub(text,nl+1,nl+1) == "i" then
user[current_user].image = string.sub(text,nl+3,nlp-1)
skip = skip + 1
nl = string.find(text,"\n",nl+1)
nlp = string.find(text,"\n",nlp+1)
end
convo_image(user[current_user].image)
-- print name
apply_html("html/convo/header/name/start.html")
apply(string.sub(text,p+1,np-1))
apply_html("html/convo/header/name/end.html")
-- lets check for dates
if nlp and string.sub(text,nl+1,nl+1) == "d" then
convo_date(string.sub(text,nl+3,nlp-1))
skip = skip + 1
else
convo_date("")
end
header = true
end
end
while skip > 0 do
p = string.find(text,"\n",p+1)
skip = skip - 1
end
else
break
end
end
convo_end()
-- 3.5 separation
apply_html("html/spacer.html")
-- fourth lets make word lists
-- process contents
-- lets print the words
apply_html("html/spacer.html")
apply_html("html/words/start.html")
for i=1, #word_list do
print_word_stuff(word_list[i])
end
apply_html("html/words/end.html")
-- pop up
apply_html("html/pop_up.html")
-- lets end the html
apply_html("html/end.html")

49
get_words.lua Normal file
View File

@@ -0,0 +1,49 @@
function getWords(path)
local file = io.open(path,"r")
local text = file:read("*all")
file:close()
local t = {} -- this table will hold our words!!! words format is {word, translation, types, canon origin, meta origin, notes} last three are optional.
local p = 0 -- current position, nil if at end of file
while p do
p = p + 1
local new_word_data = ""
-- this isnt the whole word yet, but all the data around it separated with tabs, so lets get what we want.
-- careful if its uh end of file tho!
local np = string.find(text,"\n",p) -- np is the next word. this is so we can slice it
if np then
new_word_data = string.sub(text, p, np-1)
else
new_word_data = string.sub(text, p)
end
if new_word_data ~= "" then
local new_word = {} -- we'll hold it all here once spliced
local wp = 0 -- word data position!
while wp do -- nil if at end of string so.
wp = wp + 1 -- lets move past the tab we just found
local wnp = string.find(new_word_data, " ",wp)
local stuff = ""
-- we now splice the word every tab and add it to the uhhh
if wnp then
stuff = string.sub(new_word_data, wp, wnp-1) or stuff
else
stuff = string.sub(new_word_data,wp) or stuff
end
table.insert(new_word,stuff)
wp = wnp
end
-- now we add the word ot the word table
table.insert(t, new_word)
end
-- and move on the next
p = np
end
-- now we just. return the table.
return t
end

1
heonian-ime Submodule

Submodule heonian-ime added at c8157f53b1

View File

@@ -2,9 +2,8 @@
<div id="popup">
<h1>um</h1>
<p id="popup-heo"></p>
<div class="spacer"></div>
<div id="spacerhide" class="spacer"></div>
<div id="popup-middle">
<b>type: </b><span id="popup-type"></span><br>
<div id="popup-quirks-container"><span id="popup-quirks"></span></div>
</div>
<div class="spacer"></div>

View File

@@ -23,6 +23,6 @@
<textarea type="text" class="ime">
</textarea>
<script src="./ime.js" async defer></script>
<script src="./heonian-ime/ime.js" async defer></script>
</body>
</html>

565
ime.js
View File

@@ -1,153 +1,30 @@
let input = [];
// bug: if you fuck up input really badly, you might get a ??? unicode to print.
// it successfully breaks everything. however, im not managing to repro it so...
// (shruggie)
let currentWord = [];
let selected = -1;
// let h;
window.onload = () => {
document.querySelectorAll(".ime").forEach(input => {
input.addEventListener("keydown", (key) => {
imeDown(key, input);
});
input.addEventListener("mousedown", (e) => {
e.preventDefault();
input.focus();
imeUpdate(input);
})
h = new HeonianIME(input);
});
}
function imeDown(keyEvent, inputField) {
keyEvent.preventDefault();
switch (keyEvent.key) {
case "Backspace":
if (selected == -1) {
if (currentWord.join("") == "") {
currentWord = input.pop() || [];
} else {
imeRestore(currentWord);
// currentWord.pop();
}
} else {
imeRestore(input[selected]);
// input[selected].pop();
if (input[selected].join("") == "") {
input.splice(selected,1);
imeMove("left");
}
}
break;
case "Enter":
if (selected == -1) {
if (currentWord.join() == "") { //blame js :)
let s = document.createElement("p");
s.innerText = input.join("");
document.body.appendChild(s);
input = [];
selected = -1;
} else {
input.push(currentWord);
currentWord = [];
}
} else {
if (selected+1 >= input.length) {
selected = -1;
} else {
selected += 1;
}
}
imeReset();
break;
case "Space":
//adds a '
break;
case "ArrowLeft":
imeMove("left");
break;
case "ArrowRight":
imeMove("right");
break;
case "ArrowDown":
imeMove("start");
break;
case "ArrowUp":
imeMove("end");
break;
default:
imeInput(keyEvent.key);
if (selected == -1) {
currentWord = inputFull;
} else {
input[selected] = inputFull;
}
break;
}
imeUpdate(inputField);
}
class HeonianIME {
constructor(what) {
this.input = [];
this.currentWord = [];
this.selected = -1;
function imeUpdate(inputField) {
let renderText = "";
input.forEach((w) => {
renderText += w.join("");
})
inputField.value = renderText + currentWord.join("");
if (selected == -1) {
inputField.setSelectionRange(renderText.length, renderText.length+currentWord.join("").length);
} else {
from = 0;
for (let x = 0; x < selected; x++) {
from += input[x].join("").length;
}
to = from+input[selected].join("").length;
inputField.setSelectionRange(from, to);
}
}
this.inputState = 0; //STARTING, COMPOSTING, TRAILING, Fucking Nothing, ...cleanup
this.stateState = 0; //depends on the state
this.inputFull = [];
this.inputCurrent = "";
function clamp(min, max, value) {
return Math.max(min, Math.min(max, value));
}
this.ourHtml;
this.oldText = [];
function imeMove(direction) {
let d = 1;
if (currentWord.join("") != "") {
input.push(currentWord);
currentWord = [];
d = 2;
}
switch (direction) {
case "start":
selected = 0;
break;
case "end":
selected = -1;
break;
case "left":
if (selected == -1) selected = input.length;
selected -= 1 * d;
if (selected != -1) {
selected = clamp(0,input.length,selected);
//is there even a point in clamping it here,,,,
}
break;
case "right":
selected += 1 * d;
selected = clamp(0,input.length,selected);
//tbh same here, like.
//oh well ig ???/
if (selected == input.length) {
selected = -1;
}
break;
}
imeReset();
}
let inputState = 0; //STARTING, COMPOSTING, TRAILING, Fucking Nothing, ...cleanup
let stateState = 0; //depends on the state
let inputFull = [];
let inputCurrent = "";
let hVowels = { //standalone, composing, trailing
this.hVowels = { //standalone, composing, trailing
"a": ["0", "5", "A"],
"e": ["1", "6", "B"],
"i": ["2", "7", "C"],
@@ -155,7 +32,7 @@ let hVowels = { //standalone, composing, trailing
"u": ["4", "9", "E"]
};
let hConsonants = { //0 = standalone, 1 = composing, 2-6 = vowels
this.hConsonants = { //0 = standalone, 1 = composing, 2-6 = vowels
"g": "01",
"s": "02",
"r": "03",
@@ -174,21 +51,201 @@ let hConsonants = { //0 = standalone, 1 = composing, 2-6 = vowels
"h": "10",
};
function getUnicodeVowel(vowel, sot) {
this.hVowelsK = Object.keys(this.hVowels)
this.hConsonantsK = Object.keys(this.hConsonants);
this.hConsonantsR = this.inverse(this.hConsonants);
this.ourHtml = what;
this.oldText = [what.value.slice(0, what.selectionStart), what.value.slice(what.selectionStart)];
what.addEventListener("keydown", (key) => {
this.imeDown(key, what);
});
what.addEventListener("mousedown", (e) => {
this.mouse(e, what);
});
}
mouse(e, what) {
e.preventDefault();
what.focus();
this.imeUpdate(what);
}
imeDetach() {
//how do we detach this without . uh,
let renderText = "";
this.input.forEach((w) => {
renderText += w.join("");
})
if (this.selected == -1) {
this.ourHtml.setSelectionRange(this.oldText[0].length+renderText.length, this.oldText[0].length+renderText.length);
} else {
if (this.input.join("") != "") {
let from = 0;
for (let x = 0; x < this.selected; x++) {
from += this.input[x].join("").length;
}
this.ourHtml.setSelectionRange(this.oldText[0].length+from, this.oldText[0].length+from);
}
}
this.imeDown = ()=>{};
this.mouse = ()=>{};
//close enough?
}
imePush() {
//basically equavlient to pressing enter.
if (this.selected == -1) {
if (this.currentWord.join() == "") { //blame js :)
let s = document.createElement("p");
s.innerText = this.input.join("");
document.body.appendChild(s);
this.input = [];
this.selected = -1;
} else {
this.input.push(this.currentWord);
this.currentWord = [];
}
this.imeReset();
} else {
if (this.selected + 1 >= this.input.length) {
this.selected = -1;
} else {
this.selected += 1;
}
this.imeReset(true);
}
}
imeDown(keyEvent, inputField) {
keyEvent.preventDefault();
switch (keyEvent.key) {
case "Backspace":
if (this.selected == -1) {
if (this.currentWord.join("") == "") {
this.currentWord = this.input.pop() || [];
} else {
this.imeRestore(this.currentWord);
// this.currentWord.pop();
}
} else {
this.imeRestore(this.input[this.selected]);
// this.input[this.selected].pop();
if (this.input[this.selected].join("") == "") {
this.input.splice(this.selected, 1);
this.imeMove("left");
}
}
break;
case "Enter":
this.imePush()
break;
case "Space":
//adds a ', on second press . an actual space
break;
case "ArrowLeft":
this.imeMove("left");
break;
case "ArrowRight":
this.imeMove("right");
break;
case "ArrowDown":
this.imeMove("start");
break;
case "ArrowUp":
this.imeMove("end");
break;
case "Escape":
this.imeDetach();
return;
default:
this.imeInput(keyEvent.key);
if (this.selected == -1) {
this.currentWord = this.inputFull;
} else {
this.input[this.selected] = this.inputFull;
}
break;
}
this.imeUpdate(inputField);
}
imeUpdate(inputField) {
let renderText = "";
this.input.forEach((w) => {
renderText += w.join("");
})
inputField.value = this.oldText[0] + renderText + this.currentWord.join("") + this.oldText[1];
if (this.selected == -1) {
inputField.setSelectionRange(this.oldText[0].length+renderText.length, this.oldText[0].length+renderText.length + this.currentWord.join("").length);
} else {
if (this.input.join("") != "") {
let from = 0;
for (let x = 0; x < this.selected; x++) {
from += this.input[x].join("").length;
}
let to = from + this.input[this.selected].join("").length;
inputField.setSelectionRange(this.oldText[0].length+from, this.oldText[0].length+to);
}
}
}
clamp(min, max, value) {
return Math.max(min, Math.min(max, value));
}
imeMove(direction) {
let d = 1;
if (this.currentWord.join("") != "") {
this.input.push(this.currentWord);
this.currentWord = [];
d = 2;
}
switch (direction) {
case "start":
this.selected = 0;
break;
case "end":
this.selected = -1;
break;
case "left":
if (this.selected == -1) this.selected = this.input.length;
this.selected -= 1 * d;
if (this.selected != -1) {
this.selected = this.clamp(0, this.input.length, this.selected);
//is there even a point in clamping it here,,,,
}
break;
case "right":
this.selected += 1 * d;
this.selected = this.clamp(0, this.input.length, this.selected);
//tbh same here, like.
//oh well ig ???/
if (this.selected == this.input.length) {
this.selected = -1;
}
break;
}
this.imeReset(true);
}
getUnicodeVowel(vowel, sot) {
if (sot == "standalone") sot = 0;
if (sot == "composing") sot = 1;
if (sot == "trailing") sot = 2;
return String.fromCharCode(parseInt("E00" + hVowels[vowel][sot], 16));
return String.fromCharCode(parseInt("E00" + this.hVowels[vowel][sot], 16));
}
function getUnicodeConsonant(consonant, scv) {
getUnicodeConsonant(consonant, scv) {
if (scv == "standalone") { scv = 0; }
else if (scv == "trailing") { scv = 1; }
else {scv = Number(hVowels[scv][0])+2}
return String.fromCharCode(parseInt("E" + hConsonants[consonant] + "" + scv, 16));
else {
scv = Number(this.hVowels[scv][0]) + 2
}
return String.fromCharCode(parseInt("E" + this.hConsonants[consonant] + "" + scv, 16));
}
function inverse(obj){
inverse(obj) {
var retobj = {};
for (var key in obj) {
retobj[obj[key]] = key;
@@ -196,38 +253,26 @@ function inverse(obj){
return retobj;
}
let hVowelsK = Object.keys(hVowels)
let hConsonantsK = Object.keys(hConsonants);
let hConsonantsR = inverse(hConsonants);
function debugInput(key) {
console.log("pre "+key+": inputstate - "+inputState +", statestate - "+ stateState);
console.log("inputfull: " + inputFull.join(" ") + ", inputcurrent:" + inputCurrent);
imeInput(key);
console.log("post "+key+": inputstate - "+inputState +", statestate - "+ stateState);
console.log("inputfull: " + inputFull.join(" ") + ", inputcurrent:" + inputCurrent);
console.log("------------------------------")
}
function imeReset() {
stateState = 0;
inputState = 0;
inputFull = [];
inputCurrent = "";
if (selected == -1) {
currentWord = [];
imeReset(soft = false) {
this.stateState = 0;
this.inputState = 0;
this.inputFull = [];
this.inputCurrent = "";
if (!soft) {
if (this.selected == -1) {
this.currentWord = [];
} else {
input[selected] = [];
this.input[this.selected] = [];
}
}
}
}
function imeInfo(decHex) {
imeInfo(decHex) {
try {
let hex = decHex.codePointAt(0).toString(16);
hex[1] = parseInt(hex[1], 16);
hex[2] = parseInt(hex[2], 16);
hex[3] = parseInt(hex[3], 16);
let hex = decHex.codePointAt(0).toString(16).split("");
hex[1] = hex[1].toString(16);//parseInt(hex[1], 16);
hex[2] = hex[2].toString(16);//parseInt(hex[2], 16);
hex[3] = hex[3].toString(16);//parseInt(hex[3], 16);
let ka = (hex[1] == 0 && hex[2] == 0) ? "a" : "k";
if (ka == "k") {
if (hex[3] == 1) {
@@ -255,143 +300,173 @@ function imeInfo(decHex) {
}
}
function imeChange(inState, stState, pop, array) {
inputState = inState;
stateState = stState;
imeChange(inState, stState, pop, array) {
this.inputState = inState;
this.stateState = stState;
if (pop) {
array.pop();
}
inputFull = array;
this.inputFull = array;
}
function imeRestore(array) {
let hex = array[array.length-1].codePointAt(0).toString(16);
hex[1] = parseInt(hex[1], 16);
hex[2] = parseInt(hex[2], 16);
hex[3] = parseInt(hex[3], 16);
let previous = imeInfo(array[array.length-2])[1];
// @remi@snug.moe:
// we made a backspace key that works!!!!!!!
// @meduelelateta@sweet.succubi.services:
// ari fell asleep
imeRestore(array) {
let hex = array[array.length - 1].codePointAt(0).toString(16).split("");
hex[1] = hex[1].toString(16);//parseInt(hex[1], 16);
hex[2] = hex[2].toString(16);//parseInt(hex[2], 16);
hex[3] = hex[3].toString(16);//parseInt(hex[3], 16);
let previous = this.imeInfo(array[array.length - 2])[1];
let ka = (hex[1] == 0 && hex[2] == 0) ? "a" : "k";
if (ka == "k") {
if (hex[3] == 1) {
//trailing
if (previous == "trailing") {
//trailing twice
console.log("2.1");
imeChange(2,1,true,array);
// console.log("2.1");
this.imeChange(2, 1, true, array);
} else {
//trailing once
console.log("2.0");
imeChange(2,0,true,array);
// console.log("2.0");
this.imeChange(2, 0, true, array);
}
} else if (hex[3] == 0) {
console.log(array.length);
if (array.length != 1) {
//0.1, i think?
console.log("0.1");
imeChange(0,1,true,array);
// console.log("0.1");
this.imeChange(0, 1, true, array);
} else {
//standalone
console.log("full reset");
imeReset();
// console.log("full reset");
this.imeReset();
}
} else {
//composing
if (previous == "standalone") {
//0.1??
//recreate?? last digit???
let c = hConsonantsR[[hex[1], hex[2]].join("").toUpperCase()];
let c = this.hConsonantsR[[hex[1], hex[2]].join("").toUpperCase()];
array.pop();
array.push(getUnicodeConsonant(c, "standalone"));
inputCurrent = c;
array.push(this.getUnicodeConsonant(c, "standalone"));
this.inputCurrent = c;
console.log("0.1");
imeChange(0,1,false,array);
// console.log("0.1");
this.imeChange(0, 1, false, array);
} else {
//0.2???? fuck it lets try and find out ig
//recreate?? last digit???
let c = hConsonantsR[[hex[1], hex[2]].join("").toUpperCase()];
let c = this.hConsonantsR[[hex[1], hex[2]].join("").toUpperCase()];
array.pop();
array.push(getUnicodeConsonant(c, "standalone"));
inputCurrent = c;
array.push(this.getUnicodeConsonant(c, "standalone"));
this.inputCurrent = c;
console.log("0.2");
imeChange(0,2,false,array);
// console.log("0.2");
this.imeChange(0, 2, false, array);
}
}
} else {
if (hex[3] <= 8) {
//standalone
console.log("full reset");
imeReset();
// console.log("full reset");
this.imeReset();
} else {
//trailing
if (previous == "trailing") {
//trailing twice
console.log("2.1");
imeChange(2,1,true,array);
// console.log("2.1");
this.imeChange(2, 1, true, array);
} else {
//trailing once
console.log("2.0");
imeChange(2,0,true,array);
// console.log("2.0");
this.imeChange(2, 0, true, array);
}
}
}
}
function imeInput(key) {
imeInput(key) {
key = key.toLowerCase();
if (!hConsonantsK.includes(key) && !hVowelsK.includes(key)) return;
switch (inputState) {
if (!this.hConsonantsK.includes(key) && !this.hVowelsK.includes(key)) return;
switch (this.inputState) {
case 0: //starting
if (stateState == 0) {
if (hVowelsK.includes(key)) {
inputFull.push(getUnicodeVowel(key, "standalone"));
inputState = 2;
if (this.stateState == 0) {
if (this.hVowelsK.includes(key)) {
this.inputFull.push(this.getUnicodeVowel(key, "standalone"));
this.inputState = 2;
} else {
inputFull.push(getUnicodeConsonant(key, "standalone"));
stateState = 1;
inputCurrent = key;
this.inputFull.push(this.getUnicodeConsonant(key, "standalone"));
this.stateState = 1;
this.inputCurrent = key;
}
break;
} else if (stateState == 1) {
if (hVowelsK.includes(key)) {
inputState = 1;
stateState = 0;
} else if (this.stateState == 1) {
if (this.hVowelsK.includes(key)) {
this.inputState = 1;
this.stateState = 0;
} else {
inputFull.push(getUnicodeConsonant(key, "trailing"));
inputCurrent = key;
stateState = 2;
this.inputFull.push(this.getUnicodeConsonant(key, "trailing"));
this.inputCurrent = key;
this.stateState = 2;
break;
}
} else if (stateState == 2) {
if (hVowelsK.includes(key)) {
inputState = 1;
stateState = 0;
} else if (this.stateState == 2) {
if (this.hVowelsK.includes(key)) {
this.inputState = 1;
this.stateState = 0;
} else break;
}
case 1: //composing
if (hVowelsK.includes(key)) {
inputState = 2;
inputFull.pop();
inputFull.push(getUnicodeConsonant(inputCurrent, key));
inputCurrent = "";
if (this.hVowelsK.includes(key)) {
this.inputState = 2;
this.inputFull.pop();
this.inputFull.push(this.getUnicodeConsonant(this.inputCurrent, key));
this.inputCurrent = "";
}
break;
case 2: //trailing
if (hVowelsK.includes(key)) {
inputFull.push(getUnicodeVowel(key, "trailing"));
stateState += 1;
if (this.hVowelsK.includes(key)) {
if (this.stateState == 1 && this.inputCurrent != "") {
this.inputFull.pop();
let ic = this.inputCurrent;
let k = key;
this.imePush();
this.inputFull.pop();
this.inputFull.push(this.getUnicodeConsonant(ic, k));
this.inputCurrent = "";
this.inputState = 2;
} else {
inputFull.push(getUnicodeConsonant(key, "trailing"));
stateState += 1;
this.inputFull.push(this.getUnicodeVowel(key, "trailing"));
this.inputCurrent = "";
this.stateState += 1;
}
if (stateState == 2) {
stateState = 0;
inputState = 3;
} else {
this.inputFull.push(this.getUnicodeConsonant(key, "trailing"));
this.inputCurrent = key;
this.stateState += 1;
}
if (this.stateState == 2) {
this.stateState = 0;
this.inputState = 3;
};
break;
case 3: //go to next word uwu
//todo :)
if (this.hVowelsK.includes(key)) {
this.inputFull.pop();
let ic = this.inputCurrent;
let k = key;
this.imePush();
this.inputFull.pop();
this.inputFull.push(this.getUnicodeConsonant(ic, k));
this.inputCurrent = "";
this.inputState = 2;
} else {
this.imePush();
this.imeInput(key);
}
break;
}
}
}

View File

@@ -20,7 +20,7 @@ LU'NYA
relfur chu mya pu yu mya relfur lup apatka'nya faka'nya'pash ponme mya wawote polika'nya peekaka'nya'pash.
ESH'NYUI
mi'shi'pash~
mi'shi'pashshu
balfur yu e ton polika'nya dre?
LU'NYA
@@ -29,15 +29,15 @@ LU'NYA
balfurla yu dra?
ESH'NYUI
relfurla yu esh'dre mya ton polika'nya yu puroton ka'nya~
relfur yu shi'ro'bae'pu yu pon'ya ka'nya~
relfurla yu esh'dre mya ton polika'nya yu puroton ka'nyashu
relfur yu shi'ro'bae'pu yu pon'ya ka'nyashu
LU'NYA
puroton yu ponya ton ka'nya!
ESH'NYUI
be'nyui-rerenlafura yu meluton mimifaka'nya…
relfur yu meluton mimiku'pash~
relfur yu meluton mimiku'pashshu
LU'NYA
o'o, relfur chu parefaka'nya…
@@ -46,7 +46,7 @@ LU'NYA
ESH'NYUI
uu, relfur yu naomiminku mya mimifuku mya ton ka'nya...
relfur yu guraton to meluton mimifuku..
relfur yu ton mimiku'pash~
relfur yu ton mimiku'pashshu
LU'NYA
ishi-balfur yu mishi'pash!
@@ -54,8 +54,8 @@ LU'NYA
ESH'NYUI
i eshnyui_blush.png
yesh-balfur yu mishi'pash~
(>///////////////<)
yesh-balfur yu mishi'pashshu
r (>///////////////<)
relfur yu ari'laen parefaka'nya, balfur yu pareka'nya dra?
LU'NYA

View File

@@ -1,23 +1,40 @@
ITS ME PEKORA
d deez
r hiiiii!!!!
! uwu
NOUNS
d nya
ren
renla
renlan
relfur
renlafura
m
VERBS
r TENSES
utiku
utikanya
utikome
/
r FORMAL
utika'nya
utikome
/
r INFORMAL
uti'nya
uti'me
/
r FEELING
utikupash
utifakupash
utikufapash
utifakufapash
/
r IMPERATIVE
utikudash
utifakudash
utikufadash
utifaku
HOLY SHIT REMI
d a
amogus
it's meee pekora!!!!
i eshnyui.png
d yolo
so cool
so cool
so cool
how this work owo
so cool
so uwu
very good

206
main.js
View File

@@ -4,6 +4,7 @@ let currentFont = "r";
let timeout = "";
let badge_type = "#696969"
let badge_generic = "#393939"
let badge_register= "#fed100"
let badge_number = "#420690"
@@ -13,20 +14,94 @@ let badge_mood = "#dd00dd"
let badge_negation = "#133337"
let quirkBadges = {
"formal1": {
// TYPES
"verb": {
"name": "Verb",
"description": "This word expresses an action that the subject of the sentence performs.",
"color": badge_type,
"type": "Type",
"bending": "-ku"
},
"marker": {
"name": "marker",
"description": "This word accomplishes some syntactic purpose in the sentence.",
"color": badge_type,
"type": "Type",
"bending": ""
},
"noun": {
"name": "Noun",
"description": "This word refers to a concept.",
"color": badge_type,
"type": "Type",
"bending": ""
},
"pronoun": {
"name": "Pronoun",
"description": "This word occupies the place of a noun.",
"color": badge_type,
"type": "Type",
"bending": ""
},
"modifier": {
"name": "Modifier",
"description": "This word modifies another word to specify meaning.",
"color": badge_type,
"type": "Type",
"bending": ""
},
"expression": {
"name": "Expression",
"description": "This is an idiomatic expression.",
"color": badge_type,
"type": "Type",
"bending": ""
},
// FORMAL REGISTER
"formal-n1": {
"name": "Formal",
"description": "This word is used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "-lfur"
},
"formal2": {
"formal-n2": {
"name": "Formal",
"description": "This word is used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "-lafura"
},
"formal-v1": {
"name": "Formal",
"description": "This word is used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "ku -> kanya"
},
"formal-v2": {
"name": "Formal",
"description": "This word is used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "ku -> kome"
},
// INFORMAL REGISTER
"informal-v1": {
"name": "Informal",
"description": "This word is NOT used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "ku -> nya"
},
"informal-v2": {
"name": "Informal",
"description": "This word is NOT used in formal or sincere settings.",
"color": badge_register,
"type": "Register",
"bending": "ku -> me"
},
// POSSESIVES
"genitive": {
"name": "Generic Possesive",
"description": "This word is describing a generic possesive relationship.",
@@ -39,29 +114,54 @@ let quirkBadges = {
"description": "This word is describing a specific possesive relationship.",
"color": badge_case,
"type": "Case",
"bending": "la"
"bending": "-la"
},
// NUMBER
"dual": {
"name": "Dual",
"description": "This word is denoted as refering to exactly two entities.",
"color": badge_number,
"type": "Number",
"bending": ""
},
"plural": {
"name": "Plural",
"description": "This word is denoted as more than one",
"description": "This word is denoted as refering to at least more than one entity.",
"color": badge_number,
"type": "Number",
"bending": "n"
"bending": "-n"
},
"present-tense": {
// PRESENT TENSE
"present-tense-formal": {
"name": "Present",
"description": "This word is in the present tense.",
"color": badge_tense,
"type": "Tense",
"bending": "ku → ka'nya"
},
"past-tense": {
"present-tense-informal": {
"name": "Present",
"description": "This word is in the present tense.",
"color": badge_tense,
"type": "Tense",
"bending": "ku → nya"
},
// PAST TENSE
"past-tense-formal": {
"name": "Past",
"description": "This word is in the past tense.",
"color": badge_tense,
"type": "Tense",
"bending": "ku → kome"
},
"past-tense-informal": {
"name": "Past",
"description": "This word is in the past tense.",
"color": badge_tense,
"type": "Tense",
"bending": "ku → me"
},
// VOLITIONAL
"volitional-mood": {
"name": "Feeling",
"description": "This word expresses a feeling or craving mood.",
@@ -69,6 +169,14 @@ let quirkBadges = {
"type": "Mood",
"bending": "-pash"
},
"volitional-mood-negated": {
"name": "Negated Feeling",
"description": "This word denies feeling or craving mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-fapash"
},
// IMPERATIVE
"imperative-mood": {
"name": "Imperative",
"description": "This word expresses a imperative mood.",
@@ -76,27 +184,82 @@ let quirkBadges = {
"type": "Mood",
"bending": "-dash"
},
"imperative-mood-negated": {
"name": "Negated Imperative",
"description": "This word denies a imperative mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-fadash"
},
// SHY
"shy-mood": {
"name": "Shy",
"description": "This word expresses a shy mood..",
"description": "This word expresses a shy mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-bash"
},
"shy-mood-negated": {
"name": "Negated Shy",
"description": "This word denies a shy mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-fabash"
},
// THREAT
"threat-mood": {
"name": "Threat",
"description": "This word expresses a threatening mood..",
"description": "This word expresses a threatening mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-tash"
},
"threat-mood-negated": {
"name": "Negated Threat",
"description": "This word denies a threatening mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-fatash"
},
// COMF
"comfy-mood": {
"name": "Comfort",
"description": "This word expresses a comfortable mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-shu"
},
"comfy-mood-negated": {
"name": "Negated Comfort",
"description": "This word denies a comfortable mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-fashu"
},
// EXCITEMENT
"excited-mood": {
"name": "Excitement",
"description": "This word expresses a excited mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-ha"
},
"excited-mood-negated": {
"name": "Negated Excitement",
"description": "This word denies a excited mood.",
"color": badge_mood,
"type": "Mood",
"bending": "-faha"
},
// NEGATION
"negated": {
"name": "Negative",
"description": "The word is expressing a negated meaning.",
"color": badge_negation,
"type": "Negation",
"bending": "-fa-"
"bending": "fa-"
},
// UNKNOWN
"unknown-tag": {
"name": "Unknown tag",
"color": "#393939",
@@ -128,19 +291,19 @@ function showPopup(ogword, word, quirks = "") {
let c = document.querySelector("#popup-container");
word = cleanWord(word);
if (currentFont == "r") {
p.querySelector("h1").innerText = words[word]["romanizationProper"];
p.querySelector("#popup-heo").innerText = words[word]["heonian"];
p.querySelector("h1").innerText = ogword;
p.querySelector("#popup-heo").innerText = words[word]["romanizationProper"] + " | " + words[word]["heonian"];
p.querySelector("h1").style.fontFamily = "var(--font-normal)";
} else {
p.querySelector("h1").innerText = words[word]["heonian"];
p.querySelector("#popup-heo").innerText = words[word]["romanizationProper"];
p.querySelector("h1").innerText = ogword;
p.querySelector("#popup-heo").innerText = words[word]["heonian"] + " | " + words[word]["romanizationProper"];
p.querySelector("h1").style.fontFamily = "var(--font-heonian)";
}
p.querySelector("#popup-type").innerText = words[word]["type"];
//p.querySelector("#popup-type").innerText = words[word]["type"];
p.querySelector("#popup-meaning").innerText = words[word]["meaning"];
p.querySelector("#popup-quirks").innerHTML = "";
if (quirks.trim() != "") {
p.querySelector("#popup-quirks-container").style.display = "block";
p.querySelector("#popup-middle").style.display = "block";
let qyuirks = quirks.split(" ");
qyuirks.forEach(quirk => {
let badge = document.createElement("div");
@@ -150,10 +313,11 @@ function showPopup(ogword, word, quirks = "") {
badge.style.boxShadow = "0px 0px 4px " + quirkBadges[quirk]["color"] + "cc";
badge.innerText = quirkBadges[quirk]["name"];
badge.onclick = () => {
p.querySelector("#spacerhide").style.display = "none";
p.querySelector("#popup-middle").style.display = "none";
p.querySelector("h1").innerText = quirkBadges[quirk]["name"];
p.querySelector("#popup-meaning").innerText = quirkBadges[quirk]["description"];
p.querySelector("#popup-type").innerText = quirkBadges[quirk]["type"];
p.querySelector("#popup-quirks-container").style.display = "none";
//p.querySelector("#popup-type").innerText = quirkBadges[quirk]["type"];
p.querySelector("#popup-heo").innerText = quirkBadges[quirk]["bending"];
}
} catch (e) {
@@ -162,9 +326,11 @@ function showPopup(ogword, word, quirks = "") {
badge.innerText = quirkBadges["unknown-tag"]["name"];
}
p.querySelector("#popup-quirks").appendChild(badge);
p.querySelector("#spacerhide").style.display = "block";
});
} else {
p.querySelector("#popup-quirks-container").style.display = "none";
p.querySelector("#spacerhide").style.display = "none";
p.querySelector("#popup-middle").style.display = "none";
}
c.style.opacity = 1;
c.style.pointerEvents = "all";
@@ -230,7 +396,7 @@ function createWordList() { //sometimes i really dislike javascript..
words[n]["heonian"] = e[0].innerText;
words[n]["romanization"] = e[1].innerText.replace(". ", "");
words[n]["romanizationProper"] = e[1].innerText;
words[n]["type"] = e[2].innerText;
//words[n]["type"] = e[2].innerText;
words[n]["meaning"] = e[3].innerText;
}
});

0
test.htm Normal file
View File

1638
test.html

File diff suppressed because it is too large Load Diff

View File

@@ -223,7 +223,7 @@ main {
}
#popup-heo, #smol-heo {
font-family: "heonian";
font-family: var(--font-heonian);
text-align: center;
margin: 4px;
margin-bottom: 8px;