diff --git a/converter.lua b/converter.lua index ad762c1..0fd9f71 100644 --- a/converter.lua +++ b/converter.lua @@ -17,9 +17,9 @@ function process_content(content) end - local ac = content + local ac = check_symbol(content) while string.find(ac, " ") do - local new_word = string.sub(ac, 0, string.find(ac, " ")) + local new_word = string.sub(ac, 0, string.find(ac, " ")-1) local indicators = {} if i == 1 then @@ -29,8 +29,8 @@ function process_content(content) end new_word = strip_symbols(new_word) - new_word = replace_symbols(new_word) new_word, indicators = revert_verbs(new_word, indicators) + new_word, indicators = revert_nouns(new_word,indicators) add_word(new_word) local html_stuff = [[ @@ -146,28 +146,62 @@ function strip_symbols(str) return str end -function replace_symbols(str) +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) if string.find(str, find) then - str = string.gsub(str, find, repl) + str = string.gsub(str,find, repl) table.insert(tbl,indicator) end return str, tbl end + +function in_dictionary(str) + for i=1, #words do + if words[i][1] == str then return true end + end +end + +function check_morphemes(str, tbl,match,repl,indicator) + 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) + end + end + return str, tbl +end + +function revert_nouns(str, tbl) + 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","","formal") + str, tbl = check_morphemes(str,tbl,"lafura","","formal") + 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") + 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") return str, tbl end diff --git a/test.html b/test.html index 750a320..f081a4c 100644 --- a/test.html +++ b/test.html @@ -55,116 +55,116 @@ LU'NYA

- nyan'pash! + nyan'pash! - balfur + balfur - yu + yu - e + e - she + she - polika'nya + polika'nya - dre? + dre?

- ! + ! -  +  -  +  -  +  -  +  -  +  - ? + ?

@@ -189,104 +189,104 @@ ESH'NYUI

- re + re - chu + chu - meshu + meshu - yu + yu - polika'nya + polika'nya

-  +  -  +  -  +  -  +  -  + 

- (po'nyash!!!) + (po'nyash!!!)

- (!!!) + (!!!)

@@ -311,56 +311,56 @@ LU'NYA

- aa, + aa, - anko! + anko!

- , + , - ! + !

- (po'nyash!) + (po'nyash!)

- (!) + (!)

@@ -385,184 +385,184 @@ ESH'NYUI

- ba + ba - yu + yu - e + e - wawote + wawote - to + to - pu + pu - mipura + mipura - lili'nya + lili'nya - dre? + dre? - +

-  +  -  +  -  +  -  +  -  +  -  +  -  +  -  +  - ? + ? - +

- uwu + uwu

-  + 

@@ -587,244 +587,244 @@ LU'NYA

- relfur + relfur - chu + chu - mya + mya - pu + pu - yu + yu - mya + mya - relfur + relfur - lup + lup - apatka'nya + apatka'nya - faka'nya'pash + faka'nya'pash - ponme + ponme - mya + mya - wawote + wawote - polika'nya + polika'nya - peekaka'nya'pash. + peekaka'nya'pash.

-  +  -  +  -  +  -  +  -  +  -  +  -  +  -  +  -  +  -  +  -  +  -  +  -  +  -  +  -  + 

@@ -849,120 +849,120 @@ ESH'NYUI

- mi'shi'pash~ + mi'shi'pash~

- ~ + ~

- balfur + balfur - yu + yu - e + e - ton + ton - polika'nya + polika'nya - dre? + dre?

-  +  -  +  -  +  -  +  -  +  - ? + ?

@@ -987,220 +987,220 @@ LU'NYA

- mishi'pash!! + mishi'pash!! - +

- !! + !! - +

- relfurla + relfurla - mya + mya - ton + ton - polika'nya + polika'nya - yu + yu - meluton + meluton - ka'nya! + ka'nya! - +

-  +  -  +  -  +  -  +  -  +  -  +  - ! + ! - +

- balfurla + balfurla - yu + yu - dra? + dra?

-  +  -  +  - ? + ?

@@ -1225,248 +1225,248 @@ ESH'NYUI

- relfurla + relfurla - yu + yu - esh'dre + esh'dre - mya + mya - ton + ton - polika'nya + polika'nya - yu + yu - puroton + puroton - ka'nya~ + ka'nya~

-  +  -  +  -  +  -  +  -  +  -  +  -  +  -  +  - ~ + ~

- relfur + relfur - yu + yu - shi'ro'bae'pu + shi'ro'bae'pu - yu + yu - pon'ya + pon'ya - ka'nya~ + ka'nya~

-  +  -  +  -  +  -  +  -  +  - ~ + ~

@@ -1491,84 +1491,84 @@ LU'NYA

- puroton + puroton - yu + yu - ponya + ponya - ton + ton - ka'nya! + ka'nya!

-  +  -  +  -  +  -  +  - ! + !

@@ -1593,136 +1593,152 @@ ESH'NYUI

- be'nyui-rerenlafura + be'nyui - yu + rerenlafura - meluton + yu - mimifaka'nya… + meluton + + + + mimifaka'nya…

-  +  -  +  -  +  - … +  + + + + …

- relfur + relfur - yu + yu - meluton + meluton - mimiku'pash~ + mimiku'pash~

-  +  -  +  -  +  - ~ + ~

@@ -1747,152 +1763,168 @@ LU'NYA

- o'o, + o'o, - relfur + relfur - chu + chu - parefaka'nya… + parefaka'nya…

- , + , -  +  -  +  - … + …

- be'nyui-babanlafura + be'nyui - yu + babanlafura - meluton + yu - naomiminku + meluton - dre? + naomiminku + + + + dre?

-  +  -  +  -  +  -  +  - ? +  + + + + ?

@@ -1917,332 +1949,332 @@ ESH'NYUI

- uu, + uu, - relfur + relfur - yu + yu - naomiminku + naomiminku - mya + mya - mimifuku + mimifuku - mya + mya - ton + ton - ka'nya... + ka'nya...

- , + , -  +  -  +  -  +  -  +  -  +  -  +  -  +  - . + .

- relfur + relfur - yu + yu - guraton + guraton - to + to - meluton + meluton - mimifuku.. + mimifuku.. - +

-  +  -  +  -  +  -  +  -  +  - . + . - +

- relfur + relfur - yu + yu - ton + ton - mimiku'pash~ + mimiku'pash~

-  +  -  +  -  +  - ~ + ~

@@ -2267,216 +2299,232 @@ LU'NYA

- ishi-balfur + ishi - yu + balfur - mishi'pash! + yu - + mishi'pash! + + + +

-  +  -  +  - ! +  - + ! + + + +

- balfur + balfur - chu + chu - mya + mya - arilaen + arilaen - yu + yu - en + en - ka'nya + ka'nya - peekaka'nya + peekaka'nya - fa'dre? + fa'dre?

-  +  -  +  -  +  -  +  -  +  -  +  -  +  -  +  - ? + ?

@@ -2501,204 +2549,220 @@ ESH'NYUI

- yesh-balfur + yesh - yu + balfur - mishi'pash~ + yu + + + + mishi'pash~

-  +  -  +  - ~ +  + + + + ~

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

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

- relfur + relfur - yu + yu - ari'laen + ari'laen - parefaka'nya, + parefaka'nya, - balfur + balfur - yu + yu - pareka'nya + pareka'nya - dra? + dra?

-  +  -  +  -  +  - , + , -  +  -  +  -  +  - ? + ?

@@ -2723,284 +2787,284 @@ LU'NYA

- relfur + relfur - chu + chu - arilaen + arilaen - dedaka'nya. + dedaka'nya. - +

-  +  -  +  -  +  -  +  - +

- imanla + imanla - rila + rila - shashka'nya'pash. + shashka'nya'pash. - +

-  +  -  +  -  +  - +

- imanla + imanla - shoo + shoo - chu + chu - ike + ike - to + to - pikeshe + pikeshe - ka'nya. + ka'nya. - +

-  +  -  +  -  +  -  +  -  +  -  +  -  +  - +

@@ -3011,68 +3075,68 @@ LU'NYA

- relfur + relfur - chu + chu - arilaenlan + arilaenlan - luka'nya'pash. + luka'nya'pash.

-  +  -  +  -  +  -  + 

@@ -3097,100 +3161,100 @@ ESH'NYUI

- arilaenla + arilaenla - shoo + shoo - chu + chu - pikeshe + pikeshe - fuka'nya'bash + fuka'nya'bash - dra? + dra?

-  +  -  +  -  +  -  +  -  +  - ? + ?

@@ -3215,184 +3279,184 @@ LU'NYA

- gao + gao - chu + chu - relfur + relfur - yu + yu - fayu + fayu - kan'ya. + kan'ya. - +

-  +  -  +  -  +  -  +  -  +  -  +  - +

- relfur + relfur - chu + chu - arilaen + arilaen - dedaka'nya. + dedaka'nya.

-  +  -  +  -  +  -  + 

@@ -3415,7 +3479,7 @@ LU'NYA - + nyan.pash @@ -3429,175 +3493,7 @@ hello!, good morning! - - - -balfur - - -??? - - -??? - - - - - - - -yu - - -marker - - -denotes topic, emphasis - - - - - - - -e - - -pronoun - - -which - - - - - - - -she - - -noun - - -food - - - - - - - -poliku - - -??? - - -??? - - - - - - - -dre - - -??? - - -??? - - - - - - - -re - - -pronoun - - -i - - - - - - - -chu - - -marker - - -denotes the subject - - - - - - - -meshu - - -??? - - -??? - - - - - - - -ponyash - - -??? - - -??? - - - - - - - -aa - - -expression, modifier - - -correct, very - - - - - - - -an.ko - - -expression - - -thank you - - - - - + ba @@ -3611,7 +3507,161 @@ you - + + + +yu + + +marker + + +denotes topic, emphasis + + + + + + + +e + + +pronoun + + +which + + + + + + + +she + + +noun + + +food + + + + + + + +poliku + + +??? + + +??? + + + + + + + +dre + + +??? + + +??? + + + + + + + +re + + +pronoun + + +i + + + + + + + +chu + + +marker + + +denotes the subject + + + + + + + +meshu + + +??? + + +??? + + + + + + + +ponyash + + +??? + + +??? + + + + + + + +aa + + +expression, modifier + + +correct, very + + + + + + + +an.ko + + +expression + + +thank you + + + + + wa.wo.te @@ -3625,7 +3675,7 @@ rain - + to @@ -3639,7 +3689,7 @@ and, along (in physical presence) - + pu @@ -3653,10 +3703,10 @@ sun - + -mipura +mipura ??? @@ -3667,10 +3717,10 @@ mipura - + -lilinya +lilinya ??? @@ -3681,10 +3731,10 @@ lilinya - + - + ??? @@ -3695,10 +3745,10 @@ lilinya - + -uwu +uwu ??? @@ -3709,21 +3759,7 @@ uwu - - - -relfur - - -??? - - -??? - - - - - + mya @@ -3737,7 +3773,7 @@ preceeds subordinate clause - + lup @@ -3751,7 +3787,7 @@ slow - + a.pat.ku @@ -3765,7 +3801,7 @@ to lie (on a surface) - + ku @@ -3779,7 +3815,7 @@ to be - + pon.me @@ -3793,7 +3829,7 @@ because - + pee.ka.ku @@ -3807,10 +3843,10 @@ to think, to become aware - + -mishipash +mishipash ??? @@ -3821,10 +3857,10 @@ mishipash - + -ton +ton ??? @@ -3835,21 +3871,7 @@ ton - - - -relfurla - - -??? - - -??? - - - - - + me.lu.ton @@ -3863,21 +3885,7 @@ red - - - -balfurla - - -??? - - -??? - - - - - + dra @@ -3891,7 +3899,7 @@ indicates question - + esh.dre @@ -3905,7 +3913,7 @@ moon, secret - + pu.ro.ton @@ -3919,7 +3927,7 @@ yellow - + shi.ro.bae.pu @@ -3933,7 +3941,7 @@ night sky - + po.nya @@ -3947,10 +3955,24 @@ good -  + -benyui rerenlafura +be.nyui + + +noun + + +bunny + + + + + + + +reren ??? @@ -3961,7 +3983,7 @@ benyui rerenlafura - + mi.mi.ku @@ -3975,10 +3997,10 @@ to see - + -oo +oo ??? @@ -3989,7 +4011,7 @@ oo - + pa.re.ku @@ -4003,10 +4025,10 @@ to know, to learn -  + -benyui babanlafura +baban ??? @@ -4017,7 +4039,7 @@ benyui babanlafura - + nao.mi.min.ku @@ -4031,7 +4053,7 @@ to dream - + u.u @@ -4045,10 +4067,10 @@ no - + -mimifuku +mimifuku ??? @@ -4059,7 +4081,7 @@ mimifuku - + gu.ra.ton @@ -4073,35 +4095,35 @@ green -  + -ishi balfur +i.shi -??? +noun -??? +beauty - + -arilaen +a.ri.lae -??? +noun -??? +demon - + en @@ -4115,10 +4137,10 @@ being - + -fadre +fadre ??? @@ -4129,21 +4151,21 @@ fadre -  + -yesh balfur +yesh -??? +modifier -??? +adorable - + de.da.ku @@ -4157,35 +4179,35 @@ to hate - + -imanla +i.ma -??? +pronoun -??? +he, she, they, it - + -ri.la +ri -noun +modifier -horns +sharp - + shash.ku @@ -4199,7 +4221,7 @@ to split, to cut, to divide - + shoo @@ -4213,7 +4235,7 @@ essence, core, heart - + i.ke @@ -4227,7 +4249,7 @@ bad - + pi.ke.she @@ -4241,21 +4263,7 @@ rotten - - - -arilaenlan - - -??? - - -??? - - - - - + lu.ku @@ -4269,10 +4277,10 @@ to die - + -arilaenla +fuku ??? @@ -4283,21 +4291,7 @@ arilaenla - - - -fuku - - -??? - - -??? - - - - - + ga.o @@ -4311,10 +4305,10 @@ that - + -fayu +fayu ???