Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tejado/BaseEmoji
Encode any data to emojis πΎβ’
https://github.com/tejado/BaseEmoji
Last synced: 12 days ago
JSON representation
Encode any data to emojis πΎβ’
- Host: GitHub
- URL: https://github.com/tejado/BaseEmoji
- Owner: tejado
- License: mit
- Created: 2019-12-29T17:44:24.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-05T15:29:18.000Z (almost 5 years ago)
- Last Synced: 2024-09-16T04:43:55.147Z (about 2 months ago)
- Language: Python
- Size: 33.2 KB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BaseEmoji
BaseEmoji is a python module for encoding any ASCII string or byte object into emoticons and back. It can be used to hide information in text conversations, e.g. chat or twitter or to display hashes in a graphica/more comparable way.
It supports two codecs: anybase and group256. This module is also the reference implementation of these two codecs.Made with β€οΈ at 36c3!
## Install
```bash
pip install emojibase
```
View on PyPi via [https://pypi.org/project/emojibase/](https://pypi.org/project/emojibase/)## Usage
### anybase
anybase is a BaseEmoji codec which works by converting the input to the base of the amount of emojis, set by the filter.```python
import BaseEmojie = BaseEmoji.anybase()
e.encode('giv mee emojiiis'.encode())
# β΄οΈπ₯πβοΈπΊπββοΈπ π΅πͺπ₯π₯πe.decode('β΄οΈπ₯πβοΈπΊπββοΈπ π΅πͺπ₯π₯π').decode('ascii')
# giv mee emojiiis```
### group256
This codec distributes all (filtered) emojis to 256 groups. With this, it can encode any ASCII string to emojis.```python
import BaseEmojie = BaseEmoji.group256()
e.encode('giv mee emojiiis')
# πΈπ»ππ€¨πΏπ€π₯π’π’π§ ππΌπ₯π€πΈπe.decode('πΈπ»ππ€¨πΏπ€π₯π’π’π§ ππΌπ₯π€πΈπ')
# giv mee emojiiis```
### Filters
There are currently three filter options for changing the emojis for en/decoding:
- Groups (e.g. flags)
- Skin Tone Support
- Unicode Version```python
e.set_filter(['Symbols'], False, 12.0)
e.encode('giv mee symbol emojiiis'.encode())
# πββ³οΈβ¬ οΈβοΈβοΈβοΈβ¬ οΈβ°βΌοΈβοΈβοΈββοΈβ¬ οΈβοΈβοΈββ ββββ°e.get_groups()
# {'Smileys & Emotion', 'Travel & Places', 'Activities', 'Flags', 'Animals & Nature', 'Symbols', 'People & Body', 'Objects', 'Food & Drink'}
```## Roadmap
- Add filter options to encoded data for automatic decoding## Credits
- Inspired by [CuteUID](https://github.com/alexdredmon/cuteuid)
- Emoji data from [muan](https://github.com/muan/unicode-emoji-json)
- [Jonas](https://github.com/jonas-koeritz)