Skip to content

Commit

Permalink
Update transliterate for Library of Congress conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
ibleaman committed Feb 26, 2024
1 parent e37a6ca commit 9bf22c5
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion yiddish/yiddish.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,19 @@ def strip_diacritics(string): # and replace with decomposed
('־', '-'),
]

loc_translit_table = [ # all are precombined
('זש', 'zsh'),
('בּ', 'b'),
('װ', 'ṿ'),
('ח', 'ḥ'),
('ט', 'ṭ'),
('ק', 'ḳ'),
('שׂ', 'ś'),
('ת', 's̀'),
]

# if loshn_koydesh, look up string in LK dictionary
def transliterate(string, loshn_koydesh=False):
def transliterate(string, loshn_koydesh=False, loc=False):
romanized = replace_with_precombined(string)

if loshn_koydesh:
Expand All @@ -156,6 +167,10 @@ def transliterate(string, loshn_koydesh=False):

romanized = ''.join(new_tokens)

if loc:
for pair in loc_translit_table:
romanized = re.sub(pair[0], pair[1], romanized)

for pair in translit_table:
romanized = re.sub(pair[0], pair[1], romanized)

Expand Down

0 comments on commit 9bf22c5

Please sign in to comment.