Emojin

An infinite kaomoji generator

14 January 2017

I made an infinite Kaomoji generator called Emojin.Technically it isn't infinite, but there are a lot of permutations!

Under the hood, Emojin is defined as a Context-Free Grammar made out of unicode characters for heads, faces, eyes, and so on:

{
    "kaomoji" : ["head" , "bracketed_head", "symmetrically_armed_head" , "face"],
    "head" : ["( face )", "[ face ]", "༼ face  ༽"],
    "bracketed_head": ["left_arm head right_arm"],
    "symmetrically_armed_head" : ["d( face )b", "(╯ face )╯", "(っ face ς)", "ᕕ( face )ᕗ","(つ face )つ", "ᕦ( face )ᕤ", "(づ face )づ"],
    "face" : ["^ mouth ^", "• mouth •", "o mouth o", "O mouth O", "> mouth <", "x mouth x", "' mouth '", "; mouth ;", " ̿ mouth  ̿", "- mouth -", "* mouth *", "´ mouth ´", "~ mouth ~", "• mouth <", "> mouth •", "ಠ mouth ಠ", "¬ mouth ¬", " ̄ mouth  ̄", "ಥ mouth ಥ", "ʘ mouth ʘ", "◎  mouth ◎", "•́ mouth •̀", "T mouth T", "⌒ mouth ⌒", " ˃̶ mouth ˂̶", "ര mouth ര", "⇀ mouth ⇀", "╥ mouth ╥", "´ mouth ´", "˘ mouth ˘", "❛ mouth ❛", "৺ mouth ৺", "୨ mouth ୧", "눈 mouth 눈", "° mouth °", "⌐■ mouth ■", "≖ mouth ≖", "•̀ mouth •́", "◕ mouth ◕", "⊙ mouth ☉", "ᗒ mouth ᗕ", " ͒  mouth ͒  ", "´・ mouth ・`"],
    "mouth" : ["_", ".", "__", "д", "ω", "-", ",", "////", "皿", "益", "人", "﹏", "ㅿ", "□", "ʖ", "ᴗ", "ㅂ", "▂", "ᴥ", "〜", "∀", "ロ", "▿▿▿▿", "ヮ", "ڡ", "︿", "‸", "ϖ", "˫", "֊", "෴", "³", "ᗣ"],
    "left_arm" : ["\\", "c", "┗", "ヽ", "〜", "┌", "ヾ", "\"],
    "right_arm" : ["/", "7", "~", "┛", "ノ", "〜", "┘", "⊃", "ง", "ゞ", "ノ*:・゚✧", "乂 head ノ", "❤ head", "و"]
}

The script starts with the single token "kaomoji", and replaces tokens with values sampled from the object above until there are no more tokens left to replace.

Although the page is set up to generate kaomoji, the CFG parser is entirely general. That means that (with a modification to the above grammar specification), it could generate any context-free language, even something as complex as MathGen!