30 lines
896 B
Markdown
30 lines
896 B
Markdown
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):
|
|
```sh
|
|
git submodule add https://git.anduin.net/ltning/emoji_to_smiley.git smiley
|
|
```
|
|
then, in your code
|
|
```python
|
|
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).
|