Skip to content

Commit

Permalink
Add new set of languages; separate pre and post options in Aksharamuk…
Browse files Browse the repository at this point in the history
…ha. (#102)
  • Loading branch information
scossu authored May 13, 2024
1 parent ea31ab1 commit 368bb40
Show file tree
Hide file tree
Showing 14 changed files with 230 additions and 6 deletions.
18 changes: 12 additions & 6 deletions scriptshifter/hooks/aksharamukha/romanizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@
logger = getLogger(__name__)


def s2r_post_config(ctx, src_script):
def s2r_post_config(ctx, src_script, pre=[], post=[]):
# options = detect_preoptions(ctx.src, src_script)
options = [n for n, v in ctx.options.items() if v and n != "capitalize"]
ctx.dest = process(src_script, "IAST", ctx.src, pre_options=options)
pre_options = pre + [
n for n, v in ctx.options.items() if v and n != "capitalize"]
ctx.dest = process(
src_script, "RomanLoC", ctx.src,
pre_options=pre_options, post_options=post)

return BREAK


def r2s_post_config(ctx, dest_script):
options = [n for n, v in ctx.options.items() if v and n != "capitalize"]
ctx.dest = process("IAST", dest_script, ctx.src, post_options=options)
def r2s_post_config(ctx, dest_script, pre=[], post=[]):
post_options = post + [
n for n, v in ctx.options.items() if v and n != "capitalize"]
ctx.dest = process(
"RomanLoC", dest_script, ctx.src,
pre_options=pre, post_options=post_options)

return BREAK
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/gujarati.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Gujarati

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Gujarati"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Gujarati"
24 changes: 24 additions & 0 deletions scriptshifter/tables/data/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ greek_classical:
name: Greek (classical)
greek_modern:
name: Greek (modern)
gujarati:
name: Gujarati
hebrew:
name: Hebrew
hindi:
Expand All @@ -68,6 +70,8 @@ katakana:
name: Japanese (Katakana)
kalmyk_cyrillic:
name: Kalmyk (Cyrillic)
kannada:
name: Kannada
kara-kalpak_cyrillic:
name: Kara-Kalpak (Cyrillic)
karachai-balkar_cyrillic:
Expand All @@ -80,6 +84,8 @@ khakass_cyrillic:
name: Khakass (Cyrillic)
khanty_cyrillic:
name: Khanty (Cyrillic)
khmer:
name: Khmer
komi_cyrillic:
name: Komi (Cyrillic)
korean_nonames:
Expand All @@ -96,8 +102,12 @@ lithuanian_cyrillic:
name: Lithuanian (Cyrillic)
macedonian:
name: Macedonian
marathi:
name: Marathi (Devanagari)
mansi_cyrillic:
name: Mansi (Cyrillic)
malayalam:
name: Malayalam
moldovan_cyrillic:
name: Moldovan (Cyrillic)
mongolian_cyrillic:
Expand All @@ -108,8 +118,16 @@ mordvin_cyrillic:
name: Mordvin (Cyrillic)
nenets_cyrillic:
name: Nenets (Cyrillic)
oriya:
name: Oriya
ossetic_cyrillic:
name: Ossetic (Cyrillic)
pali:
name: Pali
panjabi:
name: Panjabi
prakrit:
name: Prakrit (Devanagari)
pulaar:
name: Pulaar (Adlam)
gurmukhi:
Expand All @@ -118,10 +136,14 @@ romani_cyrillic:
name: Romani (Cyrillic)
russian:
name: Russian
sanskrit:
name: Sanskrit (Devanagari)
serbian:
name: Serbian
shor_cyrillic:
name: Shor (Cyrillic)
sinhalese:
name: Sinhalese
syriac_cyrillic:
name: Syriac (Cyrillic)
tajik_cyrillic:
Expand All @@ -132,6 +154,8 @@ tamil_brahmi:
name: Tamil Brahmi
tamil_extended:
name: Tamil (extended)
telugu:
name: Telugu
thai:
name: Thai
tatar-kryashen_cyrillic:
Expand Down
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/kannada.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Kannada

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Kannada"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Kannada"
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/khmer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Khmer

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Khmer"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Khmer"
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/malayalam.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Khmer

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Khmer"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Khmer"
18 changes: 18 additions & 0 deletions scriptshifter/tables/data/marathi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
general:
name: Marathi (Devanagari)

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Devanagari"
- post: ["HindiMarathiRomanLoCFix"]

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Devanagari"
- pre: ["HindiMarathiRomanLoCFix"]
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/oriya.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Oriya

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Oriya"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Oriya"
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/pali.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Pali

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Pali"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Pali"
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/panjabi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Panjabi

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Punjabi"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Punjabi"
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/prakrit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Prakrit (Devanagari)

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Devanagari"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Devanagari"
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/sanskrit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Sanskrit (Devanagari)

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Devanagari"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Devanagari"
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/sinhalese.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Sinhalese

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Sinhala"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Sinhala"
16 changes: 16 additions & 0 deletions scriptshifter/tables/data/telugu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
general:
name: Telugu

script_to_roman:
hooks:
post_config:
-
- aksharamukha.romanizer.s2r_post_config
- src_script: "Telugu"

roman_to_script:
hooks:
post_config:
-
- aksharamukha.romanizer.r2s_post_config
- dest_script: "Telugu"

0 comments on commit 368bb40

Please sign in to comment.