All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Corrected an issue with subclasses of
BaseHebrewChar
where use of__eq__
would break when the type for the comparison was not the same as itself.
-
Added
Hebrew.normalize
, a function for normalizing the hebrew characters in a string. This is typically needed with text includes special hebrew characters.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.
In this case, the first letter is made up of 2 unicode characters, sin with a dot and qamatz. The issue here is the sin. By normalizing the sin with a dot to 2 unicode characters, ש and the dot, the display will look right!
To normalize content, use the
Hebrew.normalize
function:from hebrew import Hebrew hs = Hebrew('שָׂחַקְתִּי כְּמוֹ') assert len(hs.string) == 14 assert len(hs.normalize().string) == 18
By default, special yiddish characters such as ײ (double Yod) are not normalized. However, ײַ (double Yod with a Patah) will be converted to ײַ.
To fully "normalize" yiddish characters, pass
True
tonormalize
.
- New function
Hebrew.from_number
converts an int into its hebrew form
from hebrew import Hebrew
hs1 = Hebrew.from_number(2)
print(hs1) # ב׳
# Do not add punctuation
hs2 = Hebrew.from_number(2, geresh=False)
print(hs2) # ב
- Added 3.12 as a supported version
- Updated project dependencies.
- Removed 3.11 as a supported version
- Added 3.11 as a supported version
-
Added the remaining missing Gematria methods. The complete list of supported methods is:
ACHAS_BETA
ALBAM
ATBASH
AVGAD
AYAK_BACHAR
MISPAR_BONEEH
MISPAR_GADOL
MISPAR_HAACHOR
MISPAR_HAMERUBAH_HAKLALI
MISPAR_HECHRACHI
MISPAR_KATAN
MISPAR_KATAN_MISPARI
MISPAR_KIDMI
MISPAR_KOLEL
MISPAR_MESHULASH
MISPAR_MISPARI
MISPAR_MUSAFI
MISPAR_NEELAM
MISPAR_PERATI
MISPAR_SHEMI_MILUI
MISPAR_SIDURI
OFANIM
REVERSE_AVGAD
from hebrew import Hebrew from hebrew import GematriaTypes hs = Hebrew('בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃') print(hs.gematria()) # 2701 print(hs.gematria(GematriaTypes.MISPAR_GADOL)) # 4631
- Added Gematria methods
MISPAR_MUSAFI
. This is the first of the complex Gematria types that goes deeper than just adding up values assigned to each letter, necessitating internal changes to theHebrew
class.
- Added Gematria methods
MISPAR_KATAN
,MISPAR_PERATI
,ATBASH
,ALBAM
,MISPAR_MESHULASH
.
- Added a new gematria method,
MISPAR_SIDURI
.
- Added a new gematria method,
MISPAR_GADOL
. A contribution by Taber Andrew Bain
- Fixed an issue where
Hebrew.gematria
would through an error if the input string had no hebrew characters. In this case, we now return a value of 0.
- Split the
PunctuationChar
type chars intoTaamimChar
andOtherChar
types inhebrew.char
. - Renamed the
no_punctuation
method ofHebrew
tono_taamim
.
- Added the method
Hebrew.gematria
method for calculating the gematria of a string. - Added
mispar_hechrachi
as a supported gematria type.
>>> from hebrew import Hebrew
>>> from hebrew.gematria import GematriaTypes
>>> Hebrew("בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָרֶץ׃").gematria(GematriaTypes.MISPAR_HECHRACHI)
2701
- Added
hebrew.chars
with constants for Hebrew characters and classes to represent each letter. - Moved constants out of
Hebrew
and intohebrew.chars
. - Constant values, previously strings, are now instances of a class with metadata for each letter.
- Support for Python 3.6 was removed because we are now using
@dataclasse
. It is possible to make this work with 3.6 but I am choosing not to at this time. If this is a problem for you, feel free to open an issue.
- Renamed the python package from
hebrewstring
tohebrew
.
-
Added the
__eq__
method to theGraphemeString
object.This is to support the
==
operator when comparing twoGraphemeString
objects. -
Added the
__add__
method to theGraphemeString
object.This is to support the
+
operator when adding twoGraphemeString
objects together. -
Added the
__hash__
method to theGraphemeString
object.This is to support the
hash()
function for aGraphemeString
instance and allows it (as an example) to be used as adict
key.
- Added base code, tests, and examples for the first release.