# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['hebrew']

package_data = \
{'': ['*']}

install_requires = \
['grapheme>=0.6.0,<0.7.0']

setup_kwargs = {
    'name': 'hebrew',
    'version': '0.5.7',
    'description': 'A python package with methods to handle the complexities of Hebrew text.',
    'long_description': '<h1 align="center" style="font-family:\'Courier New\'">Hebrew("בְּרֵאשִׁ֖ית")</h1>\n<p align="center">\n    <em>A python package with methods to handle the complexities of Hebrew text.</em>\n</p>\n<p align="center">\n<a href="https://pypi.org/project/hebrew/" target="_blank">\n    <img src="https://badge.fury.io/py/hebrew.svg" alt="PyPI version">\n</a>\n<a href="https://badge.fury.io/py/hebrew">\n    <img src="https://img.shields.io/pypi/pyversions/hebrew" alt="Supported Python Versions">\n</a>\n<a href="https://github.com/avi-perl/hebrew/actions/workflows/test.yml" target="_blank">\n    <img src="https://github.com/avi-perl/hebrew/actions/workflows/test.yml/badge.svg" alt="Test">\n</a>\n<a href="https://codecov.io/gh/avi-perl/hebrew" target="_blank">\n  <img src="https://codecov.io/gh/avi-perl/Hebrew/branch/master/graph/badge.svg?token=0DA1R9IY6S"/>\n</a>\n\U000e0020\U000e0020\n<a href="https://twitter.com/__aviperl__" target="_blank">\n    <img src="https://badgen.net/badge/icon/twitter?icon=twitter&label=Chat%20with%20me" alt="Twitter">\n</a>\n</p>\n\n---\n\n**Documentation**: [https://hebrew.aviperl.me/](https://hebrew.aviperl.me/)\n\n**Repository**: [https://github.com/avi-perl/hebrew](https://github.com/avi-perl/hebrew)\n\n---\n\n# Installation\n<!--pytest-codeblocks:skip-->\n```bash\n$ pip install hebrew\n```\n\n# Example\n\n`Hebrew` assists in working with Hebrew text by providing methods to handle the text according to user-perceived\ncharacteristics. Additionally, methods for common Hebrew text processing are provided.\n\n```python\nfrom hebrew import Hebrew\nfrom hebrew.chars import HebrewChar, ALEPH\n\nhs = Hebrew(\'בְּרֵאשִׁ֖ית\')\nprint(list(hs.graphemes))  # [\'בְּ\', \'רֵ\', \'א\', \'שִׁ֖\', \'י\', \'ת\']\nprint(hs.text_only())  # בראשית\n\nprint(ALEPH)  # HebrewChar(char=\'א\', name=\'Aleph\', hebrew_name=\'אָלֶף\', name_alts=[\'Alef\'], hebrew_name_alts=None, final_letter=False)\n\nprint(HebrewChar.search(\'bet\'))  # HebrewChar(char=\'בּ\', name=\'Bet\', hebrew_name=\'בֵּית\', name_alts=None, hebrew_name_alts=None, final_letter=False)\n```\n\n## Grapheme Characters\nHebrew text comes in different forms, depending on the context. Hebrew text may appear with Niqqudot\n"a system of diacritical signs used to represent vowels or distinguish between alternative pronunciations of letters\nof the Hebrew alphabet". [^1] Additionally, Hebrew text may appear with extensive punctuation characters that connect\nwords, separate them, and cantillation marks "used as a guide for chanting the text, either from the printed text or,\nin the case of the public reading of the Torah" [^2].\n\nBecause of the above, from the perspective of a hebrew reader, the following 3 words are the same:\n1. **בְּרֵאשִׁ֖ית**\n2. **בְּרֵאשִׁית**\n3. **בראשית**\n\nHowever, as a unicode string, they are entirely different because of the additional characters.\n```python\nassert len("בְּרֵאשִׁ֖ית") == 12\nassert len("בְּרֵאשִׁית") == 11\nassert len("בראשית") == 6\n```\nThis impacts the user is a number of other ways. For example, if I want to get the root of this hebrew word using a slice:\n_Expected: `רֵאשִׁ֖ית`_\n```python\nhe = "בְּרֵאשִׁ֖ית"\nassert he[-5:] == \'ִׁ֖ית\'\n```\nThe solution to this is to handle the unicode string as a list of grapheme[^3] characters, where each letter and its\naccompanying characters are treated as a single unit.\n\n### Working with Grapheme Characters\nUsing the [grapheme](https://github.com/alvinlindstam/grapheme) library for python, we can work with the grapheme\ncharacters as units. This allows us to get the right number of characters, slice the string correctly, and more.\n```python\nimport grapheme\n\nassert grapheme.length("בְּרֵאשִׁ֖ית") == 6\nassert grapheme.slice("בְּרֵאשִׁ֖ית", start=1, end=6) == \'רֵאשִׁ֖ית\'\n```\nThis library includes 2 classes. `GraphemeString` is a class that supports all the functions made available by `grapheme`.\nThe 2nd class `Hebrew` subclasses `GraphemeString` and adds methods for handling Hebrew text. This allows us to\ninteract with the text like so:\n```python\nfrom hebrew import Hebrew\n\nv2 = Hebrew("וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֙הוּ֙ וָבֹ֔הוּ וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְה֑וֹם וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם׃")\nprint(v2.no_taamim())  # "וְהָאָרֶץ הָיְתָה תֹהוּ וָבֹהוּ וְחֹשֶׁךְ עַל־פְּנֵי תְהוֹם וְרוּחַ אֱלֹהִים מְרַחֶפֶת עַל־פְּנֵי הַמָּיִם׃"\nprint(v2.text_only())  # והארץ היתה תהו ובהו וחשך על־פני תהום ורוח אלהים מרחפת על־פני המים\n\nassert v2.length == 66\nprint(v2.words(split_maqaf=True))  # [וְהָאָ֗רֶץ, הָיְתָ֥ה, תֹ֙הוּ֙, וָבֹ֔הוּ, וְחֹ֖שֶׁךְ, עַל, פְּנֵ֣י, תְה֑וֹם, וְר֣וּחַ, אֱלֹהִ֔ים, מְרַחֶ֖פֶת, עַל, פְּנֵ֥י, הַמָּֽיִם׃]\n```\n\nThe text in these examples and used in testing were sourced from [Sefaria](https://github.com/Sefaria/Sefaria-Export).\n\n## `hebrew.chars` and Character Constants\n`hebrew.Chars` contains constants for every letter as well as lists by character category\'s.\nEach value is an instance of a class that represents a character in the Hebrew character set with relevant properties.\nSince this library seeks to support the use of the Hebrew language in the way it is used, characters such as "בּ" can be\nlocated (`BET`) even though, strictly speaking, "בּ" is not part of the hebrew alphabet; it is a Hebrew letter plus a dot.\n\n```python\nfrom hebrew.chars import FINAL_LETTERS, YIDDISH_CHARS, TSADI\n\nprint(TSADI)  # HebrewChar(char=\'צ\', name=\'Tsadi\', hebrew_name=\'צַדִי\', name_alts=[\'Tzadik\'], hebrew_name_alts=[\'צדיק\'], final_letter=False)\n\nassert {c.name: c.char for c in FINAL_LETTERS} == {\'Chaf Sofit\': \'ך\', \'Mem Sofit\': \'ם\', \'Nun Sofit\': \'ן\', \'Fe Sofit\': \'ף\', \'Tsadi Sofit\': \'ץ\'}\n\nassert [c.char for c in YIDDISH_CHARS] == [\'ײ\', \'װ\', \'ױ\']\n```\nA letter can be retrieved using the `CHARS` dict; A dict of all instances of all supported Char types where the key is\nthe char and the value is an instance of BaseHebrewChar.\n```python\nfrom hebrew.chars import CHARS\n\nprint(CHARS.get(\'בּ\'))  # HebrewChar(char=\'בּ\', name=\'Bet\', hebrew_name=\'בֵּית\', name_alts=None, hebrew_name_alts=None, final_letter=False)\n```\nSearch is also supported so that letters can be retrieved by their name.\n```python\nfrom hebrew.chars import HebrewChar\n\nprint(HebrewChar.search(\'bet\'))  # HebrewChar(char=\'בּ\', name=\'Bet\', hebrew_name=\'בֵּית\', name_alts=None, hebrew_name_alts=None, final_letter=False)\n```\n\n## Contributing\nContributions in the form of pull requests are very welcome! I\'m sure many more helpful methods related to hebrew text\ncould be helpful. More information and instructions for contributing can be found [here](CONTRIBUTING).\n\n[^1]: [https://en.wikipedia.org/wiki/Niqqud](https://en.wikipedia.org/wiki/Niqqud)\n[^2]: [https://en.wikipedia.org/wiki/Hebrew_cantillation](https://en.wikipedia.org/wiki/Hebrew_cantillation)\n[^3]: [https://en.wikipedia.org/wiki/Grapheme](https://en.wikipedia.org/wiki/Grapheme)',
    'author': 'Avi Perl',
    'author_email': 'avi@aviperl.me',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/avi-perl/hebrew',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.7.0,<4.0.0',
}


setup(**setup_kwargs)
