Hebrew
Hebrew
ל
Bases: GraphemeString
A class representing a Hebrew String.
A Hebrew
string can contain pure Hebrew letters, or can be composed of any additional characters.
Source code in hebrew/hebrew_obj.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
|
from_number(number, punctuate=True, geresh=True, substitution_functions=Substitutions.DEFAULT)
classmethod
ל
Convert a number into its Hebrew letter form, returning it as an instance of Hebrew.
Parameters:
-
number
(int
) –The number to convert to Hebrew letters. Must be greater than 0...
-
punctuate
(bool
, default:True
) –Whether to add punctuation in the appropriate places.
-
geresh
(bool
, default:True
) –If punctuate is true, whether to use the unicode geresh or an apostrophe.
-
substitution_functions
(Optional[Tuple[Callable[[str], str], ...]]
, default:DEFAULT
) –A tuple of functions that replaces some hebrew values in the result with an appropriate equivalent. By default, "יה" and "יו" are replaced with "טו" and "טז" respectively. To replace all values such as שמד ,רע, and others, use
Substitutions.ALL
.
Returns:
-
–
Source code in hebrew/hebrew_obj.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
|
gematria(method=GematriaTypes.MISPAR_HECHRACHI, alt_letter_name_spelling=None)
ל
Returns the gematria of the string.
If the contains no hebrew characters, the value returned is 0. Mixing hebrew and english characters is ok!
Parameters:
-
method
(GematriaTypes
, default:MISPAR_HECHRACHI
) –The method to use for calculating the gematria.
-
alt_letter_name_spelling
(Dict[str, str]
, default:None
) –Used only with MISPAR_SHEMI_MILUI: A dict of alternate spellings for a letter that should be used to make the calculation. Eg:
{"ו": "ואו"}
.
Returns:
-
int
–
Source code in hebrew/hebrew_obj.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
|
no_maqaf()
ל
Replaces all maqafs with spaces.
This is useful for splitting a string into words when you want words connected by maqafs to be considered as one word. Example: You may think of "עַל־פְּנֵ֥י" as one word in some cases but want to split it into "עַל" and "פְּנֵי" in other cases.
Returns:
-
HebrewT
–
Source code in hebrew/hebrew_obj.py
66 67 68 69 70 71 72 73 74 75 |
|
no_niqqud()
ל
Removes all niqqud characters. This may be useful to practice reading from the torah.
Returns:
-
HebrewT
–
Source code in hebrew/hebrew_obj.py
112 113 114 115 116 117 118 119 120 121 122 |
|
no_sof_passuk()
ל
Removes all sof_passuk chars.
Returns:
-
HebrewT
–
Source code in hebrew/hebrew_obj.py
77 78 79 80 81 82 83 |
|
no_taamim(remove_maqaf=False, remove_sof_passuk=False)
ל
Removes all Ta'amim characters. Result is a string with just letters and Niqqud characters.
Parameters:
-
remove_maqaf
(bool
, default:False
) –Whether to remove the maqaf characters if they are encountered.
-
remove_sof_passuk
(bool
, default:False
) –Whether to remove the remove_sof_passuk character if they are encountered.
Returns:
-
HebrewT
–
Source code in hebrew/hebrew_obj.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
normalize(normalize_yiddish=False)
ל
Replaces all non-standard hebrew characters with their equivalent values using normal hebrew letters and symbols. This is important when using hebrew fonts. Some fonts may not support these special characters, normalization helps by changing all the characters to be ones that would be supported.
Parameters:
-
normalize_yiddish
(bool
, default:False
) –By default, yiddish characters are left alone since they are typically desired.
Returns:
-
HebrewT
–
Source code in hebrew/hebrew_obj.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
text_only(remove_maqaf=False)
ל
Returns a string with all non-letter characters removed. This will remove both niqqud and punctuation.
Parameters:
-
remove_maqaf
(bool
, default:False
) –Whether to remove the maqaf characters if they are encountered
Returns:
-
HebrewT
–
Source code in hebrew/hebrew_obj.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
words(split_maqaf=False)
ל
Splits the string into a list of words.
Parameters:
-
split_maqaf
(bool
, default:False
) –Whether to split a single word such as "עַל־פְּנֵ֥י" into "עַל" and "פְּנֵי" when a maqaf is encountered.
Returns:
-
List[HebrewT]
–
Source code in hebrew/hebrew_obj.py
85 86 87 88 89 90 91 92 93 |
|
get_hebrew_name(letter, name_dict)
ל
Helper function to get the letters name from the library definition or from the alts provided by the user.
The name value passed must be a name that is defined in the characters HebrewChar
instance or a
ValueError will be thrown. This is done to make sure that only valid naming is used.
Source code in hebrew/hebrew_obj.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|