python-hebrew 1.15__tar.gz → 1.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_hebrew-1.16/PKG-INFO +12 -0
- python_hebrew-1.16/__init__.py +27 -0
- python_hebrew-1.15/HebrewNumbers.py → python_hebrew-1.16/number.py +52 -48
- python_hebrew-1.16/pyproject.toml +20 -0
- python_hebrew-1.16/python_hebrew.egg-info/PKG-INFO +12 -0
- {python_hebrew-1.15 → python_hebrew-1.16}/python_hebrew.egg-info/SOURCES.txt +6 -3
- python_hebrew-1.16/python_hebrew.egg-info/top_level.txt +1 -0
- python_hebrew-1.15/PKG-INFO +0 -12
- python_hebrew-1.15/README.md +0 -4
- python_hebrew-1.15/pyproject.toml +0 -17
- python_hebrew-1.15/python_hebrew.egg-info/PKG-INFO +0 -12
- python_hebrew-1.15/python_hebrew.egg-info/top_level.txt +0 -2
- {python_hebrew-1.15 → python_hebrew-1.16}/LICENSE +0 -0
- /python_hebrew-1.15/Hebrew.py → /python_hebrew-1.16/hebrew.py +0 -0
- {python_hebrew-1.15 → python_hebrew-1.16}/python_hebrew.egg-info/dependency_links.txt +0 -0
- {python_hebrew-1.15 → python_hebrew-1.16}/python_hebrew.egg-info/requires.txt +0 -0
- {python_hebrew-1.15 → python_hebrew-1.16}/setup.cfg +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-hebrew
|
|
3
|
+
Version: 1.16
|
|
4
|
+
Summary: Hebrew text and numeral utilities — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion
|
|
5
|
+
License-Expression: GPL-3.0-or-later
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/plain
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: regex
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
Hebrew text and numeral utilities — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from .hebrew import (
|
|
2
|
+
ALEF, BET, GIMEL, DALET, VAV, ZAYIN, TET, YOD, KAF, LAMED, MEM, NUN, SAMEKH,
|
|
3
|
+
PE, TSADI, QOF, RESH, BASESHIN, SHIN, SIN, TAV,
|
|
4
|
+
WIDE_ALEF, WIDE_DALET, WIDE_HE, WIDE_KAF, WIDE_LAMED, WIDE_RESH, WIDE_TAV,
|
|
5
|
+
HE, HET, AYIN,
|
|
6
|
+
FINAL_KAF, FINAL_MEM, FINAL_NUN, FINAL_PE, FINAL_TSADI, WIDE_FINAL_MEM,
|
|
7
|
+
SHEVA, PATAH, QAMATS, QAMATS_KATAN, TSERE, SEGOL, HIRIQ, HOLAM, HOLAM_HASER, QUBUTS,
|
|
8
|
+
HATAF_SEGOL, HATAF_PATAH, HATAF_QAMATS,
|
|
9
|
+
DAGESH, RAFE,
|
|
10
|
+
ETNAHTA, SEGOL_ACCENT, SHALSHELET, ZAQEF_QATAN, ZAQEF_GADOL, TIPEHA, REVIA, ZARQA,
|
|
11
|
+
PASHTA, YETIV, TEVIR, GERESH_CANTILLATION, GERESH_MUQDAM, GERSHAYIM_CANTILLATION,
|
|
12
|
+
QARNEY_PARA, TELISHA_GEDOLA, PAZER, QADMA, TELISHA_QETANA, YERAH_BEN_YOMO,
|
|
13
|
+
OLE, ILUY, DEHI, ZINOR,
|
|
14
|
+
MUNAH, MAHAPAKH, MERKHA, MERKHA_KEFULA, DARGA, QADMA_OLD, METEG,
|
|
15
|
+
UPPER_DOT, LOWER_DOT, NUN_HAFUKHA, MASORA_CIRCLE,
|
|
16
|
+
SOF_PASUK, PASEQ, MAQAF, GERESH, GERSHAYIM,
|
|
17
|
+
YIDDISH_VAV_VAV, YIDDISH_VAV_YOD, YIDDISH_YOD_YOD, ALEF_LAMED, YIDDISH_PASHTA,
|
|
18
|
+
PLAIN_LETTERS, GUTTURALS, FINALS, ALL_LETTERS, ALL_LETTER_CHARS,
|
|
19
|
+
DIACRITICS, HATAFS, UPPER_CANTILLATIONS, LOWER_CANTILLATIONS, CANTILLATIONS,
|
|
20
|
+
MARKS, PUNCTUATION, EXTRA,
|
|
21
|
+
Char, Letter, Diacritic,
|
|
22
|
+
normalize, add_dagesh_hazzak, add_sheva_na, strip_punctuation, strip_cantillation,
|
|
23
|
+
strip_diacritics, strip_hebrew_punctuation, strip_yy, strip_yhwh, presentation,
|
|
24
|
+
raw_text, transliterate,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
from .number import int_to_gematria, gematria_to_int, Number
|
|
@@ -20,56 +20,48 @@ REVERSE_MAP_DICT = {v: k for k, v in HEBREW_NUMERALS['numerals'].items()}
|
|
|
20
20
|
REVERSE_SOFIT_MAP = dict(REVERSE_MAP_DICT)
|
|
21
21
|
REVERSE_SOFIT_MAP.update({v: k for k, v in HEBREW_NUMERALS['sofit'].items()})
|
|
22
22
|
|
|
23
|
-
def _add_gershayim(s):
|
|
24
|
-
if len(s) == 1:
|
|
25
|
-
s += HEBREW_NUMERALS['separators']['geresh']
|
|
26
|
-
else:
|
|
27
|
-
s = ''.join([s[:-1], HEBREW_NUMERALS['separators']['gershayim'], s[-1:]])
|
|
28
|
-
return s
|
|
29
|
-
|
|
30
|
-
def _digit_letters(value, sofit_notation):
|
|
31
|
-
if sofit_notation and value in HEBREW_NUMERALS['sofit']:
|
|
32
|
-
return HEBREW_NUMERALS['sofit'][value]
|
|
33
|
-
return HEBREW_NUMERALS['numerals'][value]
|
|
34
|
-
|
|
35
|
-
def _convert_less_than_1000(num, gershayim=True, sofit_notation=False):
|
|
36
|
-
if num <= 0 or num >= 1000:
|
|
37
|
-
return ""
|
|
38
|
-
base = num % 100
|
|
39
|
-
hundreds = num - base
|
|
40
|
-
if base in HEBREW_NUMERALS['specials_suffix']:
|
|
41
|
-
suffix = HEBREW_NUMERALS['specials_suffix'][base]
|
|
42
|
-
if hundreds == 0:
|
|
43
|
-
remainder_str = suffix
|
|
44
|
-
else:
|
|
45
|
-
remainder_str = _digit_letters(hundreds, sofit_notation) + suffix
|
|
46
|
-
else:
|
|
47
|
-
parts = []
|
|
48
|
-
rest_str = str(num)
|
|
49
|
-
while rest_str:
|
|
50
|
-
digit = int(rest_str[0])
|
|
51
|
-
rest_str = rest_str[1:]
|
|
52
|
-
if digit == 0:
|
|
53
|
-
continue
|
|
54
|
-
power = 10 ** len(rest_str)
|
|
55
|
-
parts.append(_digit_letters(power * digit, sofit_notation))
|
|
56
|
-
remainder_str = ''.join(parts)
|
|
57
|
-
if gershayim:
|
|
58
|
-
return _add_gershayim(remainder_str)
|
|
59
|
-
return remainder_str
|
|
60
|
-
|
|
61
|
-
def hebrew_number(num, sofit_notation=False):
|
|
62
|
-
return int_to_gematria(num, sofit_notation=sofit_notation)
|
|
63
|
-
|
|
64
|
-
def hebrew_fancy_number(num, sofit_notation=False):
|
|
65
|
-
return int_to_gematria(num, gershayim=True, sofit_notation=sofit_notation)
|
|
66
|
-
|
|
67
|
-
|
|
68
23
|
def int_to_gematria(num, gershayim=False, book_notation=False, sofit_notation=False):
|
|
69
24
|
if book_notation and sofit_notation:
|
|
70
25
|
raise ValueError("book_notation and sofit_notation cannot both be used: book_notation never produces a value in sofit's 500-900 range.")
|
|
71
26
|
if not isinstance(num, int) or num < 1:
|
|
72
27
|
return ""
|
|
28
|
+
|
|
29
|
+
def add_gershayim(s):
|
|
30
|
+
if len(s) == 1:
|
|
31
|
+
return s + HEBREW_NUMERALS['separators']['geresh']
|
|
32
|
+
return ''.join([s[:-1], HEBREW_NUMERALS['separators']['gershayim'], s[-1:]])
|
|
33
|
+
|
|
34
|
+
def digit_letters(value, sofit_notation):
|
|
35
|
+
if sofit_notation and value in HEBREW_NUMERALS['sofit']:
|
|
36
|
+
return HEBREW_NUMERALS['sofit'][value]
|
|
37
|
+
return HEBREW_NUMERALS['numerals'][value]
|
|
38
|
+
|
|
39
|
+
def convert_less_than_1000(num, gershayim=True, sofit_notation=False):
|
|
40
|
+
if num <= 0 or num >= 1000:
|
|
41
|
+
return ""
|
|
42
|
+
base = num % 100
|
|
43
|
+
hundreds = num - base
|
|
44
|
+
if base in HEBREW_NUMERALS['specials_suffix']:
|
|
45
|
+
suffix = HEBREW_NUMERALS['specials_suffix'][base]
|
|
46
|
+
if hundreds == 0:
|
|
47
|
+
remainder_str = suffix
|
|
48
|
+
else:
|
|
49
|
+
remainder_str = digit_letters(hundreds, sofit_notation) + suffix
|
|
50
|
+
else:
|
|
51
|
+
parts = []
|
|
52
|
+
rest_str = str(num)
|
|
53
|
+
while rest_str:
|
|
54
|
+
digit = int(rest_str[0])
|
|
55
|
+
rest_str = rest_str[1:]
|
|
56
|
+
if digit == 0:
|
|
57
|
+
continue
|
|
58
|
+
power = 10 ** len(rest_str)
|
|
59
|
+
parts.append(digit_letters(power * digit, sofit_notation))
|
|
60
|
+
remainder_str = ''.join(parts)
|
|
61
|
+
if gershayim:
|
|
62
|
+
return add_gershayim(remainder_str)
|
|
63
|
+
return remainder_str
|
|
64
|
+
|
|
73
65
|
if book_notation:
|
|
74
66
|
tav_count = num // 400
|
|
75
67
|
remainder = num % 400
|
|
@@ -77,10 +69,10 @@ def int_to_gematria(num, gershayim=False, book_notation=False, sofit_notation=Fa
|
|
|
77
69
|
if tav_count > 0:
|
|
78
70
|
result_parts.append('ת' * tav_count)
|
|
79
71
|
if remainder > 0:
|
|
80
|
-
result_parts.append(
|
|
72
|
+
result_parts.append(convert_less_than_1000(remainder, gershayim=False))
|
|
81
73
|
final_str = ''.join(result_parts)
|
|
82
74
|
if gershayim and final_str:
|
|
83
|
-
return
|
|
75
|
+
return add_gershayim(final_str)
|
|
84
76
|
return final_str
|
|
85
77
|
else:
|
|
86
78
|
thousands = num // 1000
|
|
@@ -90,7 +82,7 @@ def int_to_gematria(num, gershayim=False, book_notation=False, sofit_notation=Fa
|
|
|
90
82
|
thousands_str = int_to_gematria(thousands, gershayim=False, sofit_notation=sofit_notation)
|
|
91
83
|
result_parts.append(thousands_str + HEBREW_NUMERALS['separators']['geresh'])
|
|
92
84
|
if remainder > 0:
|
|
93
|
-
result_parts.append(
|
|
85
|
+
result_parts.append(convert_less_than_1000(remainder, gershayim, sofit_notation))
|
|
94
86
|
return ''.join(result_parts)
|
|
95
87
|
|
|
96
88
|
def gematria_to_int(gematria_str, book_notation=False, sofit_notation=False):
|
|
@@ -131,3 +123,15 @@ def gematria_to_int(gematria_str, book_notation=False, sofit_notation=False):
|
|
|
131
123
|
for char in remainder_str:
|
|
132
124
|
res += reverse_map.get(char, 0)
|
|
133
125
|
return res
|
|
126
|
+
|
|
127
|
+
class Number:
|
|
128
|
+
def __init__(self, value):
|
|
129
|
+
self.value = value
|
|
130
|
+
|
|
131
|
+
@property
|
|
132
|
+
def text(self):
|
|
133
|
+
return int_to_gematria(self.value)
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def fancy_text(self):
|
|
137
|
+
return int_to_gematria(self.value, gershayim=True)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "python-hebrew"
|
|
7
|
+
version = "1.16"
|
|
8
|
+
description = "Hebrew text and numeral utilities — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion"
|
|
9
|
+
readme = { text = "Hebrew text and numeral utilities — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion.", content-type = "text/plain" }
|
|
10
|
+
license = "GPL-3.0-or-later"
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"regex",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[tool.setuptools]
|
|
17
|
+
packages = ["hebrew"]
|
|
18
|
+
|
|
19
|
+
[tool.setuptools.package-dir]
|
|
20
|
+
hebrew = "."
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-hebrew
|
|
3
|
+
Version: 1.16
|
|
4
|
+
Summary: Hebrew text and numeral utilities — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion
|
|
5
|
+
License-Expression: GPL-3.0-or-later
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/plain
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: regex
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
Hebrew text and numeral utilities — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion.
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
Hebrew.py
|
|
2
|
-
HebrewNumbers.py
|
|
3
1
|
LICENSE
|
|
4
|
-
|
|
2
|
+
__init__.py
|
|
3
|
+
hebrew.py
|
|
4
|
+
number.py
|
|
5
5
|
pyproject.toml
|
|
6
|
+
./__init__.py
|
|
7
|
+
./hebrew.py
|
|
8
|
+
./number.py
|
|
6
9
|
python_hebrew.egg-info/PKG-INFO
|
|
7
10
|
python_hebrew.egg-info/SOURCES.txt
|
|
8
11
|
python_hebrew.egg-info/dependency_links.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hebrew
|
python_hebrew-1.15/PKG-INFO
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: python-hebrew
|
|
3
|
-
Version: 1.15
|
|
4
|
-
Summary: Hebrew text and numeral utilities from Reuben Institute — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion
|
|
5
|
-
License-Expression: GPL-3.0-or-later
|
|
6
|
-
Requires-Python: >=3.8
|
|
7
|
-
Description-Content-Type: text/plain
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: regex
|
|
10
|
-
Dynamic: license-file
|
|
11
|
-
|
|
12
|
-
Hebrew text and numeral utilities from Reuben Institute — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion.
|
python_hebrew-1.15/README.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=68"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "python-hebrew"
|
|
7
|
-
version = "1.15"
|
|
8
|
-
description = "Hebrew text and numeral utilities from Reuben Institute — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion"
|
|
9
|
-
readme = { text = "Hebrew text and numeral utilities from Reuben Institute — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion.", content-type = "text/plain" }
|
|
10
|
-
license = "GPL-3.0-or-later"
|
|
11
|
-
requires-python = ">=3.8"
|
|
12
|
-
dependencies = [
|
|
13
|
-
"regex",
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
[tool.setuptools]
|
|
17
|
-
py-modules = ["Hebrew", "HebrewNumbers"]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: python-hebrew
|
|
3
|
-
Version: 1.15
|
|
4
|
-
Summary: Hebrew text and numeral utilities from Reuben Institute — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion
|
|
5
|
-
License-Expression: GPL-3.0-or-later
|
|
6
|
-
Requires-Python: >=3.8
|
|
7
|
-
Description-Content-Type: text/plain
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: regex
|
|
10
|
-
Dynamic: license-file
|
|
11
|
-
|
|
12
|
-
Hebrew text and numeral utilities from Reuben Institute — letter constants, transliteration helpers, and Hebrew numeral (gematria) conversion.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|