-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d82ce9c
commit 9c42e3d
Showing
4 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 = [] | ||
|
@@ -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}] | ||
|
@@ -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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|
@@ -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", | ||
) |