diff --git a/converter.lua b/converter.lua index 3df16f0..ec06f7e 100644 --- a/converter.lua +++ b/converter.lua @@ -99,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 @@ -140,7 +140,7 @@ function process_content(content) ac = string.sub(ac, string.find(ac, " ")+1) -- now we print the thing with teh appropiate indicators. - printD(print_text, table.unpack(indicators)) + -- printD(print_text, table.unpack(indicators)) end apply_html("html/convo/text/end.html") end @@ -177,7 +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 + if not in_dictionary(str) then printW("\"" .. str .. "\" is not known") end end end @@ -211,11 +211,18 @@ 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 - str = string.gsub(str,find, repl) - table.insert(tbl,indicator) + 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 @@ -227,12 +234,31 @@ function in_dictionary(str) 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 - table.insert(ind, string.lower(v[3])) - break + 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 @@ -259,6 +285,7 @@ function check_morphemes(str, tbl,match,repl,indicators) 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") @@ -275,7 +302,7 @@ function revert_verbs(str, tbl) 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") + 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"}) @@ -293,9 +320,9 @@ function revert_verbs(str, tbl) return str, tbl end -function revert_mood(str, tbl,match,repl,indicator) - str, tbl = find_n_replace(str, tbl,"fa"..match,repl,indicator.."-negated") - str, tbl = find_n_replace(str, tbl,match,repl,indicator) +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 diff --git a/heonian-content b/heonian-content index cc8e904..d0d8345 160000 --- a/heonian-content +++ b/heonian-content @@ -1 +1 @@ -Subproject commit cc8e904dcbfc916ebffa2cef029d82cd41592a47 +Subproject commit d0d8345c1ff1d2840558a67c6fe98a97bc4a69e6 diff --git a/input.txt b/input.txt index 72ef736..0ac707f 100644 --- a/input.txt +++ b/input.txt @@ -55,7 +55,7 @@ LU'NYA ESH'NYUI i eshnyui_blush.png yesh-balfur yu mishi'pashshu - (>///////////////<) +r (>///////////////<) relfur yu ari'laen parefaka'nya, balfur yu pareka'nya dra? LU'NYA diff --git a/main.js b/main.js index e8fa68e..4b60708 100644 --- a/main.js +++ b/main.js @@ -36,6 +36,13 @@ let quirkBadges = { "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.", diff --git a/test.html b/test.html index d404532..c55cc2f 100644 --- a/test.html +++ b/test.html @@ -55,8 +55,8 @@ LU'NYA

nyan'pash! @@ -95,16 +95,16 @@ LU'NYA polika'nya dre? @@ -113,16 +113,16 @@ LU'NYA

!  @@ -137,16 +137,16 @@ LU'NYA @@ -161,8 +161,8 @@ LU'NYA ? @@ -221,8 +221,8 @@ ESH'NYUI polika'nya @@ -231,8 +231,8 @@ ESH'NYUI

@@ -247,8 +247,8 @@ ESH'NYUI  @@ -273,8 +273,8 @@ ESH'NYUI

(po'nyash!!!) @@ -283,8 +283,8 @@ ESH'NYUI

(!!!) @@ -311,16 +311,16 @@ LU'NYA

aa, anko! @@ -329,16 +329,16 @@ LU'NYA

, ! @@ -347,8 +347,8 @@ LU'NYA

(po'nyash!) @@ -357,8 +357,8 @@ LU'NYA

(!) @@ -441,16 +441,16 @@ ESH'NYUI lili'nya dre? @@ -475,8 +475,8 @@ ESH'NYUI @@ -507,8 +507,8 @@ ESH'NYUI  @@ -523,8 +523,8 @@ ESH'NYUI ? @@ -618,16 +618,16 @@ LU'NYA apatka'nya faka'nya'pash @@ -658,16 +658,16 @@ LU'NYA polika'nya peekaka'nya'pash. @@ -676,8 +676,8 @@ LU'NYA

 @@ -724,8 +724,8 @@ LU'NYA  @@ -740,16 +740,16 @@ LU'NYA   @@ -788,8 +788,8 @@ LU'NYA  @@ -816,8 +816,8 @@ ESH'NYUI

mi'shi'pashshu @@ -826,8 +826,8 @@ ESH'NYUI

 @@ -868,16 +868,16 @@ ESH'NYUI polika'nya dre? @@ -886,8 +886,8 @@ ESH'NYUI

 @@ -902,8 +902,8 @@ ESH'NYUI @@ -926,8 +926,8 @@ ESH'NYUI ? @@ -954,8 +954,8 @@ LU'NYA

mishi'pash!! @@ -964,8 +964,8 @@ LU'NYA

!! @@ -998,8 +998,8 @@ LU'NYA polika'nya @@ -1014,16 +1014,16 @@ LU'NYA meluton ka'nya! @@ -1032,8 +1032,8 @@ LU'NYA

 @@ -1072,16 +1072,16 @@ LU'NYA  ! @@ -1106,8 +1106,8 @@ LU'NYA dra? @@ -1116,8 +1116,8 @@ LU'NYA

 @@ -1132,8 +1132,8 @@ LU'NYA ? @@ -1176,8 +1176,8 @@ ESH'NYUI esh'dre @@ -1200,8 +1200,8 @@ ESH'NYUI polika'nya @@ -1216,16 +1216,16 @@ ESH'NYUI puroton ka'nyashu @@ -1234,8 +1234,8 @@ ESH'NYUI

 @@ -1250,8 +1250,8 @@ ESH'NYUI  @@ -1290,16 +1290,16 @@ ESH'NYUI   @@ -1324,8 +1324,8 @@ ESH'NYUI shi'ro'bae'pu @@ -1340,16 +1340,16 @@ ESH'NYUI pon'ya ka'nyashu @@ -1358,8 +1358,8 @@ ESH'NYUI

 @@ -1374,8 +1374,8 @@ ESH'NYUI  @@ -1398,8 +1398,8 @@ ESH'NYUI  @@ -1426,8 +1426,8 @@ LU'NYA

puroton @@ -1458,8 +1458,8 @@ LU'NYA ka'nya! @@ -1468,8 +1468,8 @@ LU'NYA

 @@ -1500,8 +1500,8 @@ LU'NYA ! @@ -1528,8 +1528,8 @@ ESH'NYUI

be'nyui @@ -1552,16 +1552,16 @@ ESH'NYUI meluton mimifaka'nya… @@ -1570,16 +1570,16 @@ ESH'NYUI

  @@ -1594,16 +1594,16 @@ ESH'NYUI  … @@ -1628,16 +1628,16 @@ ESH'NYUI meluton mimiku'pashshu @@ -1646,8 +1646,8 @@ ESH'NYUI

 @@ -1662,16 +1662,16 @@ ESH'NYUI   @@ -1698,8 +1698,8 @@ LU'NYA

o'o, @@ -1722,8 +1722,8 @@ LU'NYA parefaka'nya… @@ -1732,16 +1732,16 @@ LU'NYA

,  @@ -1756,8 +1756,8 @@ LU'NYA … @@ -1766,8 +1766,8 @@ LU'NYA

be'nyui @@ -1790,8 +1790,8 @@ LU'NYA meluton @@ -1806,8 +1806,8 @@ LU'NYA dre? @@ -1816,16 +1816,16 @@ LU'NYA

  @@ -1840,24 +1840,24 @@ LU'NYA   ? @@ -1884,8 +1884,8 @@ ESH'NYUI

uu, @@ -1948,8 +1948,8 @@ ESH'NYUI ka'nya... @@ -1958,16 +1958,16 @@ ESH'NYUI

,  @@ -1982,8 +1982,8 @@ ESH'NYUI  @@ -1998,8 +1998,8 @@ ESH'NYUI  @@ -2022,8 +2022,8 @@ ESH'NYUI . @@ -2048,8 +2048,8 @@ ESH'NYUI guraton @@ -2064,16 +2064,16 @@ ESH'NYUI meluton mimifuku.. @@ -2082,8 +2082,8 @@ ESH'NYUI

 @@ -2098,8 +2098,8 @@ ESH'NYUI  @@ -2114,16 +2114,16 @@ ESH'NYUI  . @@ -2156,8 +2156,8 @@ ESH'NYUI mimiku'pashshu @@ -2166,8 +2166,8 @@ ESH'NYUI

 @@ -2190,8 +2190,8 @@ ESH'NYUI  @@ -2242,8 +2242,8 @@ LU'NYA mishi'pash! @@ -2252,16 +2252,16 @@ LU'NYA

  @@ -2276,8 +2276,8 @@ LU'NYA ! @@ -2334,24 +2334,24 @@ LU'NYA ka'nya peekaka'nya fa'dre? @@ -2360,8 +2360,8 @@ LU'NYA

 @@ -2384,8 +2384,8 @@ LU'NYA  @@ -2400,8 +2400,8 @@ LU'NYA  @@ -2416,16 +2416,16 @@ LU'NYA  ? @@ -2476,8 +2476,8 @@ ESH'NYUI mishi'pashshu @@ -2486,16 +2486,16 @@ ESH'NYUI

  @@ -2510,32 +2510,15 @@ ESH'NYUI 

-

- - (>///////////////<) - - -

-

- - (>///////////////<) - - +

+(>///////////////<)

ari'laen parefaka'nya, @@ -2588,16 +2571,16 @@ ESH'NYUI pareka'nya dra? @@ -2606,8 +2589,8 @@ ESH'NYUI

 @@ -2622,24 +2605,24 @@ ESH'NYUI  ,  @@ -2654,16 +2637,16 @@ ESH'NYUI  ? @@ -2714,8 +2697,8 @@ LU'NYA dedaka'nya. @@ -2724,8 +2707,8 @@ LU'NYA

 @@ -2740,8 +2723,8 @@ LU'NYA  @@ -2774,8 +2757,8 @@ LU'NYA shashka'nya'pash. @@ -2784,24 +2767,24 @@ LU'NYA

   @@ -2858,8 +2841,8 @@ LU'NYA ka'nya. @@ -2868,16 +2851,16 @@ LU'NYA

  @@ -2892,8 +2875,8 @@ LU'NYA  @@ -2908,8 +2891,8 @@ LU'NYA  @@ -2954,8 +2937,8 @@ LU'NYA luka'nya'pash. @@ -2964,8 +2947,8 @@ LU'NYA

 @@ -2980,16 +2963,16 @@ LU'NYA   @@ -3048,16 +3031,16 @@ ESH'NYUI fuka'nya'bash dra? @@ -3066,16 +3049,16 @@ ESH'NYUI

  @@ -3090,24 +3073,24 @@ ESH'NYUI   ? @@ -3174,8 +3157,8 @@ LU'NYA kan'ya. @@ -3184,8 +3167,8 @@ LU'NYA

 @@ -3200,8 +3183,8 @@ LU'NYA  @@ -3258,8 +3241,8 @@ LU'NYA dedaka'nya. @@ -3268,8 +3251,8 @@ LU'NYA

 @@ -3284,8 +3267,8 @@ LU'NYA  @@ -3702,7 +3685,7 @@ relfur me.lu.ton -noun +noun, modifier red @@ -3758,7 +3741,7 @@ moon, secret pu.ro.ton -modifier +noun, modifier yellow @@ -3926,7 +3909,7 @@ mimifuku gu.ra.ton -modifier +noun, modifier green @@ -4000,20 +3983,6 @@ modifier adorable - - - - - - - - - - -??? - - -??? @@ -4060,16 +4029,16 @@ horns -s + -sshku +shash.ku -??? +verb -??? +to split, to cut, to divide