fabriquedoc-backend/extract_emojis.py

14 lines
312 B
Python
Raw Normal View History

2023-05-17 19:53:44 +00:00
import emoji
def replace_emojis(input_text):
'''
Replaces emojis in text with a custom LaTeX sequence.
:param input_text:
:return:
'''
for char in input_text:
if emoji.is_emoji(char):
input_text = input_text.replace(char, f"\\emoji{{{char}}}")
return input_text