Skip to content

Commit

Permalink
realse 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
NeelShah18 committed Jun 21, 2018
1 parent d82ce9c commit 9c42e3d
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 4 deletions.
99 changes: 99 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
`Downloads`_

Description of the emot library
===============================

Emot is a python library to extract the emojis and emoticons from a
text(string). All the emojis and emoticons are taken from a reliable
source i.e. Wikipedia.org.

Compatibility
-------------

It works fine in any Python 2.xx and 3.xx.

Working
-------

The Emot library takes a string as an input and returns a list of
dictonary.

Example
-------

::

>>> 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}

New version 2.0 of emot library return dictonary of and you can loop
every data based on below example. Here, value, location, mean are list
and flag is boolean.

::

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

Installation
------------

Via pip:

::

$ pip install emot --upgrade

From master branch:

::

$ git clone https://github.com/NeelShah18/emot.git
$ cd emot
$ python setup.py install

Developing
----------

::

$ git clone https://github.com/NeelShah18/emot.git
$ cd emot

Links
-----

`Emoji Cheat Sheet`_

`Official unicode list`_

`official emoticons list`_

Authors
-------

Neel Shah / [@NeelShah18]

Shubham Rohilla / [@kakashubham]

[@NeelShah18]: https://github.com/NeelShah18 [@kakashubham]:
https://github.com/kakashubham

.. _Downloads: http://pepy.tech/project/emot
.. _Emoji Cheat Sheet: http://www.emoji-cheat-sheet.com/
.. _Official unicode list: http://www.unicode.org/Public/emoji/1.0/full-emoji-list.html
.. _official emoticons list: https://en.wikipedia.org/wiki/List_of_emoticons
14 changes: 12 additions & 2 deletions emot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,21 @@ def emoji(string):
__mean.append(emo_unicode.UNICODE_EMO[ej])
__location.append([pos,pos])
except Exception as e:
flag = False
__entities.append({"flag": False})
return __entities

except Exception as e:
flag = False
__entities.append({"flag": False})
return __entities
if len(__value) < 1:
flag = False
__entities = {
'value' : __value,
'mean' : __mean,
'location' : __location,
'flag' : True
'flag' : flag
}

return __entities
Expand All @@ -58,6 +62,7 @@ def emoticons(string):
>>> {'value': [':-)'], 'location': [[16, 19]], 'mean': ['Happy face smiley'], 'flag': True}
'''
__entities = []
flag = True
try:
pattern = u'(' + u'|'.join(k for k in emo_unicode.EMOTICONS) + u')'
__entities = []
Expand All @@ -72,11 +77,13 @@ def emoticons(string):
for each in __value:
__mean.append(emo_unicode.EMOTICONS_EMO[each])

if len(__value) < 1:
flag = False
__entities = {
'value' : __value,
'location' : __location,
'mean' : __mean,
'flag' : True
'flag' : flag
}
except Exception as e:
__entities = [{'flag' : False}]
Expand All @@ -95,3 +102,6 @@ def about():
text = "emot library: emoji and emoticons library for python. It return emoji or emoticons from string with location of it. \nAuthors: \n Neel Shah: [email protected] or https://github.com/NeelShah18 \n Subham Rohilla: [email protected] or https://github.com/kakashubham"
print(text)
return None

if __name__ == '__main__':
test_emo()
Empty file added output.html
Empty file.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='emot',
version="2.0",
version="2.1",
author='Neel Shah, Subham',
author_email='[email protected], [email protected]',
description="Emoji and Emoticons detection package for Python",
Expand All @@ -17,5 +17,5 @@
packages=['emot'],
url="https://github.com/NeelShah18/emo",
zip_safe=True,
download_url="https://github.com/NeelShah18/emot/archive/v1.0.tar.gz",
download_url="https://github.com/NeelShah18/emot/archive/v2.0.zip",
)

0 comments on commit 9c42e3d

Please sign in to comment.