NeelShah18 / emot

Open source Emoticons and Emoji detection library: emot

Home Page:https://pypi.org/project/emot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I replace the emoji by their meaning?

tashiq opened this issue · comments

Well! I want to replace emojis with their meaning. Can I solve this problem by emot?.
or I have to look for other packages. If so, will you please elaborate on this?

Hello @tashiq Yes, you can do that thing using emot.

For emoji please see as below:

import emot
text = "I love python 👨 :-)"
emot.emoji(text)
[{'value': '👨', 'mean': ':man:', 'location': [14, 14], 'flag': True}]
emot.emoticons(text)
{'value': [':-)'], 'location': [[16, 19]], 'mean': ['Happy face smiley'], 'flag': True}

Library will return the dictionary with value, what you can do is two thing:

  1. Pass only one word and replace meaning if flag is True.
  2. Else you can pass whole text and change the text at specific location through meaning and location information.

Normally 1st option is much more easy to do.

@tashiq Please let me know if you face any issue.

No, there is no issue. I solved this using your code segment. Thanks <3

Information provided :-)