<h1 align="center" style="font-family:'Courier New'">Hebrew("בְּרֵאשִׁ֖ית")</h1>
<p align="center">
<em>A python package with methods to handle the complexities of Hebrew text, calculate Gematria, and more.</em>
</p>
<p align="center">
<a href="https://pypi.org/project/hebrew/" target="_blank">
<img src="https://badge.fury.io/py/hebrew.svg" alt="PyPI version">
</a>
<a href="https://badge.fury.io/py/hebrew">
<img src="https://img.shields.io/pypi/pyversions/hebrew" alt="Supported Python Versions">
</a>
<a href="https://github.com/avi-perl/hebrew/actions/workflows/test.yml" target="_blank">
<img src="https://github.com/avi-perl/hebrew/actions/workflows/test.yml/badge.svg" alt="Test">
</a>
<a href="https://codecov.io/gh/avi-perl/hebrew" target="_blank">
<img src="https://codecov.io/gh/avi-perl/Hebrew/branch/master/graph/badge.svg?token=0DA1R9IY6S"/>
</a>
<a href="https://twitter.com/__aviperl__" target="_blank">
<img src="https://badgen.net/badge/icon/twitter?icon=twitter&label=Chat%20with%20me" alt="Twitter">
</a>
</p>
---
**Documentation**: [https://hebrew.aviperl.me/](https://hebrew.aviperl.me/)
**Repository**: [https://github.com/avi-perl/hebrew](https://github.com/avi-perl/hebrew)
---
# Installation
<!--pytest.mark.skip-->
```bash
$ pip install hebrew
```
# Example
`Hebrew` assists in working with Hebrew text by providing methods to handle the text according to user-perceived
characteristics. Additionally, methods for common Hebrew text processing are provided.
```python
from hebrew import Hebrew
from hebrew.chars import HebrewChar, ALEPH
hs = Hebrew('בְּרֵאשִׁ֖ית')
print(list(hs.graphemes)) # ['בְּ', 'רֵ', 'א', 'שִׁ֖', 'י', 'ת']
print(hs.text_only()) # בראשית
print(ALEPH) # HebrewChar(char='א', name='Aleph', hebrew_name='אָלֶף', name_alts=['Alef'], hebrew_name_alts=None, final_letter=False)
print(HebrewChar.search('bet')) # HebrewChar(char='בּ', name='Bet', hebrew_name='בֵּית', name_alts=None, hebrew_name_alts=None, final_letter=False)
```
## Gematria
The `Hebrew` class includes a `gematria` function that can return a value for _23_ different variations of Gematria!
```python
from hebrew import Hebrew
from hebrew import GematriaTypes
hs = Hebrew('בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃')
print(hs.gematria()) # 2701
print(hs.gematria(GematriaTypes.MISPAR_GADOL)) # 4631
```
Messy inputs, such as strings with english text mixed in, is supported. However, do be careful to work with sanitized
strings as much as possible.
```python
from hebrew import Hebrew
hs1 = Hebrew(
'''
Text: "בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃"
Translation: "When God began to create heaven and earth"
'''
)
hs2 = Hebrew('בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃')
assert hs1.gematria() == hs2.gematria() # 2701
```
Major kudos goes to [TorahCalc](https://www.torahcalc.com/gematria/) whose calculator and explanations were critical to
the development of this feature.
## Numerical Conversions
You can create a Hebrew object that represents a number using the `from_number` method. This is handy for displaying numbers in Hebrew form.
```python
from hebrew import Hebrew
hs1 = Hebrew.from_number(2)
print(hs1) # ב׳
# Add an apostrophe instead of a the unicode geresh
hs2 = Hebrew.from_number(2, geresh=False)
print(hs2) # 'ב
# Do not add punctuation
hs2 = Hebrew.from_number(2, geresh=False)
print(hs2) # ב
```
## Character Normalization
Hidden among hebrew text can be special characters that are visually identical humans, but are made up of different
unicode characters. However, this can cause issues with presentation when there is no support for these characters.
![bad_character_display.png](docs/img/bad_character_display.png)
In this case, the first letter is made up of 2 unicode characters, [sin with a dot](https://en.wiktionary.org/wiki/%D7%A9%D7%82)
and [qamatz](https://en.wiktionary.org/wiki/%D6%B8). The issue here is the sin. By normalizing the sin with a dot to 2 unicode
characters, [ש](https://en.wiktionary.org/wiki/%D7%A9) and the [dot](https://en.wiktionary.org/wiki/%D7%82), the display
will look right!
![good_character_display.png](docs/img/good_character_display.png)
To normalize content, use the `Hebrew.normalize` function:
```python
from hebrew import Hebrew
hs = Hebrew('שָׂחַקְתִּי כְּמוֹ')
assert len(hs.string) == 14
assert len(hs.normalize().string) == 18
```
### Normalizing Yiddish
By default, special yiddish characters such as [ײ](https://en.wiktionary.org/wiki/%D7%B2) (double Yod) are _not_ normalized.
However, [ײַ](https://en.wiktionary.org/wiki/%EF%AC%9F) (double Yod with a Patah) will be converted to [ײַ](https://en.wiktionary.org/wiki/%D7%B2%D6%B7).
To fully "normalize" yiddish characters, pass `True` to `normalize`.
## Grapheme Characters
Hebrew text comes in different forms, depending on the context. Hebrew text may appear with Niqqudot
"a system of diacritical signs used to represent vowels or distinguish between alternative pronunciations of letters
of the Hebrew alphabet". [^1] Additionally, Hebrew text may appear with extensive punctuation characters that connect
words, separate them, and cantillation marks "used as a guide for chanting the text, either from the printed text or,
in the case of the public reading of the Torah" [^2].
Because of the above, from the perspective of a hebrew reader, the following 3 words are the same:
1. **בְּרֵאשִׁ֖ית**
2. **בְּרֵאשִׁית**
3. **בראשית**
However, as a unicode string, they are entirely different because of the additional characters.
```python
assert len("בְּרֵאשִׁ֖ית") == 12
assert len("בְּרֵאשִׁית") == 11
assert len("בראשית") == 6
```
This 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:
_Expected: `רֵאשִׁ֖ית`_
```python
he = "בְּרֵאשִׁ֖ית"
assert he[-5:] == 'ִׁ֖ית'
```
The solution to this is to handle the unicode string as a list of grapheme[^3] characters, where each letter and its
accompanying characters are treated as a single unit.
### Working with Grapheme Characters
Using the [grapheme](https://github.com/alvinlindstam/grapheme) library for python, we can work with the grapheme
characters as units. This allows us to get the right number of characters, slice the string correctly, and more.
```python
import grapheme
assert grapheme.length("בְּרֵאשִׁ֖ית") == 6
assert grapheme.slice("בְּרֵאשִׁ֖ית", start=1, end=6) == 'רֵאשִׁ֖ית'
```
This library includes 2 classes. `GraphemeString` is a class that supports all the functions made available by `grapheme`.
The 2nd class `Hebrew` subclasses `GraphemeString` and adds methods for handling Hebrew text. This allows us to
interact with the text like so:
```python
from hebrew import Hebrew
v2 = Hebrew("וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֙הוּ֙ וָבֹ֔הוּ וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְה֑וֹם וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם׃")
print(v2.no_taamim()) # "וְהָאָרֶץ הָיְתָה תֹהוּ וָבֹהוּ וְחֹשֶׁךְ עַל־פְּנֵי תְהוֹם וְרוּחַ אֱלֹהִים מְרַחֶפֶת עַל־פְּנֵי הַמָּיִם׃"
print(v2.text_only()) # והארץ היתה תהו ובהו וחשך על־פני תהום ורוח אלהים מרחפת על־פני המים
assert v2.length == 66
print(v2.words(split_maqaf=True)) # [וְהָאָ֗רֶץ, הָיְתָ֥ה, תֹ֙הוּ֙, וָבֹ֔הוּ, וְחֹ֖שֶׁךְ, עַל, פְּנֵ֣י, תְה֑וֹם, וְר֣וּחַ, אֱלֹהִ֔ים, מְרַחֶ֖פֶת, עַל, פְּנֵ֥י, הַמָּֽיִם׃]
```
The text in these examples and used in testing were sourced from [Sefaria](https://github.com/Sefaria/Sefaria-Export).
## `hebrew.chars` and Character Constants
`hebrew.Chars` contains constants for every letter as well as lists by character category's.
Each value is an instance of a class that represents a character in the Hebrew character set with relevant properties.
Since this library seeks to support the use of the Hebrew language in the way it is used, characters such as "בּ" can be
located (`BET`) even though, strictly speaking, "בּ" is not part of the hebrew alphabet; it is a Hebrew letter plus a dot.
```python
from hebrew.chars import FINAL_LETTERS, YIDDISH_CHARS, TSADI
print(TSADI) # HebrewChar(char='צ', name='Tsadi', hebrew_name='צַדִי', name_alts=['Tzadik'], hebrew_name_alts=['צדיק'], final_letter=False)
assert {c.name: c.char for c in FINAL_LETTERS} == {'Chaf Sofit': 'ך', 'Mem Sofit': 'ם', 'Nun Sofit': 'ן', 'Fe Sofit': 'ף', 'Tsadi Sofit': 'ץ'}
assert [c.char for c in YIDDISH_CHARS] == ['ײ', 'װ', 'ױ']
```
A letter can be retrieved using the `CHARS` dict; A dict of all instances of all supported Char types where the key is
the char and the value is an instance of BaseHebrewChar.
```python
from hebrew.chars import CHARS
print(CHARS.get('בּ')) # HebrewChar(char='בּ', name='Bet', hebrew_name='בֵּית', name_alts=None, hebrew_name_alts=None, final_letter=False)
```
Search is also supported so that letters can be retrieved by their name.
```python
from hebrew.chars import HebrewChar
print(HebrewChar.search('bet')) # HebrewChar(char='בּ', name='Bet', hebrew_name='בֵּית', name_alts=None, hebrew_name_alts=None, final_letter=False)
```
## Contributing
Contributions in the form of pull requests are very welcome! I'm sure many more helpful methods related to hebrew text
could be helpful. More information and instructions for contributing can be found [here](CONTRIBUTING).
[^1]: [https://en.wikipedia.org/wiki/Niqqud](https://en.wikipedia.org/wiki/Niqqud)
[^2]: [https://en.wikipedia.org/wiki/Hebrew_cantillation](https://en.wikipedia.org/wiki/Hebrew_cantillation)
[^3]: [https://en.wikipedia.org/wiki/Grapheme](https://en.wikipedia.org/wiki/Grapheme)
Raw data
{
"_id": null,
"home_page": "https://github.com/avi-perl/hebrew",
"name": "hebrew",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.0,<4.0.0",
"maintainer_email": "",
"keywords": "hebrew,gematria,grapheme,ivrit,yiddish,taamim,ta'amim,kabbalah",
"author": "Avi Perl",
"author_email": "avi@aviperl.me",
"download_url": "https://files.pythonhosted.org/packages/4f/83/b583f6d62ecdbdad6ba3855702d42643d764e2ab440c56e757116947fce8/hebrew-0.8.1.tar.gz",
"platform": null,
"description": "<h1 align=\"center\" style=\"font-family:'Courier New'\">Hebrew(\"\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea\")</h1>\n<p align=\"center\">\n <em>A python package with methods to handle the complexities of Hebrew text, calculate Gematria, and more.</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\udb40\udc20\udb40\udc20\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\n<!--pytest.mark.skip-->\n\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('\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea')\nprint(list(hs.graphemes)) # ['\u05d1\u05bc\u05b0', '\u05e8\u05b5', '\u05d0', '\u05e9\u05c1\u05b4\u0596', '\u05d9', '\u05ea']\nprint(hs.text_only()) # \u05d1\u05e8\u05d0\u05e9\u05d9\u05ea\n\nprint(ALEPH) # HebrewChar(char='\u05d0', name='Aleph', hebrew_name='\u05d0\u05b8\u05dc\u05b6\u05e3', name_alts=['Alef'], hebrew_name_alts=None, final_letter=False)\n\nprint(HebrewChar.search('bet')) # HebrewChar(char='\u05d1\u05bc', name='Bet', hebrew_name='\u05d1\u05b5\u05bc\u05d9\u05ea', name_alts=None, hebrew_name_alts=None, final_letter=False)\n```\n\n## Gematria\n\nThe `Hebrew` class includes a `gematria` function that can return a value for _23_ different variations of Gematria!\n\n```python\nfrom hebrew import Hebrew\nfrom hebrew import GematriaTypes\n\nhs = Hebrew('\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea \u05d1\u05bc\u05b8\u05e8\u05b8\u05a3\u05d0 \u05d0\u05b1\u05dc\u05b9\u05d4\u05b4\u0591\u05d9\u05dd \u05d0\u05b5\u05a5\u05ea \u05d4\u05b7\u05e9\u05c1\u05bc\u05b8\u05de\u05b7\u0596\u05d9\u05b4\u05dd \u05d5\u05b0\u05d0\u05b5\u05a5\u05ea \u05d4\u05b8\u05d0\u05b8\u05bd\u05e8\u05b6\u05e5\u05c3')\n\nprint(hs.gematria()) # 2701\nprint(hs.gematria(GematriaTypes.MISPAR_GADOL)) # 4631\n```\n\nMessy inputs, such as strings with english text mixed in, is supported. However, do be careful to work with sanitized\nstrings as much as possible.\n\n```python\nfrom hebrew import Hebrew\n\nhs1 = Hebrew(\n '''\n Text: \"\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea \u05d1\u05bc\u05b8\u05e8\u05b8\u05a3\u05d0 \u05d0\u05b1\u05dc\u05b9\u05d4\u05b4\u0591\u05d9\u05dd \u05d0\u05b5\u05a5\u05ea \u05d4\u05b7\u05e9\u05c1\u05bc\u05b8\u05de\u05b7\u0596\u05d9\u05b4\u05dd \u05d5\u05b0\u05d0\u05b5\u05a5\u05ea \u05d4\u05b8\u05d0\u05b8\u05bd\u05e8\u05b6\u05e5\u05c3\"\n Translation: \"When God began to create heaven and earth\"\n '''\n)\nhs2 = Hebrew('\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea \u05d1\u05bc\u05b8\u05e8\u05b8\u05a3\u05d0 \u05d0\u05b1\u05dc\u05b9\u05d4\u05b4\u0591\u05d9\u05dd \u05d0\u05b5\u05a5\u05ea \u05d4\u05b7\u05e9\u05c1\u05bc\u05b8\u05de\u05b7\u0596\u05d9\u05b4\u05dd \u05d5\u05b0\u05d0\u05b5\u05a5\u05ea \u05d4\u05b8\u05d0\u05b8\u05bd\u05e8\u05b6\u05e5\u05c3')\n\nassert hs1.gematria() == hs2.gematria() # 2701\n```\n\nMajor kudos goes to [TorahCalc](https://www.torahcalc.com/gematria/) whose calculator and explanations were critical to\nthe development of this feature.\n\n## Numerical Conversions\n\nYou can create a Hebrew object that represents a number using the `from_number` method. This is handy for displaying numbers in Hebrew form.\n\n```python\nfrom hebrew import Hebrew\n\nhs1 = Hebrew.from_number(2)\nprint(hs1) # \u05d1\u05f3\n\n# Add an apostrophe instead of a the unicode geresh\nhs2 = Hebrew.from_number(2, geresh=False)\nprint(hs2) # '\u05d1\n\n# Do not add punctuation\nhs2 = Hebrew.from_number(2, geresh=False)\nprint(hs2) # \u05d1\n\n```\n\n## Character Normalization\nHidden among hebrew text can be special characters that are visually identical humans, but are made up of different \nunicode characters. However, this can cause issues with presentation when there is no support for these characters.\n\n![bad_character_display.png](docs/img/bad_character_display.png)\n\nIn this case, the first letter is made up of 2 unicode characters, [sin with a dot](https://en.wiktionary.org/wiki/%D7%A9%D7%82)\nand [qamatz](https://en.wiktionary.org/wiki/%D6%B8). The issue here is the sin. By normalizing the sin with a dot to 2 unicode \ncharacters, [\u05e9](https://en.wiktionary.org/wiki/%D7%A9) and the [dot](https://en.wiktionary.org/wiki/%D7%82), the display \nwill look right!\n\n![good_character_display.png](docs/img/good_character_display.png)\n\nTo normalize content, use the `Hebrew.normalize` function:\n```python\nfrom hebrew import Hebrew\n\nhs = Hebrew('\ufb2b\u05b8\u05d7\u05b7\u05e7\u05b0\ufb4a\u05b4\u05d9 \ufb3b\u05b0\u05de\ufb4b')\n\nassert len(hs.string) == 14\nassert len(hs.normalize().string) == 18\n```\n\n### Normalizing Yiddish\n\nBy default, special yiddish characters such as [\u05f2](https://en.wiktionary.org/wiki/%D7%B2) (double Yod) are _not_ normalized.\nHowever, [\ufb1f](https://en.wiktionary.org/wiki/%EF%AC%9F) (double Yod with a Patah) will be converted to [\u05f2\u05b7](https://en.wiktionary.org/wiki/%D7%B2%D6%B7).\n\nTo fully \"normalize\" yiddish characters, pass `True` to `normalize`.\n\n\n## Grapheme Characters\n\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:\n\n1. **\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea**\n2. **\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u05d9\u05ea**\n3. **\u05d1\u05e8\u05d0\u05e9\u05d9\u05ea**\n\nHowever, as a unicode string, they are entirely different because of the additional characters.\n\n```python\nassert len(\"\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea\") == 12\nassert len(\"\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u05d9\u05ea\") == 11\nassert len(\"\u05d1\u05e8\u05d0\u05e9\u05d9\u05ea\") == 6\n```\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: `\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea`_\n\n```python\nhe = \"\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea\"\nassert he[-5:] == '\u05c1\u05b4\u0596\u05d9\u05ea'\n```\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\n\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\n```python\nimport grapheme\n\nassert grapheme.length(\"\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea\") == 6\nassert grapheme.slice(\"\u05d1\u05bc\u05b0\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea\", start=1, end=6) == '\u05e8\u05b5\u05d0\u05e9\u05c1\u05b4\u0596\u05d9\u05ea'\n```\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\n```python\nfrom hebrew import Hebrew\n\nv2 = Hebrew(\"\u05d5\u05b0\u05d4\u05b8\u05d0\u05b8\u0597\u05e8\u05b6\u05e5 \u05d4\u05b8\u05d9\u05b0\u05ea\u05b8\u05a5\u05d4 \u05ea\u05b9\u0599\u05d4\u05d5\u05bc\u0599 \u05d5\u05b8\u05d1\u05b9\u0594\u05d4\u05d5\u05bc \u05d5\u05b0\u05d7\u05b9\u0596\u05e9\u05c1\u05b6\u05da\u05b0 \u05e2\u05b7\u05dc\u05be\u05e4\u05bc\u05b0\u05e0\u05b5\u05a3\u05d9 \u05ea\u05b0\u05d4\u0591\u05d5\u05b9\u05dd \u05d5\u05b0\u05e8\u05a3\u05d5\u05bc\u05d7\u05b7 \u05d0\u05b1\u05dc\u05b9\u05d4\u05b4\u0594\u05d9\u05dd \u05de\u05b0\u05e8\u05b7\u05d7\u05b6\u0596\u05e4\u05b6\u05ea \u05e2\u05b7\u05dc\u05be\u05e4\u05bc\u05b0\u05e0\u05b5\u05a5\u05d9 \u05d4\u05b7\u05de\u05bc\u05b8\u05bd\u05d9\u05b4\u05dd\u05c3\")\nprint(v2.no_taamim()) # \"\u05d5\u05b0\u05d4\u05b8\u05d0\u05b8\u05e8\u05b6\u05e5 \u05d4\u05b8\u05d9\u05b0\u05ea\u05b8\u05d4 \u05ea\u05b9\u05d4\u05d5\u05bc \u05d5\u05b8\u05d1\u05b9\u05d4\u05d5\u05bc \u05d5\u05b0\u05d7\u05b9\u05e9\u05c1\u05b6\u05da\u05b0 \u05e2\u05b7\u05dc\u05be\u05e4\u05bc\u05b0\u05e0\u05b5\u05d9 \u05ea\u05b0\u05d4\u05d5\u05b9\u05dd \u05d5\u05b0\u05e8\u05d5\u05bc\u05d7\u05b7 \u05d0\u05b1\u05dc\u05b9\u05d4\u05b4\u05d9\u05dd \u05de\u05b0\u05e8\u05b7\u05d7\u05b6\u05e4\u05b6\u05ea \u05e2\u05b7\u05dc\u05be\u05e4\u05bc\u05b0\u05e0\u05b5\u05d9 \u05d4\u05b7\u05de\u05bc\u05b8\u05d9\u05b4\u05dd\u05c3\"\nprint(v2.text_only()) # \u05d5\u05d4\u05d0\u05e8\u05e5 \u05d4\u05d9\u05ea\u05d4 \u05ea\u05d4\u05d5 \u05d5\u05d1\u05d4\u05d5 \u05d5\u05d7\u05e9\u05da \u05e2\u05dc\u05be\u05e4\u05e0\u05d9 \u05ea\u05d4\u05d5\u05dd \u05d5\u05e8\u05d5\u05d7 \u05d0\u05dc\u05d4\u05d9\u05dd \u05de\u05e8\u05d7\u05e4\u05ea \u05e2\u05dc\u05be\u05e4\u05e0\u05d9 \u05d4\u05de\u05d9\u05dd\n\nassert v2.length == 66\nprint(v2.words(split_maqaf=True)) # [\u05d5\u05b0\u05d4\u05b8\u05d0\u05b8\u0597\u05e8\u05b6\u05e5, \u05d4\u05b8\u05d9\u05b0\u05ea\u05b8\u05a5\u05d4, \u05ea\u05b9\u0599\u05d4\u05d5\u05bc\u0599, \u05d5\u05b8\u05d1\u05b9\u0594\u05d4\u05d5\u05bc, \u05d5\u05b0\u05d7\u05b9\u0596\u05e9\u05c1\u05b6\u05da\u05b0, \u05e2\u05b7\u05dc, \u05e4\u05bc\u05b0\u05e0\u05b5\u05a3\u05d9, \u05ea\u05b0\u05d4\u0591\u05d5\u05b9\u05dd, \u05d5\u05b0\u05e8\u05a3\u05d5\u05bc\u05d7\u05b7, \u05d0\u05b1\u05dc\u05b9\u05d4\u05b4\u0594\u05d9\u05dd, \u05de\u05b0\u05e8\u05b7\u05d7\u05b6\u0596\u05e4\u05b6\u05ea, \u05e2\u05b7\u05dc, \u05e4\u05bc\u05b0\u05e0\u05b5\u05a5\u05d9, \u05d4\u05b7\u05de\u05bc\u05b8\u05bd\u05d9\u05b4\u05dd\u05c3]\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\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 \"\u05d1\u05bc\" can be\nlocated (`BET`) even though, strictly speaking, \"\u05d1\u05bc\" 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='\u05e6', name='Tsadi', hebrew_name='\u05e6\u05b7\u05d3\u05b4\u05d9', name_alts=['Tzadik'], hebrew_name_alts=['\u05e6\u05d3\u05d9\u05e7'], final_letter=False)\n\nassert {c.name: c.char for c in FINAL_LETTERS} == {'Chaf Sofit': '\u05da', 'Mem Sofit': '\u05dd', 'Nun Sofit': '\u05df', 'Fe Sofit': '\u05e3', 'Tsadi Sofit': '\u05e5'}\n\nassert [c.char for c in YIDDISH_CHARS] == ['\u05f2', '\u05f0', '\u05f1']\n```\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\n```python\nfrom hebrew.chars import CHARS\n\nprint(CHARS.get('\u05d1\u05bc')) # HebrewChar(char='\u05d1\u05bc', name='Bet', hebrew_name='\u05d1\u05b5\u05bc\u05d9\u05ea', name_alts=None, hebrew_name_alts=None, final_letter=False)\n```\n\nSearch is also supported so that letters can be retrieved by their name.\n\n```python\nfrom hebrew.chars import HebrewChar\n\nprint(HebrewChar.search('bet')) # HebrewChar(char='\u05d1\u05bc', name='Bet', hebrew_name='\u05d1\u05b5\u05bc\u05d9\u05ea', name_alts=None, hebrew_name_alts=None, final_letter=False)\n```\n\n## Contributing\n\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)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python package with methods to handle the complexities of Hebrew text, calculate Gematria, and more.",
"version": "0.8.1",
"project_urls": {
"Documentation": "https://hebrew.aviperl.me/",
"Homepage": "https://github.com/avi-perl/hebrew",
"Repository": "https://github.com/avi-perl/hebrew"
},
"split_keywords": [
"hebrew",
"gematria",
"grapheme",
"ivrit",
"yiddish",
"taamim",
"ta'amim",
"kabbalah"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "83f20c3b7cba7031e9263aacdfc339f318918d0fb18fa3813f85c429eb6302c1",
"md5": "461d38432891ea4b4ad5fd81a0fed09f",
"sha256": "7f2a832a193a2cdcdb444945e6fc481deaaa9f0163f592f304ab960ad3445d08"
},
"downloads": -1,
"filename": "hebrew-0.8.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "461d38432891ea4b4ad5fd81a0fed09f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.0,<4.0.0",
"size": 26909,
"upload_time": "2024-02-25T04:35:34",
"upload_time_iso_8601": "2024-02-25T04:35:34.603764Z",
"url": "https://files.pythonhosted.org/packages/83/f2/0c3b7cba7031e9263aacdfc339f318918d0fb18fa3813f85c429eb6302c1/hebrew-0.8.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4f83b583f6d62ecdbdad6ba3855702d42643d764e2ab440c56e757116947fce8",
"md5": "2127d4a1b4709d6e5b59f66564fec6b3",
"sha256": "4a90bbb5cd3bcffc7c6b4e0bd12a2e29bea377ce40f07e0623aba6c0ce02c4b4"
},
"downloads": -1,
"filename": "hebrew-0.8.1.tar.gz",
"has_sig": false,
"md5_digest": "2127d4a1b4709d6e5b59f66564fec6b3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.0,<4.0.0",
"size": 24714,
"upload_time": "2024-02-25T04:35:36",
"upload_time_iso_8601": "2024-02-25T04:35:36.473440Z",
"url": "https://files.pythonhosted.org/packages/4f/83/b583f6d62ecdbdad6ba3855702d42643d764e2ab440c56e757116947fce8/hebrew-0.8.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-25 04:35:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "avi-perl",
"github_project": "hebrew",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "hebrew"
}