plorcly borglar is a "mod" created by jan Misali for the constructed language toki pona that makes words sound funny.
It involves substituting the 14 toki pona letters for funnier versions plus 2 extra rules. The substitutions are:
toki pona letter | plorcly borglar letter |
---|---|
m | bl |
n | gl |
p | b |
t | pl |
k | cl |
s | scr |
w | spw |
l | scl |
j | shl |
i | ee |
u | oo |
e | o |
o | or |
a | ar |
The two extra rules are:
- When an "n" in a toki pona is followed by a consonant or ends a word it is replaced with "ng" instead of "gl", so nasin becomes glarscreeng not *glarscreegl
- When an i is the final letter of a word containing another vowel it becomes "y" instead of "ee", so poki becomes borcly not *borclee, but ni becomes glee not gly.
(The vowels here are "a", "e", "i", "o" and "u", "y" does not exist in toki pona at all)
And that's it.
The challenge here is to take a sequence of space separated words that are valid in toki pona's phonotactics and convert it to plorcly borglar. If you know what that means you can get going, this is code-golf so the goal is to minimize the size of your source code as measured in bytes. Otherwise I will explain it.
Toki pona has 14 letters / phonemes, 9 consonants "m", "n", "p", "t", "k", "s", "w", "l", and "j" and 5 vowels "a", "e", "i", "o", "u". All words are built out of these characters (No upper case), but not every sequence of these characters is a valid word.
That's probably all you need to complete this challenge. But there are more rules that might be helpful for optimizing.
Words in toki pona consist of syllables. A syllable in toki pona is consists of a consonant, then a vowel, then an optional "n". The first syllable in a word can skip the initial consonant. For example "olin" is a valid syllable consisting of "o" + "lin". Additionally "nn" and "nm" are not legal sequences so you can't end a syllable in "n" if the next one starts with "n" or "m".
Finally the following syllables are illegal:
- ti(n)
- ji(n)
- wu(n)
- wo(n)
So they will not appear in input words.
Test cases
toki pona -> plorcly borglar
nasin -> glarscreeng
poki -> borcly
ni -> glee
mi olin e sina -> blee orscleeng o screeglar
soweli lawa li ike tawa mi -> scrorspwoscly sclarspwar sclee eeclo plarspwar blee
lon sike lon ma la jan lili li tomo -> sclorng screeclo sclorng blar sclar shlarng scleescly sclee plorblor
sinpin -> screengbeeng
tenpo -> plongbor
linja -> scleengshlar