From ec76802316cddfbf0037ba8d030a13d75c50707a Mon Sep 17 00:00:00 2001 From: UndeadMaelys Date: Tue, 10 May 2022 18:36:05 +0200 Subject: [PATCH] fix badges. fix pronouns duals categorization and generated description --- generator.lua | 77 +++++++++++++++++++++++++++++++++++++++++---------- main.js | 16 ++++++++++- test.html | 28 +++++++++++-------- 3 files changed, 93 insertions(+), 28 deletions(-) diff --git a/generator.lua b/generator.lua index c90ed11..2c7feb4 100644 --- a/generator.lua +++ b/generator.lua @@ -82,8 +82,22 @@ function process_content(content) 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 = [[ ]] - local REPLACE_PRINT = print_text while string.find(html_stuff, "REPLACE_PRINT") do html_stuff = string.gsub(html_stuff, "REPLACE_PRINT", REPLACE_PRINT) end - local REPLACE_WORD = strip_symbols(print_text) while string.find(REPLACE_WORD, "%\'") do REPLACE_WORD = string.gsub(REPLACE_WORD, "%\'", "$") end @@ -110,20 +122,9 @@ function process_content(content) html_stuff = string.gsub(html_stuff, "REPLACE_WORD", REPLACE_WORD) end - local REPLACE_SEARCH = new_word while string.find(html_stuff, "REPLACE_SEARCH") do html_stuff = string.gsub(html_stuff, "REPLACE_SEARCH", REPLACE_SEARCH) 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 while string.find(REPLACE_DATA, "\t") do @@ -164,7 +165,31 @@ function print_word_stuff(word) exit = true 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") end @@ -177,7 +202,6 @@ 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 @@ -295,6 +319,29 @@ function revert_nouns(str, tbl) 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 diff --git a/main.js b/main.js index 4b60708..384b6b3 100644 --- a/main.js +++ b/main.js @@ -22,6 +22,13 @@ let quirkBadges = { "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.", @@ -110,9 +117,16 @@ let quirkBadges = { "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" diff --git a/test.html b/test.html index 4e0fd02..f3cbb27 100644 --- a/test.html +++ b/test.html @@ -1536,8 +1536,8 @@ ESH'NYUI rerenlafura @@ -1578,8 +1578,8 @@ ESH'NYUI  @@ -1774,8 +1774,8 @@ LU'NYA babanlafura @@ -1824,8 +1824,8 @@ LU'NYA  @@ -3769,10 +3769,12 @@ bunny rere -??? +Pronoun -??? +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. @@ -3825,10 +3827,12 @@ to know, to learn baba -??? +Pronoun -??? +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.