forked from Freely-Given-org/BibleOrgSys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hebrew.py
executable file
·517 lines (459 loc) · 21.7 KB
/
Hebrew.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Hebrew.py
#
# Module handling Hebrew language
#
# Copyright (C) 2011-2018 Robert Hunt
# Author: Robert Hunt <Freely.Given.org@gmail.com>
# License: See gpl-3.0.txt
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Module handling Hebrew language particularities.
"""
from gettext import gettext as _
LastModifiedDate = '2018-02-23' # by RJH
ShortProgName = "Hebrew"
ProgName = "Hebrew language handler"
ProgVersion = '0.08'
ProgNameVersion = '{} v{}'.format( ShortProgName, ProgVersion )
ProgNameVersionDate = '{} {} {}'.format( ProgNameVersion, _("last modified"), LastModifiedDate )
debuggingThisModule = False
import unicodedata
import BibleOrgSysGlobals
# Consonants
alef = 'א'
bet = 'ב'
gimel = 'ג'
dalet = 'ד'
he = 'ה'
waw = vav = 'ו'
zayin = 'ז'
het = 'ח'
tet = 'ט'
yod = 'י'
kaf = 'כ'
lamed = 'ל'
mem = 'מ'; memFinal = 'ם'
nun = 'נ'; nunFinal = 'ן'
samekh = 'ס'
ayin = 'ע'
pe = 'פ'
tsadi = 'צ'; tsadiFinal = 'ץ'
qof = 'ק'; qofFinal = 'ך'
resh = 'ר'
sinShin = 'ש'
taw = 'ת'
normalConsonants = ( alef, bet, gimel, dalet, he, waw, zayin, het, tet, yod, kaf, lamed, mem, nun, samekh, ayin, pe, tsadi, qof, resh, sinShin, taw, )
assert len(normalConsonants) == 22
finalConsonants = ( memFinal, nunFinal, tsadiFinal, qofFinal, )
consonants = normalConsonants + finalConsonants
allFinalConsonants = ( alef, bet, gimel, dalet, he, waw, zayin, het, tet, yod, kaf, lamed, memFinal, nunFinal, samekh, ayin, pe, tsadiFinal, qofFinal, resh, sinShin, taw, )
# Vowel points
sheva = shewa = 'ְ'
hatafSegol = 'ֱ'
hatafPatah = 'ֲ'
hatafQamats = 'ֳ'
hiriq = 'ִ'
tsere = 'ֵ'
segol = 'ֶ'
patah = 'ַ'
qamats = 'ָ'
holam = 'ֹ'
holamHaserForVav = 'ֺ'
qubuts = 'ֻ'
metegOrSiluq = 'ֽ' # But this is not ALWAYS a vowel point -- can also be a cantillation mark
vowelPoints = ( sheva, hatafSegol, hatafPatah, hatafQamats, hiriq, tsere, segol, patah, qamats, holam, holamHaserForVav, qubuts, )
# Other marks
dageshOrMapiq = 'ּ'
rafe = 'ֿ'
paseq = '׀'
shinDot = 'ׁ'
sinDot = 'ׂ'
upperDot = 'ׄ'
lowerDot = 'ׅ'
qamatzQatan = 'ׇ'
otherMarks = ( dageshOrMapiq, rafe, paseq, shinDot, sinDot, upperDot, lowerDot, qamatzQatan, )
# Cantillation marks
etnahta = '֑'
segolAccent = '֒'
shalshelet = '֓'
zaqefQatan = '֔'
zaqefGadol = '֕'
tipeha = '֖'
revia = '֗'
zarqa = '֘'
pashta = '֙'
yetiv = '֚'
tevir = '֛'
geresh = '֜'
gereshMuqdam = '֝'
gershayim = '֞'
qarneyPara = '֟'
telishaGedola = '֠'
pazer = '֡'
atnahHafukh = '֢'
munah = '֣'
mahapakh = '֤'
merkha = '֥'
merkhaKefula = '֦'
darga = '֧'
qadma = '֨'
telishaQetana = '֩'
yerahBenYomo = '֪'
ole = '֫'
iluy = '֬'
dehi = '֭'
zinor = '֮'
masoraCircle = '֯'
cantillationMarks = ( etnahta, segolAccent, shalshelet, zaqefQatan, zaqefGadol, tipeha, revia, zarqa, pashta, yetiv, tevir, \
geresh, gereshMuqdam, gershayim, qarneyPara, telishaGedola, pazer, atnahHafukh, munah, mahapakh, merkha, \
merkhaKefula, darga, qadma, telishaQetana, yerahBenYomo, ole, iluy, dehi, zinor, masoraCircle )
maqaf = '־'
sofPasuq = '׃'
# These substitutions are executed in the order given
# (so longer sequences should precede shorter ones)
BOS_HEBREW_TRANSLITERATION = (
(alef,''), (bet+dageshOrMapiq,'b'),(bet,'v'), (gimel+dageshOrMapiq,'g'),(gimel,'g'),
(dalet+dageshOrMapiq,'d'),(dalet,'d'),
(he+dageshOrMapiq,'h'),(he+qamats,'āh'),(he,'h'),
(waw+dageshOrMapiq,'u'),(waw+dageshOrMapiq,'ō'),(waw,'v'),
(zayin+dageshOrMapiq,'z'),(zayin,'z'),
(het+dageshOrMapiq,'ħ'),(het,'ħ'), (tet+dageshOrMapiq,'ŧ'),(tet,'ŧ'),
(yod+dageshOrMapiq,'u'),(yod,'y'), (kaf+dageshOrMapiq,'k'),(kaf,'k'),
(lamed+dageshOrMapiq,'l'),(lamed,'l'),
(mem+dageshOrMapiq,'m'),(mem,'m'), (memFinal+dageshOrMapiq,'m'),(memFinal,'m'),
(nun+dageshOrMapiq,'n'),(nun,'n'), (nunFinal+dageshOrMapiq,'n'),(nunFinal,'n'),
(samekh+dageshOrMapiq,'ş'),(samekh,'ş'), (ayin+dageshOrMapiq,''),(ayin,''),
(pe+dageshOrMapiq,'p'),(pe,'f'),
(tsadi+dageshOrMapiq,'ʦ'),(tsadi,'ʦ'), (tsadiFinal+dageshOrMapiq,'ʦ'),(tsadiFinal,'ʦ'),
(qof+dageshOrMapiq,'q'),(qof,'q'), (qofFinal+dageshOrMapiq,'q'),(qofFinal,'q'),
(resh+dageshOrMapiq,'r'),(resh,'r'),
(sinShin+shinDot,'sh'),(sinShin+sinDot,'s'), (taw+dageshOrMapiq,'t'),(taw,'t'),
(resh+dageshOrMapiq,'r'),(resh,'r'),
(sheva,'(ə)'),(hatafSegol,'e'),(segol,'e'),(hiriq,'i'),(tsere,'ē'),(patah,'a'),(qamats,'ā'),(holam,'o'),(qubuts,'u'),
#sheva = 'ְ'
#hatafSegol = 'ֱ'
#hatafPatah = 'ֲ'
#hatafQamats = 'ֳ'
#hiriq = 'ִ'
#tsere = 'ֵ'
#segol = 'ֶ'
#patah = 'ַ'
#qamats = 'ָ'
#holam = 'ֹ'
#holamHaserForVav = 'ֺ'
#qubuts = 'ֻ'
#metegOrSiluq = 'ֽ'
(metegOrSiluq,''),
(maqaf,'-'), (sofPasuq,'.'),
)
STANDARD_HEBREW_TRANSLITERATION = (
(alef,'ʾ'), (bet+dageshOrMapiq,'b'),(bet,'v'), (gimel+dageshOrMapiq,'g'),(gimel,'g'),
(dalet+dageshOrMapiq,'d'),(dalet,'d'),
(he+dageshOrMapiq,'h'),(he+qamats,'āh'),(he,'h'),
(waw+dageshOrMapiq,'u'),(waw+dageshOrMapiq,'ō'),(waw,'w'),
(zayin+dageshOrMapiq,'z'),(zayin,'z'),
(het+dageshOrMapiq,'ḥḥ'),(het,'ḥ'), (tet+dageshOrMapiq,'ŧ'),(tet,'ŧ'),
(yod+dageshOrMapiq,'yy'),(yod,'y'), (kaf+dageshOrMapiq,'k'),(kaf,'k'),
(lamed+dageshOrMapiq,'ll'),(lamed,'l'),
(mem+dageshOrMapiq,'mm'),(mem,'m'), (memFinal+dageshOrMapiq,'m'),(memFinal,'m'),
(nun+dageshOrMapiq,'nn'),(nun,'n'), (nunFinal+dageshOrMapiq,'n'),(nunFinal,'n'),
(samekh+dageshOrMapiq,'ş'),(samekh,'ş'), (ayin+dageshOrMapiq,''),(ayin,''),
(pe+dageshOrMapiq,'p'),(pe,'̄p'),
(tsadi+dageshOrMapiq,'ṣṣ'),(tsadi,'ṣ'), (tsadiFinal+dageshOrMapiq,'ṣṣ'),(tsadiFinal,'ṣ'),
(qof+dageshOrMapiq,'q'),(qof,'q'), (qofFinal+dageshOrMapiq,'q'),(qofFinal,'q'),
(resh+dageshOrMapiq,'r'),(resh,'r'),
(sinShin+shinDot,'š'),(sinShin+sinDot,'s'), (taw+dageshOrMapiq,'t'),(taw,'t'),
(resh+dageshOrMapiq,'r'),(resh,'r'),
(sheva,'(ə)'),(hatafSegol,'e'),(segol,'e'),(hiriq,'i'),(tsere,'ē'),(patah,'a'),
(qamats,'ā'),(holam,'o'),(qubuts,'u'),
#sheva = 'ְ'
#hatafSegol = 'ֱ'
#hatafPatah = 'ֲ'
#hatafQamats = 'ֳ'
#hiriq = 'ִ'
#tsere = 'ֵ'
#segol = 'ֶ'
#patah = 'ַ'
#qamats = 'ָ'
#holam = 'ֹ'
#holamHaserForVav = 'ֺ'
#qubuts = 'ֻ'
#metegOrSiluq = 'ֽ'
(metegOrSiluq,''),
(maqaf,'-'), (sofPasuq,'.'),
)
BOS_NAMES_HEBREW_TRANSLITERATION = (
(alef,''), (bet+dageshOrMapiq,'b'),(bet,'v'), (gimel+dageshOrMapiq,'g'),(gimel,'g'),
(dalet+dageshOrMapiq,'d'),(dalet,'d'),
(he+dageshOrMapiq,'h'),(he+qamats,'ah'),(he,'h'),
(waw+dageshOrMapiq,'u'),(waw+dageshOrMapiq,'ō'),(waw,'v'),
(zayin+dageshOrMapiq,'z'),(zayin,'z'),
(het+dageshOrMapiq,'ħ'),(het,'ħ'), (tet+dageshOrMapiq,'ŧ'),(tet,'ŧ'),
(yod+dageshOrMapiq,'u'),(yod,'y'), (kaf+dageshOrMapiq,'k'),(kaf,'k'),
(lamed+dageshOrMapiq,'l'),(lamed,'l'),
(mem+dageshOrMapiq,'m'),(mem,'m'), (memFinal+dageshOrMapiq,'m'),(memFinal,'m'),
(nun+dageshOrMapiq,'n'),(nun,'n'), (nunFinal+dageshOrMapiq,'n'),(nunFinal,'n'),
(samekh+dageshOrMapiq,'ş'),(samekh,'ş'), (ayin+dageshOrMapiq,''),(ayin,''),
(pe+dageshOrMapiq,'p'),(pe,'f'),
(tsadi+dageshOrMapiq,'ʦ'),(tsadi,'ʦ'), (tsadiFinal+dageshOrMapiq,'ʦ'),(tsadiFinal,'ʦ'),
(qof+dageshOrMapiq,'q'),(qof,'q'), (qofFinal+dageshOrMapiq,'q'),(qofFinal,'q'),
(resh+dageshOrMapiq,'r'),(resh,'r'),
(sinShin+shinDot,'sh'),(sinShin+sinDot,'s'), (taw+dageshOrMapiq,'t'),(taw,'t'),
(resh+dageshOrMapiq,'r'),(resh,'r'),
(sheva,'(ə)'),(hatafSegol,'e'),(segol,'e'),(hiriq,'i'),(tsere,'e'),(patah,'a'),(qamats,'a'),(holam,'o'),(qubuts,'u'),
#sheva = 'ְ'
#hatafSegol = 'ֱ'
#hatafPatah = 'ֲ'
#hatafQamats = 'ֳ'
#hiriq = 'ִ'
#tsere = 'ֵ'
#segol = 'ֶ'
#patah = 'ַ'
#qamats = 'ָ'
#holam = 'ֹ'
#holamHaserForVav = 'ֺ'
#qubuts = 'ֻ'
#metegOrSiluq = 'ֽ'
(metegOrSiluq,''),
(maqaf,'-'), (sofPasuq,'.'),
)
transliterationSchemes = { 'Default':BOS_HEBREW_TRANSLITERATION, 'Standard':STANDARD_HEBREW_TRANSLITERATION, 'Names':BOS_NAMES_HEBREW_TRANSLITERATION }
if BibleOrgSysGlobals.debugFlag and debuggingThisModule: # Check that our tables have no obvious errors
for j,letter in enumerate( consonants ):
#print( j, letter )
assert consonants.count(letter)==1
assert letter not in vowelPoints
assert letter not in otherMarks
assert letter not in cantillationMarks
for j,mark in enumerate( vowelPoints ):
#print( j, mark )
assert vowelPoints.count(mark)==1
assert mark not in consonants
assert mark not in otherMarks
assert mark not in cantillationMarks
for j,mark in enumerate( otherMarks ):
#print( j, mark )
assert otherMarks.count(mark)==1
assert mark not in consonants
assert mark not in vowelPoints
assert mark not in cantillationMarks
for j,mark in enumerate( cantillationMarks ):
#print( j, mark )
assert cantillationMarks.count(mark)==1
assert mark not in consonants
assert mark not in vowelPoints
assert mark not in otherMarks
BibleOrgSysGlobals.printUnicodeInfo( vowelPoints, "Vowel points" )
BibleOrgSysGlobals.printUnicodeInfo( cantillationMarks, "Cantillation marks" )
class Hebrew():
"""
Class for handling a Hebrew string.
"""
def __init__( self, text ):
""" Create an new Hebrew object. """
self.originalText = text
self.currentText = text
# end of Hebrew.__init__
def __str__( self ):
"""
This method returns the string representation of a Bible book code.
@return: the name of a Bible object formatted as a string
@rtype: string
"""
result = "Hebrew object"
result += ('\n' if result else '') + " " + _("Original = {!r}").format( self.originalText )
if self.currentText != self.originalText:
result += ('\n' if result else '') + " " + _("Current = {!r}").format( self.currentText )
return result
# end of Hebrew.__str__
def printUnicodeData( self, text=None ):
"""
"""
#print( "unicodedata", unicodedata.unidata_version )
if text is None: text = self.currentText
#def printUnicodeInfo( text, description ):
#print( "{}:".format( description ) )
for j,char in enumerate(text):
print( "{:2} {:04x} {} {!r} (cat={} bid={} comb={} mirr={})" \
.format(j, ord(char), unicodedata.name(char), char, unicodedata.category(char), unicodedata.bidirectional(char), unicodedata.combining(char), unicodedata.mirrored(char) ) )
# end of Hebrew.printUnicodeData
def verifyConsonantsOnly( self, text=None ):
"""
Check that we only have consonants left
"""
if text is None: text = self.currentText
haveError = False
textLength = len( text )
this = ( ' ', '־', )
for j,letter in enumerate(text):
if letter not in consonants and letter not in this:
print( "Found unexpected {!r} ({}) non-consonant at index {} in {!r}".format( letter, unicodedata.name(letter), j, text ) )
haveError = True
if letter in finalConsonants and j<textLength-1:
nextLetter = text[j+1]
if nextLetter not in this:
print( "Found unexpected {!r} ({}) final consonant before {!r} ({}) at index {} in {!r}".format( letter, unicodedata.name(letter), nextLetter, unicodedata.name(nextLetter), j, text ) )
haveError = True
return haveError
# end of Hebrew.verifyConsonantsOnly
def removeAllMetegOrSiluq( self, text=None ):
"""
"""
#print( "removeAllMetegOrSiluq( {!r} )".format( text ) )
if text is None: # Use our own text
self.currentText = self.removeAllMetegOrSiluq( self.currentText ) # recursive call
return self.currentText
# else we were given some text to process
text = text.replace( metegOrSiluq, '' )
return text
# end of Hebrew.removeAllMetegOrSiluq
def _removeMetegOrSiluq( self, text, asVowel ):
"""
It's actually often impossible to tell automatically which purpose this Unicode mark has.
"""
#print( "_removeMetegOrSiluq( {!r}, {} )".format( text, asVowel ) )
while text:
textLength = len( text )
madeChanges = False
for j,mark in enumerate(text):
if mark != metegOrSiluq: continue
previousMark = text[j-1] if j>0 else ''
nextMark = text[j+1] if j<textLength-1 else ''
if previousMark in ( patah, segol ) or nextMark in (): # Assume it's a vowel point meteg
if asVowel:
if BibleOrgSysGlobals.verbosityLevel > 2:
print( "Deleting (vowel point) meteg after {!r} ({}) and before {!r} ({})".format( previousMark, unicodedata.name(previousMark), nextMark, unicodedata.name(nextMark) ) )
text = text[:j] + text[j+1:]
madeChanges = True
break
else:
if BibleOrgSysGlobals.verbosityLevel > 2:
print( "Ignoring (vowel point) meteg/siluq after {!r} ({}) and before {!r} ({})".format( previousMark, unicodedata.name(previousMark), nextMark, unicodedata.name(nextMark) ) )
else: # it doesn't appear to be a vowel point meteg
if not asVowel:
if BibleOrgSysGlobals.verbosityLevel > 2:
print( "Deleting (cantillation mark) siluq after {!r} ({}) and before {!r} ({})".format( previousMark, unicodedata.name(previousMark), nextMark, unicodedata.name(nextMark) ) )
text = text[:j] + text[j+1:]
madeChanges = True
break
else:
if BibleOrgSysGlobals.verbosityLevel > 2:
print( "Ignoring (cantillation mark) meteg/siluq after {!r} ({}) and before {!r} ({})".format( previousMark, unicodedata.name(previousMark), nextMark, unicodedata.name(nextMark) ) )
if not madeChanges: break # Check for another meteg if we made any changes
return text
# end of Hebrew._removeMetegOrSiluq
def removeCantillationMarks( self, text=None, removeMetegOrSiluq=False ):
"""
Return the text with cantillation marks removed.
"""
#print( "removeMetegOrSiluq( {!r}, {} )".format( text, removeMetegOrSiluq ) )
if text is None: # Use our own text
self.currentText = self.removeCantillationMarks( self.currentText, removeMetegOrSiluq ) # recursive call
return self.currentText
# else we were given some text to process
if removeMetegOrSiluq: text = self._removeMetegOrSiluq( text, asVowel=False )
for cantillationMark in cantillationMarks: text = text.replace(cantillationMark, '')
return text
# end of Hebrew.removeCantillationMarks
def removeVowelPointing( self, text=None, removeMetegOrSiluq=False ):
"""
Return the text with cantillation marks removed.
"""
#print( "removeVowelPointing( {!r}, {} )".format( text, removeMetegOrSiluq ) )
if text is None: # Use our own text
self.currentText = self.removeVowelPointing( self.currentText ) # recursive call
return self.currentText
# else we were given some text to process
if removeMetegOrSiluq: text = self._removeMetegOrSiluq( text, asVowel=True )
for vowelPoint in vowelPoints: text = text.replace(vowelPoint, '') # Remove the easy vowel points
return text
# end of Hebrew.removeVowelPointing
def removeOtherMarks( self, text=None ):
"""
Return the text with other marks (like sin/shin marks) and any remaining metegOrSiluq removed.
"""
#print( "removeOtherMarks( {!r} )".format( text ) )
if text is None: # Use our own text
self.currentText = self.removeOtherMarks( self.currentText ) # recursive call
return self.currentText
# else we were given some text to process
text = self.removeAllMetegOrSiluq( text )
for otherMark in otherMarks: text = text.replace(otherMark, '')
return text
# end of Hebrew.removeOtherMarks
def transliterate( self, text=None, scheme=None ):
"""
Return a (roughly) transliterated version of the current text.
"""
if text is None: # Use our own text
outputText = self.transliterate( self.currentText, scheme=scheme )
return outputText
# else we were given some text to process
outputText = text
if scheme is None: scheme = 'Default'
assert scheme in ('Default','Standard','Names')
for h,tr in transliterationSchemes[scheme]: outputText = outputText.replace( h, tr )
return outputText
# end of Hebrew class
def demo():
"""
Main program to handle command line parameters and then run what they want.
"""
if BibleOrgSysGlobals.verbosityLevel > 0: print( ProgNameVersion )
# Demonstrate the Hebrew class
dan11 = "בִּשְׁנַ֣ת שָׁל֔וֹשׁ לְמַלְכ֖וּת יְהוֹיָקִ֣ים מֶֽלֶךְ־יְהוּדָ֑ה בָּ֣א נְבוּכַדְנֶאצַּ֧ר מֶֽלֶךְ־בָּבֶ֛ל יְרוּשָׁלִַ֖ם וַיָּ֥צַר עָלֶֽיהָ ׃"
dan12 = "וַיִּתֵּן֩ אֲדֹנָ֨י בְּיָד֜וֹ אֶת־יְהוֹיָקִ֣ים מֶֽלֶךְ־יְהוּדָ֗ה וּמִקְצָת֙ כְּלֵ֣י בֵית־הָֽאֱלֹהִ֔ים וַיְבִיאֵ֥ם אֶֽרֶץ־שִׁנְעָ֖ר בֵּ֣ית אֱלֹהָ֑יו וְאֶת־הַכֵּלִ֣ים הֵבִ֔יא בֵּ֖ית אוֹצַ֥ר אֱלֹהָֽיו ׃"
dan13 = "וַיֹּ֣אמֶר הַמֶּ֔לֶךְ לְאַשְׁפְּנַ֖ז רַ֣ב סָרִיסָ֑יו לְהָבִ֞יא מִבְּנֵ֧י יִשְׂרָאֵ֛ל וּמִזֶּ֥רַע הַמְּלוּכָ֖ה וּמִן־הַֽפַּרְתְּמִֽים ׃"
dan14 = "יְלָדִ֣ים אֲשֶׁ֣ר אֵֽין־בָּהֶ֣ם כָּל־מאום וְטוֹבֵ֨י מַרְאֶ֜ה וּמַשְׂכִּילִ֣ים בְּכָל־חָכְמָ֗ה וְיֹ֤דְעֵי דַ֙עַת֙ וּמְבִינֵ֣י מַדָּ֔ע וַאֲשֶׁר֙ כֹּ֣חַ בָּהֶ֔ם לַעֲמֹ֖ד בְּהֵיכַ֣ל הַמֶּ֑לֶךְ וּֽלֲלַמְּדָ֥ם סֵ֖פֶר וּלְשׁ֥וֹן כַּשְׂדִּֽים ׃"
dan15 = "וַיְמַן֩ לָהֶ֨ם הַמֶּ֜לֶךְ דְּבַר־י֣וֹם בְּיוֹמ֗וֹ מִפַּת־בַּ֤ג הַמֶּ֙לֶךְ֙ וּמִיֵּ֣ין מִשְׁתָּ֔יו וּֽלְגַדְּלָ֖ם שָׁנִ֣ים שָׁל֑וֹשׁ וּמִ֨קְצָתָ֔ם יַֽעַמְד֖וּ לִפְנֵ֥י הַמֶּֽלֶךְ ׃"
for string in ( dan11, dan12, dan13, dan14, dan15 ):
print()
h = Hebrew( string )
print( h )
print()
h.removeCantillationMarks()
print( "Removed cantillation marks" )
print( h )
msCount = h.currentText.count(metegOrSiluq)
if msCount: print( "{} meteg or siluq marks remaining".format( msCount ) )
print()
h.removeVowelPointing()
print( "Removed vowel pointing" )
print( h )
msCount = h.currentText.count(metegOrSiluq)
if msCount: print( "{} meteg or siluq marks remaining".format( msCount ) )
print()
h.removeOtherMarks()
print( "Removed other marks" )
print( h )
msCount = h.currentText.count(metegOrSiluq)
if msCount: print( "{} meteg or siluq marks remaining".format( msCount ) )
print()
h.verifyConsonantsOnly()
h = Hebrew( string )
h.removeCantillationMarks()
#h.printUnicodeData()
print( "Transliterated: {}".format( h.transliterate() ) )
# end of demo
if __name__ == '__main__':
# Configure basic set-up
parser = BibleOrgSysGlobals.setup( ProgName, ProgVersion )
BibleOrgSysGlobals.addStandardOptionsAndProcess( parser, exportAvailable=True )
demo()
BibleOrgSysGlobals.closedown( ProgName, ProgVersion )
# end of Hebrew.py