Convert emojis to old-fashioned smileys
Find a file
2025-08-24 00:03:31 +02:00
.gitignore Add gitignore 2025-08-24 00:03:31 +02:00
__init__.py Made it sort of a module, for easier inclusion in other scripts 2025-08-23 23:56:11 +02:00
README.md Made it sort of a module, for easier inclusion in other scripts 2025-08-23 23:56:11 +02:00
smiley.py Made it sort of a module, for easier inclusion in other scripts 2025-08-23 23:56:11 +02:00

Tiny botched-together python script to replace (some) emoji with classic smileys. I have never written python before, so forgive any transgressions.

Takes text with unicode emojis on standard input, spits out emojis replaced by either classic smileys (:-)) or textual variants (:joy:) on standard output.

Alternatively, import it in your script and call replace_emoji(<string>).

For example, start by adding this repo to your project (you're using git, I presume):

git submodule add https://git.anduin.net/ltning/emoji_to_smiley.git smiley

then, in your code

from smiley import smiley
for line in sys.stdin:
    print(smiley.replace_emoji(line))

Needs

pip3.12 install emoji-data-python

or whatever your platform wants.

There are probably a million better ways to do this.

(I'll be using this, at some point, in front of my Pleroma-Gopher interface).