# emojiswahili
**Emojiswahili** is a Python library for working with emojis in Swahili.
---
## Features
- **Supports Swahili translations** for Unicode emojis.
- **Converts text with Swahili emoji codes** (e.g., `:nishani_ya_dhababu:`) **to Unicode emojis** (e.g., `🥇`).
- **Converts Unicode emojis** back **to Swahili emoji codes**.
- **Lists all emojis in a string** (with their positions), e.g., `emoji_list()`.
- **Extracts distinct emojis** in a string, e.g., `distinct_emoji_list()`.
- **Counts emojis** in a string (optionally only unique ones), e.g., `emoji_count()`.
- **Checks if a string is purely emoji**, e.g., `purely_emoji()`.
---
## Example Usage
Emojis defined by the [`Unicode consortium`](https://unicode.org/emoji/charts/full-emoji-list.html)
can be easily used with Swahili translations.
```python
>>> import emojiswahili
# Emojize a string
>>> print(emojiswahili.emojize('Mshindi wakwanza anapata :nishani_ya_dhababu:'))
Mshindi wakwanza anapata 🥇
# Demojize a string
>>> print(emojiswahili.demojize('Mshindi wakwanza anapata 🥇'))
Mshindi wakwanza anapata :nishani_ya_dhababu:
# List all emojis (with positions) in a string
>>> text = "Hii ni 🥇 na 🥈"
>>> emoji_positions = emojiswahili.emoji_list(text)
>>> print(emoji_positions)
[{'match_start': 7, 'match_end': 8, 'emoji': '🥇'},
{'match_start': 12, 'match_end': 13, 'emoji': '🥈'}]
# Get a list of distinct emojis
>>> print(emojiswahili.distinct_emoji_list(text))
['🥇', '🥈']
# Count emojis in a string
>>> print(emojiswahili.emoji_count(text))
2
>>> print(emojiswahili.emoji_count(text, unique=True))
2
# Check if a string is purely emoji
>>> print(emojiswahili.purely_emoji('🥇🥈'))
True
>>> print(emojiswahili.purely_emoji('Hii ni 🥇 na 🥈'))
False
```
---
## Installation
Install via pip:
```console
$ python -m pip install emojiswahili --upgrade
```
---
## Development Guide
### Code Style Check
Ensure the code adheres to style guidelines using `ruff`:
```console
$ python -m pip install ruff
$ ruff check emojiswahili
```
### Type Checking
Test the type hints using `pyright` or `mypy`:
```console
$ python -m pip install pyright mypy typeguard
$ pyright emojiswahili
$ pyright tests
$ mypy emojiswahili
$ pytest --typeguard-packages=emojiswahili
```
---
## Emoji Lists
### Swahili Emoji List
You can find the complete Swahili emoji list at:
- [`Unicode Emoji List in Swahili`](https://emojiterra.com/keyboard/sw)
---
## Authors and Maintainers
This project is developed and maintained by the eGARIDC Team / [`@ega`](https://ega.go.tz/)
Raw data
{
"_id": null,
"home_page": null,
"name": "emojiswahili",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "emoji, swahili, emojiswahili, python, unicode",
"author": null,
"author_email": "eGARIDC <info@ega.go.tz>",
"download_url": "https://files.pythonhosted.org/packages/3c/49/71dc36103626bf63d160df5a99312336bfb168e4773f145b4e782ab5ba7f/emojiswahili-1.0.2.tar.gz",
"platform": null,
"description": "# emojiswahili\n\n**Emojiswahili** is a Python library for working with emojis in Swahili.\n---\n\n## Features\n\n- **Supports Swahili translations** for Unicode emojis.\n- **Converts text with Swahili emoji codes** (e.g., `:nishani_ya_dhababu:`) **to Unicode emojis** (e.g., `\ud83e\udd47`).\n- **Converts Unicode emojis** back **to Swahili emoji codes**.\n- **Lists all emojis in a string** (with their positions), e.g., `emoji_list()`.\n- **Extracts distinct emojis** in a string, e.g., `distinct_emoji_list()`.\n- **Counts emojis** in a string (optionally only unique ones), e.g., `emoji_count()`.\n- **Checks if a string is purely emoji**, e.g., `purely_emoji()`.\n\n---\n\n\n## Example Usage\n\nEmojis defined by the [`Unicode consortium`](https://unicode.org/emoji/charts/full-emoji-list.html) \ncan be easily used with Swahili translations.\n\n```python \n>>> import emojiswahili\n\n# Emojize a string\n>>> print(emojiswahili.emojize('Mshindi wakwanza anapata :nishani_ya_dhababu:'))\nMshindi wakwanza anapata \ud83e\udd47\n\n# Demojize a string\n>>> print(emojiswahili.demojize('Mshindi wakwanza anapata \ud83e\udd47'))\nMshindi wakwanza anapata :nishani_ya_dhababu:\n\n# List all emojis (with positions) in a string\n>>> text = \"Hii ni \ud83e\udd47 na \ud83e\udd48\"\n>>> emoji_positions = emojiswahili.emoji_list(text)\n>>> print(emoji_positions)\n[{'match_start': 7, 'match_end': 8, 'emoji': '\ud83e\udd47'},\n {'match_start': 12, 'match_end': 13, 'emoji': '\ud83e\udd48'}]\n\n# Get a list of distinct emojis\n>>> print(emojiswahili.distinct_emoji_list(text))\n['\ud83e\udd47', '\ud83e\udd48']\n\n# Count emojis in a string\n>>> print(emojiswahili.emoji_count(text))\n2\n>>> print(emojiswahili.emoji_count(text, unique=True))\n2\n\n# Check if a string is purely emoji\n>>> print(emojiswahili.purely_emoji('\ud83e\udd47\ud83e\udd48'))\nTrue\n>>> print(emojiswahili.purely_emoji('Hii ni \ud83e\udd47 na \ud83e\udd48'))\nFalse\n\n```\n\n---\n\n## Installation\n\nInstall via pip:\n\n```console\n$ python -m pip install emojiswahili --upgrade\n```\n\n---\n\n## Development Guide\n\n### Code Style Check\n\nEnsure the code adheres to style guidelines using `ruff`:\n\n```console\n$ python -m pip install ruff\n$ ruff check emojiswahili\n```\n\n### Type Checking\n\nTest the type hints using `pyright` or `mypy`:\n\n```console\n$ python -m pip install pyright mypy typeguard\n$ pyright emojiswahili\n$ pyright tests\n$ mypy emojiswahili\n$ pytest --typeguard-packages=emojiswahili\n```\n\n---\n\n## Emoji Lists\n\n### Swahili Emoji List\n\nYou can find the complete Swahili emoji list at:\n\n- [`Unicode Emoji List in Swahili`](https://emojiterra.com/keyboard/sw) \n\n---\n\n## Authors and Maintainers\n\nThis project is developed and maintained by the eGARIDC Team / [`@ega`](https://ega.go.tz/)\n",
"bugtrack_url": null,
"license": null,
"summary": "Python library for working with emojis in Swahili",
"version": "1.0.2",
"project_urls": null,
"split_keywords": [
"emoji",
" swahili",
" emojiswahili",
" python",
" unicode"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "35b119c0c4d463346a8a92c6c8805e2f30a6ddf56fad470c4d2380b7b3f91ec8",
"md5": "eab6dc01aefd5986538ea8681a0a7b40",
"sha256": "523beec8ff18ad8104aaa5d7c72116101eaca73d003a98485a0c7b64c9096c34"
},
"downloads": -1,
"filename": "emojiswahili-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eab6dc01aefd5986538ea8681a0a7b40",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 47995,
"upload_time": "2025-01-15T14:37:34",
"upload_time_iso_8601": "2025-01-15T14:37:34.880294Z",
"url": "https://files.pythonhosted.org/packages/35/b1/19c0c4d463346a8a92c6c8805e2f30a6ddf56fad470c4d2380b7b3f91ec8/emojiswahili-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3c4971dc36103626bf63d160df5a99312336bfb168e4773f145b4e782ab5ba7f",
"md5": "2e726ed24487738fed937cdf91d1fdbc",
"sha256": "88d3c423fbe8a782576724923acbce01fd155ef9b4c3c5eb950cba66ff050430"
},
"downloads": -1,
"filename": "emojiswahili-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "2e726ed24487738fed937cdf91d1fdbc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 50999,
"upload_time": "2025-01-15T14:37:36",
"upload_time_iso_8601": "2025-01-15T14:37:36.755494Z",
"url": "https://files.pythonhosted.org/packages/3c/49/71dc36103626bf63d160df5a99312336bfb168e4773f145b4e782ab5ba7f/emojiswahili-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-15 14:37:36",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "emojiswahili"
}