fix badges. fix pronouns duals categorization and generated description

This commit is contained in:
UndeadMaelys 2022-05-10 18:36:05 +02:00
parent 6da5e47e5c
commit ec76802316
3 changed files with 93 additions and 28 deletions

View File

@ -82,8 +82,22 @@ function process_content(content)
new_word, indicators = revert_verbs(new_word, indicators) new_word, indicators = revert_verbs(new_word, indicators)
new_word, indicators = revert_nouns(new_word,indicators) new_word, indicators = revert_nouns(new_word,indicators)
new_word, indicators = categorize_word(new_word,indicators) new_word, indicators = categorize_word(new_word,indicators)
add_word(new_word) 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 = [[ local html_stuff = [[
<span <span
class="clickable" class="clickable"
@ -94,12 +108,10 @@ function process_content(content)
</span> </span>
]] ]]
local REPLACE_PRINT = print_text
while string.find(html_stuff, "REPLACE_PRINT") do while string.find(html_stuff, "REPLACE_PRINT") do
html_stuff = string.gsub(html_stuff, "REPLACE_PRINT", REPLACE_PRINT) html_stuff = string.gsub(html_stuff, "REPLACE_PRINT", REPLACE_PRINT)
end end
local REPLACE_WORD = strip_symbols(print_text)
while string.find(REPLACE_WORD, "%\'") do while string.find(REPLACE_WORD, "%\'") do
REPLACE_WORD = string.gsub(REPLACE_WORD, "%\'", "$") REPLACE_WORD = string.gsub(REPLACE_WORD, "%\'", "$")
end end
@ -110,20 +122,9 @@ function process_content(content)
html_stuff = string.gsub(html_stuff, "REPLACE_WORD", REPLACE_WORD) html_stuff = string.gsub(html_stuff, "REPLACE_WORD", REPLACE_WORD)
end end
local REPLACE_SEARCH = new_word
while string.find(html_stuff, "REPLACE_SEARCH") do while string.find(html_stuff, "REPLACE_SEARCH") do
html_stuff = string.gsub(html_stuff, "REPLACE_SEARCH", REPLACE_SEARCH) html_stuff = string.gsub(html_stuff, "REPLACE_SEARCH", REPLACE_SEARCH)
end end
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
if REPLACE_DATA and REPLACE_DATA ~= "" then if REPLACE_DATA and REPLACE_DATA ~= "" then
while string.find(REPLACE_DATA, "\t") do while string.find(REPLACE_DATA, "\t") do
@ -164,7 +165,31 @@ function print_word_stuff(word)
exit = true exit = true
end end
end end
if not exit then cell_builder(mod_convertToHeonian(word),word, "???","???") 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") apply_html("html/words/definition/end.html")
end end
@ -177,7 +202,6 @@ function add_word(str)
end end
if add then if add then
table.insert(word_list,str) table.insert(word_list,str)
if not in_dictionary(str) then printW("\"" .. str .. "\" is not known") end
end end
end end
@ -295,6 +319,29 @@ function revert_nouns(str, tbl)
str, tbl = check_morphemes(str,tbl,"lafura","","formal-n2") str, tbl = check_morphemes(str,tbl,"lafura","","formal-n2")
-- then plural -- then plural
str, tbl = check_morphemes(str,tbl,"n","","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 return str, tbl
end end

16
main.js
View File

@ -22,6 +22,13 @@ let quirkBadges = {
"type": "Type", "type": "Type",
"bending": "-ku" "bending": "-ku"
}, },
"marker": {
"name": "marker",
"description": "This word accomplishes some syntactic purpose in the sentence.",
"color": badge_type,
"type": "Type",
"bending": ""
},
"noun": { "noun": {
"name": "Noun", "name": "Noun",
"description": "This word refers to a concept.", "description": "This word refers to a concept.",
@ -110,9 +117,16 @@ let quirkBadges = {
"bending": "-la" "bending": "-la"
}, },
// NUMBER // NUMBER
"dual": {
"name": "Dual",
"description": "This word is denoted as refering to exactly two entities.",
"color": badge_number,
"type": "Number",
"bending": ""
},
"plural": { "plural": {
"name": "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, "color": badge_number,
"type": "Number", "type": "Number",
"bending": "-n" "bending": "-n"

View File

@ -1536,8 +1536,8 @@ ESH'NYUI
<span <span
class="clickable" class="clickable"
onclick="showPopup('rerenlafura','rere','formal-n2 plural')" onclick="showPopup('rerenlafura','rere','formal-n2 plural pronoun')"
onmouseover="checkHover('rerenlafura','rere',this,'formal-n2 plural')" onmouseover="checkHover('rerenlafura','rere',this,'formal-n2 plural pronoun')"
onmouseout="clearHover()"> onmouseout="clearHover()">
rerenlafura rerenlafura
</span> </span>
@ -1578,8 +1578,8 @@ ESH'NYUI
<span <span
class="clickable" class="clickable"
onclick="showPopup('î³î³î<C2B3>¡îƒî†î²','rere','formal-n2 plural')" onclick="showPopup('î³î³î<C2B3>¡îƒî†î²','rere','formal-n2 plural pronoun')"
onmouseover="checkHover('î³î³î<C2B3>¡îƒî†î²','rere',this,'formal-n2 plural')" onmouseover="checkHover('î³î³î<C2B3>¡îƒî†î²','rere',this,'formal-n2 plural pronoun')"
onmouseout="clearHover()"> onmouseout="clearHover()">
 
</span> </span>
@ -1774,8 +1774,8 @@ LU'NYA
<span <span
class="clickable" class="clickable"
onclick="showPopup('babanlafura','baba','formal-n2 plural')" onclick="showPopup('babanlafura','baba','formal-n2 plural pronoun')"
onmouseover="checkHover('babanlafura','baba',this,'formal-n2 plural')" onmouseover="checkHover('babanlafura','baba',this,'formal-n2 plural pronoun')"
onmouseout="clearHover()"> onmouseout="clearHover()">
babanlafura babanlafura
</span> </span>
@ -1824,8 +1824,8 @@ LU'NYA
<span <span
class="clickable" class="clickable"
onclick="showPopup('î<C2A2>¡îƒî†î²','baba','formal-n2 plural')" onclick="showPopup('î<C2A2>¡îƒî†î²','baba','formal-n2 plural pronoun')"
onmouseover="checkHover('î<C2A2>¡îƒî†î²','baba',this,'formal-n2 plural')" onmouseover="checkHover('î<C2A2>¡îƒî†î²','baba',this,'formal-n2 plural pronoun')"
onmouseout="clearHover()"> onmouseout="clearHover()">
 
</span> </span>
@ -3769,10 +3769,12 @@ bunny
rere rere
</td> </td>
<td> <td>
??? Pronoun
</td> </td>
<td> <td>
??? This word refers to both the speaker and someone else the listener doesn't know about.
If in plural form, it refers to a group of people who all fit this definition.
</td> </td>
</tr> </tr>
<tr> <tr>
@ -3825,10 +3827,12 @@ to know, to learn
baba baba
</td> </td>
<td> <td>
??? Pronoun
</td> </td>
<td> <td>
??? This word refers to both the listener and someone else the speaker doesn't know about.
If in plural form, it refers to a group of people who all fit this definition.
</td> </td>
</tr> </tr>
<tr> <tr>