Emoji-x or Emojix is built on top of the existing Emoji module for Python. It aims to extend it with new functions and a more robust EMOJI_DATA dictionary.
The following functions and variables are available through the emojix module.
Legacy Emoji Functions & Variables | |
---|---|
emojize() |
Replace emoji shortcodes with the corresponding emojis |
demojize() |
Replace emojis with the corresponding emoji shortcodes |
replace_emoji() |
Like str.replace() but only replaces emojis |
emoji_list() |
Returns a list of all emojis in a string |
distinct_emoji_list() |
Returns a list of unique emojis in a string |
emoji_count() |
Returns the number of emojis in a string |
is_emoji() |
Returns true if the given char is an emoji and false otherwise |
version() |
Returns the version of the given emoji |
Emoji-extended Functions & Variables | |
---|---|
category_exists() |
Returns true if the given category exists and False otherwise |
category() |
Returns the category of the given emoji |
get_all_categories() |
Returns a dict of all emoji categories and IDs |
top_level_categories() |
Returns a list of dicts containg all top level categories |
sub_level_categories() |
Returns a list of dicts containg all sub level categories |
is_top_level_category() |
Returns True if the category is top-level and false otherwise |
parent_category() |
Returns the parent category of the given emoji |
child_categories() |
Returns a list of dicts containg child categries of the given category |
iterate_category() |
Iterates over the emojis in a given category |
emoji_factory() |
A generator function which iterates over all emojis in EMOJI_DATA and yields each one |
get_emojis_in_category() |
Returns a list of dicts of all emojis in a given category |
is_emoji_variation() |
Returns True if the given emoji is a variation (contains a zwj) |
get_all_emoji_variants() |
Returns a list of dicts containg all emoji variants |
emoji_to_unicode() |
Returns the Unicode notation of a given emoji |
emoji_name() |
Returns the name or shortcode of a given emoji |
get_emoji_by_name() |
Returns an the emoji that corresponds to the given name |
has_zwj() |
Returns True if the given emoji contains a zero-width-joiner character |
EMOJI_DATA |
Dict of just under 5,000 emojis and their corresponding data |
STATUS |
Dict containing the Unicode status values for emojis |
CATEGORIES |
Dict containing all emoji categories and an assigned category ID |
BASIC_EMOJIS |
Dict containing all basic emojis organized by category |
KEYCHAIN |
Holds EMOJI_DATA.keys() |
CATS_KEYCHAIN |
Holds CATEGORIES.keys() |
compile_emoji_data() |
Recompiles data_dict.py which holds EMOJI_DATA |
key_chain() |
Returns EMOJI_DATA.keys(). Use core.KEYCHAIN instead |
categories_key_chain() |
Returns CATEGORIES.keys(). Use core.CATS_KEYCHAIN instead |
emoji_data() |
Returns the EMOJI_DATA dictionary |
get_emoji_data_for_lang() |
Returns and caches emoji data for a specific language |
get_emoji_aliases_data() |
Returns and caches emoji alias data |
Use the following guide to build the documentation with Sphinx.
git clone https://github.com/happycod3r/emojix.git
cd emoji/docs
python -m pip install -r requirements.txt
make html
Check for warnings:
make clean
sphinx-build -n -T -b html . _build
Test code in code blocks:
make doctest
Test coverage of documentation:
make coverage