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

If input includes "oo", output is corrupted

maxpel opened this issue · comments

I noticed some unwanted behaviour:
emot.emoticons("oo") returns [{'flag': False}]

Thank you very much for your nice package, it is really useful!

max

Python throws an exception:
KeyError('oo')

Hey, @maxpel Thanks for the bug. Sorry fo my really late reply It doesn't show me on my bug board.I will add it and check it out.

Thanks for using package

As i understand you are looking for surprised emoticons --> oO
I didn't have oo in my emoticons database can you please send me meaning of oo i will add it to my database

@NeelShah18 The problem is with the ignore case flag you pass here
matches = re.finditer(r"%s"%pattern,str(string),re.IGNORECASE)
https://github.com/NeelShah18/emot/blob/master/emot/core.py#L71
So the oo get matched with 'oO' and when you come to look it up using the dict here
__mean.append(emo_unicode.EMOTICONS_EMO[each])
https://github.com/NeelShah18/emot/blob/master/emot/core.py#L78
It can't find it.

Also, another problem in your exception handling is that you are returning another format list(dict) not just a dict
__entities = [{'flag' : False}]
https://github.com/NeelShah18/emot/blob/master/emot/core.py#L89

Also a general note on the catch-all philosophy you are using. To the best of my knowledge, this is very bad. You can read more about this here https://realpython.com/the-most-diabolical-python-antipattern/

Yeah True. It is bug. I am solving it and release bug free version till weekend end.
Thanks for the bugs reporting.

Thank you both very much for taking a look a this!

Has this been fixed?

I am having this issue with text like "Good Morning" since it has oo.

@avanish I just solve it. Wait till today evening till push.

@avanish @maxpel @islamelhosary bug is solved. Please clone the repository and again install it manually through setup command. Thank for bug reporting and @islamelhosary to draw the attention of the problem. Happy coding :-)