scriptconv 0.0.4a153__tar.gz → 0.0.4a155__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scriptconv-0.0.4a153/scriptconv.egg-info → scriptconv-0.0.4a155}/PKG-INFO +1 -1
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/diacritics.py +101 -258
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/frontend.py +64 -118
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/ar.py +9 -21
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/ber.py +6 -11
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/dizione.py +13 -18
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/en.py +18 -95
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/eu.py +9 -21
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/g2pw.py +6 -4
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/he.py +2 -12
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/ja.py +7 -28
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/lir.py +1 -12
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/mul.py +90 -265
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/mwl.py +7 -12
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/o2ipa.py +29 -40
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/pt.py +11 -26
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/ru.py +29 -51
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/zh.py +26 -147
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/version.py +1 -1
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155/scriptconv.egg-info}/PKG-INFO +1 -1
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/LICENSE +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/README.md +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/pyproject.toml +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/__main__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/cangjie.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/conventions.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/data/LICENSE.cangjie5 +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/data/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/data/cangjie5_tc.tsv.gz +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/graph.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/notation.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_identity_cache.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_moved.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_revision.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/LICENSE.f5tts +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/LICENSE.hangul_to_ipa +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/bw2ipa.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/LICENSE +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/UPSTREAM.md +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/__main__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/align.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.cmudict +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.homograph-data +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/built/align.json +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/built/g2p.json +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/built/g2p.npz +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/built/homographs.json +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/built/lexicon.json +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/built/lexicon.tsv +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/built/sources.json +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/convert.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/data/abbreviations.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/data/chat.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/data/endings.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/data/exceptions.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/data/function_words.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/data/homograph_fixes.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/data/homograph_rules.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/data/letters.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/data/phrases.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/data/units.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/engine.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/g2p.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/homographs.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/morphology.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/normalize.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/sentence.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/symbols.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/dizione/tables.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/f5tts.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/g2pw/LICENSE +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/g2pw/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/g2pw/bert-base-chinese_s2t_dict.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/g2pw/bopomofo_to_pinyin_wo_tune_dict.json +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/g2pw/char_bopomofo_dict.json +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/hangul2ipa.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/ko_tables/aspiration.csv +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/ko_tables/assimilation.csv +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/ko_tables/double_coda.csv +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/ko_tables/hanja.tsv +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/ko_tables/ipa.csv +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/ko_tables/neutralization.csv +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/ko_tables/tensification.csv +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/ko_tables/yale.csv +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/leokani/LICENSE +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/leokani/LICENSE-CC-BY-4.0.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/leokani/NOTICE +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/leokani/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/leokani/leokani_g2p.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/nakdimon/LICENSE +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/nakdimon/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/nemo/NOTICE +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/shami/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/shami/codeswitch.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/shami/diacritize.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/shami/dialectal.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/shami/english_g2p.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/shami/espeak.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/shami/frontend.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/shami/levantine_g2p.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/shami/normalize.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/shami/phoneme_inventory.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/vosk_g2p.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_thirdparty/zh_num.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_vendored/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_vendored/matoub_kab/LICENSE.md +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/_vendored/matoub_kab/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/africa.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/base.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/enums.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/f5tts.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/fa.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/ghana.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/gl.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/ko.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/leokani.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/nemo_ipa.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/openjtalk_engine.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/registry.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/shami.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/phonemizers/vi.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/py.typed +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/readings.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/scripts.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/testing/__init__.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/testing/compare.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv/translit.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv.egg-info/SOURCES.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv.egg-info/dependency_links.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv.egg-info/requires.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/scriptconv.egg-info/top_level.txt +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/setup.cfg +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_arabic_diacritics_routing.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_arpa_stress.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_backend_table.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_byt5_lang_prefix.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_cangjie.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_charsiu_match_tags.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_cli.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_conventions.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_core_imports.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_diacritics.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_diacritics_graph.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_diacritics_nakdimon.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_diacritics_nfd_letters.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_doc_pages.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_errors_policy.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_examples.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_frontend.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_frontend_chunks.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_frontend_join.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_frontend_order.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_frontend_phonemizer_lang.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_frontend_say_as.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_frontend_stage_edges.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_graph.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_graph_lossless.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_gruut_lexicon_cache.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_he_extra_declares_phonikud.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_identity_cache.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_lang_default_region.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_match_lang_direction.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_match_lang_preferred_value.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_notation.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_notation_sources.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_notation_strict.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_openjtalk_engine.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_base.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_cjk_ar.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_copyleft_he_ja_th.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_dizione.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_dizione_long_tokens.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_epitran_english.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_epitran_japanese.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_epitran_korean.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_espeak_lt_accent.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_eu_euskaphone.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_f5tts.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_friendly_import_errors.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_g2pw.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_goruut_marks.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_goruut_server.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_grapheme_arguments.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_identity.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_kolokwa.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_leokani.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_marks.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_matoub_kab.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_mwl_barranquenho.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_nemo_ipa.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_o2i_lexicons.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_phonetisaurus.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_phonetisaurus_engine.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_pt_tugaphone.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_punctuation.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_ru.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_shami_digit_runs.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_phonemizers_shami_inventory.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_readings_zh.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_scripts.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_scripts_stressonnx_compat.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_sister_packages.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_stress_marks.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_testing_compare.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_translit.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_tugaphone_identity_no_revision.py +0 -0
- {scriptconv-0.0.4a153 → scriptconv-0.0.4a155}/tests/test_wheel_licences.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scriptconv
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4a155
|
|
4
4
|
Summary: The one stop for text conversion: a zero-dependency script & phoneme-notation core — ISO-15924 detection & metadata, IPA↔ARPABET/X-SAMPA/Lexique/Kirshenbaum/Cotovía/RFE, Buckwalter↔Arabic, Hangul→jamo, kana — with phonemizer integrations behind optional extras
|
|
5
5
|
License-Expression: Apache-2.0 AND MIT AND LicenseRef-CMUdict
|
|
6
6
|
Project-URL: Homepage, https://github.com/TigreGotico/scriptconv
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
"""Diacritization:
|
|
2
|
-
|
|
3
|
-
This module OWNS diacritization — lang→backend routing, lazy/cached backend
|
|
4
|
-
loading (phonikud, text2tashkeel, stressonnx, bifonia), and the overlay-strip
|
|
5
|
-
helpers. :mod:`scriptconv.phonemizers` (``BasePhonemizer`` and subclasses)
|
|
6
|
-
runs no diacritizer: phonemization (orthography → sound) and diacritization
|
|
7
|
-
(a text → text graph transform disambiguating pronunciation before G2P) are
|
|
8
|
-
separate concerns. A backend only removes, through
|
|
9
|
-
:func:`replace_stress_mark`, a stress mark that it does not read.
|
|
1
|
+
"""Diacritization: language routing, cached backends, and the graph edges.
|
|
10
2
|
|
|
11
3
|
Diacritization (Arabic tashkeel, Hebrew niqqud, East-Slavic/Turkic/Caucasian
|
|
12
|
-
word stress, European-Portuguese homograph sense marks)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
:func:`scriptconv.phonemizers.register`
|
|
16
|
-
|
|
4
|
+
word stress, European-Portuguese homograph sense marks) maps the ``"text"``
|
|
5
|
+
node to a lang-contextual ``"text-diacritized"`` node. Phonemizers run no
|
|
6
|
+
diacritizer; a backend only removes, through :func:`replace_stress_mark`, a
|
|
7
|
+
stress mark that it does not read. Like :func:`scriptconv.phonemizers.register`
|
|
8
|
+
the edges are opt-in, so ``DEFAULT_GRAPH`` stays free of them::
|
|
17
9
|
|
|
18
10
|
from scriptconv.graph import DEFAULT_GRAPH
|
|
19
11
|
from scriptconv import diacritics, phonemizers
|
|
@@ -25,33 +17,20 @@ free of it until a caller extends a graph::
|
|
|
25
17
|
g.convert("Tenho muita sede hoje.", "text", "text-diacritized", lang="pt")
|
|
26
18
|
# 'Tenho muita sêde hoje.'
|
|
27
19
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Arabic
|
|
42
|
-
removes only the specific overlay codepoints each backend adds (combining
|
|
43
|
-
acute/grave for stress, tashkeel for Arabic, niqqud for Hebrew) — never a
|
|
44
|
-
blanket combining-mark filter — so precomposed native letters survive
|
|
45
|
-
(Cyrillic й/ё, Latvian macrons, Azerbaijani ç/ö, Arabic hamza carriers أ إ آ ؤ
|
|
46
|
-
ئ). The gate asks linguatag which tags name Arabic in Arabic script, and
|
|
47
|
-
matches the other primary subtags exactly, so Aragonese (``arg``), Herero
|
|
48
|
-
(``her``), Mapudungun (``arn``) etc. are never misread as Arabic/Hebrew.
|
|
49
|
-
Languages whose diacritics are native orthography (European Portuguese, via
|
|
50
|
-
bifonia) refuse the strip with :class:`ValueError` instead of silently
|
|
51
|
-
corrupting the spelling (``café`` must never become ``cafe``). This split
|
|
52
|
-
tracks which backend/model produced the marks: overlay backends (phonikud,
|
|
53
|
-
tashkeel, stressonnx) are strippable; spelling-integral backends (bifonia) are
|
|
54
|
-
not.
|
|
20
|
+
The diacritization edge is model-based (``lossless=False``), so ``"text" ->
|
|
21
|
+
"ipa"`` keeps the direct phonemization edge; the diacritized route is taken
|
|
22
|
+
only when a caller asks for ``"text-diacritized"``.
|
|
23
|
+
|
|
24
|
+
The strip edge (``"text-diacritized" -> "text"``) exists only for overlay
|
|
25
|
+
diacritics: Arabic/Hebrew vocalization (text2tashkeel, phonikud) and stress
|
|
26
|
+
(stressonnx). It removes only the codepoints each backend adds, never every
|
|
27
|
+
combining mark, so precomposed native letters survive (Cyrillic й/ё, Latvian
|
|
28
|
+
macrons, Azerbaijani ç/ö, Arabic hamza carriers أ إ آ ؤ ئ). Diacritics that
|
|
29
|
+
are native orthography (European Portuguese, via bifonia) refuse the strip
|
|
30
|
+
with :class:`ValueError`, as ``café`` must never become ``cafe``. Arabic is
|
|
31
|
+
decided by linguatag and the other families by exact primary subtag, so
|
|
32
|
+
Aragonese (``arg``), Herero (``her``) and Mapudungun (``arn``) are never read
|
|
33
|
+
as Arabic or Hebrew.
|
|
55
34
|
|
|
56
35
|
A stress mark and a letter-forming mark can be the same codepoint. In NFD text
|
|
57
36
|
the Macedonian letters ѓ and ќ are г and к followed by U+0301, the codepoint
|
|
@@ -99,23 +78,14 @@ from scriptconv.phonemizers.base import (
|
|
|
99
78
|
|
|
100
79
|
LOG = logging.getLogger(__name__)
|
|
101
80
|
|
|
102
|
-
#: The lang-contextual node produced by diacritization
|
|
103
|
-
#: meaningful only with ``lang=`` context and exists only in opted-in graphs.
|
|
81
|
+
#: The lang-contextual node produced by diacritization; it exists only in opted-in graphs.
|
|
104
82
|
DIACRITIZED = "text-diacritized"
|
|
105
83
|
|
|
106
|
-
#
|
|
107
|
-
#
|
|
108
|
-
#
|
|
109
|
-
#
|
|
110
|
-
#
|
|
111
|
-
# — Russian unstressed "о" surfaces as [ɐ] or [ə] depending on distance from
|
|
112
|
-
# the stress, not [o] — so a wrong or missing mark there corrupts the vowel
|
|
113
|
-
# quality of the whole word, not just its prosody. Other families in this set
|
|
114
|
-
# don't necessarily reduce vowels, but still need the mark for correct stress
|
|
115
|
-
# placement and prosody. stressonnx restores it as a combining acute (U+0301)
|
|
116
|
-
# after the stressed vowel, covering 26 BCP-47 tags across these families
|
|
117
|
-
# (24 primary subtags; Azerbaijani and Uzbek each have Cyrillic/Latin script
|
|
118
|
-
# variants routed by the full tag).
|
|
84
|
+
# Languages with free word stress that ordinary spelling leaves unwritten. In
|
|
85
|
+
# East Slavic unstressed vowels also reduce (Russian unstressed "о" is [ɐ] or
|
|
86
|
+
# [ə]), so a missing mark changes vowel quality. stressonnx writes a combining
|
|
87
|
+
# acute (U+0301) after the stressed vowel for 26 BCP-47 tags over these 24 primary
|
|
88
|
+
# subtags; az and uz each have a Cyrillic and a Latin variant.
|
|
119
89
|
STRESS_LANGS = {
|
|
120
90
|
"az", "ba", "be", "bg", "cv", "hy", "ka", "kbd", "kjh", "kk", "ky", "lv",
|
|
121
91
|
"mdf", "mk", "myv", "ru", "sah", "sl", "tg", "tt", "udm", "uk", "uz", "xal",
|
|
@@ -123,15 +93,10 @@ STRESS_LANGS = {
|
|
|
123
93
|
|
|
124
94
|
|
|
125
95
|
def _is_european_portuguese(lang: str) -> bool:
|
|
126
|
-
"""True for a tag
|
|
127
|
-
|
|
128
|
-
That is ``pt``, ``pt-PT`` in any case or separator, ``pt-Latn-PT``,
|
|
129
|
-
``por``, and the European Portuguese lects (``pt-PT-x-porto``,
|
|
130
|
-
``pt-PT-x-lisbon``). ``pt-BR``, ``pt-AO``, ``pt-MZ`` and every other
|
|
131
|
-
language are at a larger distance and return False.
|
|
96
|
+
"""True for a tag at linguatag distance 0 from ``pt-PT``: ``pt``, ``por`` and the European lects, not ``pt-BR``.
|
|
132
97
|
|
|
133
|
-
Only a ``pt`` or ``por`` primary subtag
|
|
134
|
-
|
|
98
|
+
Only a ``pt`` or ``por`` primary subtag loads linguatag, so other callers
|
|
99
|
+
do not need the ``phonemizers`` extra.
|
|
135
100
|
"""
|
|
136
101
|
if _primary_subtag(lang) not in ("pt", "por"):
|
|
137
102
|
return False
|
|
@@ -153,18 +118,14 @@ _ARABIC_SCRIPT_DISTANCE = 5
|
|
|
153
118
|
def _is_arabic_script_arabic(lang: str) -> bool:
|
|
154
119
|
"""True for a tag that names Arabic, or a variety of Arabic, in Arabic script.
|
|
155
120
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
ISO 639-1 gives Arabic one two-letter code, ``ar``, and every individual
|
|
165
|
-
Arabic language has a three-letter code. So any other two-letter primary
|
|
166
|
-
subtag returns False before linguatag loads, and a caller that asks for
|
|
167
|
-
``en`` or ``he`` does not need the ``phonemizers`` extra.
|
|
121
|
+
``is_arabic_variety`` names the language (``ar``, the ISO 639-3 ``ara``
|
|
122
|
+
macrolanguage, Hassaniyya ``mey``); ``lang_distance`` to ``ar`` adds the
|
|
123
|
+
script, because tashkeel marks only Arabic script. So ``ar-Latn``, and
|
|
124
|
+
``acy`` and ``pga``, which CLDR writes in Latin script, return False, as do
|
|
125
|
+
Persian and Urdu.
|
|
126
|
+
|
|
127
|
+
ISO 639-1 gives Arabic one two-letter code, ``ar``, so any other two-letter
|
|
128
|
+
subtag returns False before linguatag loads.
|
|
168
129
|
"""
|
|
169
130
|
p = _primary_subtag(lang)
|
|
170
131
|
if len(p) == 2 and p != "ar":
|
|
@@ -179,26 +140,16 @@ def _is_arabic_script_arabic(lang: str) -> bool:
|
|
|
179
140
|
and lang_distance(lang, "ar") <= _ARABIC_SCRIPT_DISTANCE)
|
|
180
141
|
|
|
181
142
|
|
|
182
|
-
#: Primary subtags
|
|
183
|
-
#: bare tag is servable — stressonnx only ships script-qualified variants
|
|
184
|
-
#: (az-Cyrl/az-Latn, uz-Cyrl/uz-Latn) for these, so the bare tag is script-
|
|
185
|
-
#: ambiguous. Used both by the real stressonnx-backed check and by the
|
|
186
|
-
#: no-extra-installed fallback, so the two never disagree.
|
|
143
|
+
#: Primary subtags that stressonnx serves only with a script subtag (az-Cyrl, uz-Latn, ...).
|
|
187
144
|
_SCRIPT_AMBIGUOUS_STRESS_LANGS = frozenset({"az", "uz"})
|
|
188
145
|
|
|
189
146
|
|
|
190
147
|
def _is_stress_lang_fallback(lang: str) -> bool:
|
|
191
|
-
"""
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
a member whose primary subtag isn't script-ambiguous is accepted; a
|
|
196
|
-
4-letter script subtag is only meaningful for the script-ambiguous pair
|
|
197
|
-
(az/uz) and must be Cyrl/Latn; every other script-qualified tag, and
|
|
198
|
-
every bare az/uz, is rejected rather than guessed at.
|
|
148
|
+
""":func:`_is_stress_lang` without stressonnx installed, by the same resolution rules.
|
|
149
|
+
|
|
150
|
+
az and uz need a Cyrl or Latn script subtag; every other member takes no
|
|
151
|
+
script subtag.
|
|
199
152
|
"""
|
|
200
|
-
if not isinstance(lang, str):
|
|
201
|
-
return False
|
|
202
153
|
normalized = lang.replace("_", "-")
|
|
203
154
|
parts = normalized.split("-")
|
|
204
155
|
p = parts[0].lower()
|
|
@@ -211,24 +162,10 @@ def _is_stress_lang_fallback(lang: str) -> bool:
|
|
|
211
162
|
|
|
212
163
|
|
|
213
164
|
def _is_stress_lang(lang: str) -> bool:
|
|
214
|
-
"""True if stressonnx
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
:func:`
|
|
218
|
-
re-deriving the resolution rules here, so this and the real call can
|
|
219
|
-
never disagree — e.g. a bare ``"az"``/``"uz"`` is script-ambiguous and
|
|
220
|
-
stressonnx rejects it even though ``"az"``/``"uz"`` are primary subtags
|
|
221
|
-
of a ``STRESS_LANGS`` member, while a regional tag like ``"ru-RU"``
|
|
222
|
-
resolves fine to ``"ru"``. Only reached once :func:`_diacritizer_family`
|
|
223
|
-
has already matched the primary subtag against ``STRESS_LANGS``, so
|
|
224
|
-
non-stress tags (``en``, ``pt`` …) never pay for the stressonnx import
|
|
225
|
-
or the exception-based resolution.
|
|
226
|
-
|
|
227
|
-
Falls back to :func:`_is_stress_lang_fallback` — the same script-
|
|
228
|
-
ambiguity rule, evaluated without importing stressonnx — when the
|
|
229
|
-
optional ``[stress]`` extra isn't installed, so ``pip install
|
|
230
|
-
scriptconv[stress]`` changes only whether generation *works*, never
|
|
231
|
-
which tags are claimed as stress-family.
|
|
165
|
+
"""True if stressonnx's own ``resolve_lang`` resolves *lang* to a model.
|
|
166
|
+
|
|
167
|
+
A bare ``az`` or ``uz`` does not resolve; ``ru-RU`` does. Without the
|
|
168
|
+
``stress`` extra, :func:`_is_stress_lang_fallback` gives the same answer.
|
|
232
169
|
"""
|
|
233
170
|
try:
|
|
234
171
|
from stressonnx import ALL_LANGS
|
|
@@ -244,23 +181,11 @@ def _is_stress_lang(lang: str) -> bool:
|
|
|
244
181
|
|
|
245
182
|
|
|
246
183
|
def _diacritizer_family(lang: str) -> Optional[str]:
|
|
247
|
-
"""
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
membership, not stressonnx's stricter script-resolution rules, because
|
|
253
|
-
stripping needs no model and every ``STRESS_LANGS`` member (bare az/uz
|
|
254
|
-
included) writes its overlay marks the same way regardless of script
|
|
255
|
-
ambiguity. :func:`diacritize`'s *generation* path narrows the "stress"
|
|
256
|
-
result further through :func:`_is_stress_lang` before actually calling
|
|
257
|
-
stressonnx, since only that path needs the real resolution. Returns one
|
|
258
|
-
of ``"he"`` (niqqud), ``"ar"`` (tashkeel), ``"stress"`` (stressonnx),
|
|
259
|
-
``"pt"`` (bifonia sense diacritics), or ``None``. Hebrew and stress use
|
|
260
|
-
exact primary-subtag matching (never ``startswith``), so Herero (``her``)
|
|
261
|
-
is never misread as Hebrew. Arabic is decided by linguatag (see
|
|
262
|
-
:func:`_is_arabic_script_arabic`), so Aragonese (``arg``) and Mapudungun
|
|
263
|
-
(``arn``) are never misread as Arabic.
|
|
184
|
+
"""The diacritizer family of *lang*: ``"he"``, ``"ar"``, ``"stress"``, ``"pt"`` or ``None``.
|
|
185
|
+
|
|
186
|
+
``"stress"`` is any ``STRESS_LANGS`` primary subtag, bare az/uz included,
|
|
187
|
+
as stripping needs no model; :func:`diacritize` narrows it through
|
|
188
|
+
:func:`_is_stress_lang` before it calls stressonnx.
|
|
264
189
|
"""
|
|
265
190
|
p = _primary_subtag(lang)
|
|
266
191
|
if p == "he":
|
|
@@ -287,24 +212,17 @@ _DEFAULT_DIACRITIZER_MODEL = "rawi-ensemble"
|
|
|
287
212
|
_PHONIKUD_CACHE: dict = {} # resolved model path/string -> Phonikud instance
|
|
288
213
|
_TASHKEEL_CACHE: dict = {} # (model name, waqf) -> text2tashkeel Diacritizer
|
|
289
214
|
|
|
290
|
-
#
|
|
291
|
-
# — unlike the large/licensed models behind mul.py's ByT5/Charsiu backends —
|
|
292
|
-
# scriptconv auto-provisions it: no local path is required unless the caller
|
|
293
|
-
# wants to override the cache (e.g. an air-gapped host).
|
|
215
|
+
# A small public model, so scriptconv downloads it on first use.
|
|
294
216
|
_PHONIKUD_URL = "https://huggingface.co/thewh1teagle/phonikud-onnx/resolve/main/phonikud-1.0.int8.onnx"
|
|
295
217
|
|
|
296
218
|
|
|
297
219
|
def _default_phonikud_model() -> str:
|
|
298
|
-
"""
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
download is written to a temp file
|
|
305
|
-
in the same directory and atomically moved into place via
|
|
306
|
-
:func:`os.replace`, so a failed or interrupted download never leaves a
|
|
307
|
-
partial file at the destination path.
|
|
220
|
+
"""The path of the default phonikud model, downloaded on first use.
|
|
221
|
+
|
|
222
|
+
The cache is ``<base>/scriptconv/phonikud``, with ``<base>`` from
|
|
223
|
+
``$SCRIPTCONV_CACHE``, else ``$XDG_CACHE_HOME``, else ``~/.cache``. The
|
|
224
|
+
download goes to a temporary file that replaces the destination only when
|
|
225
|
+
complete.
|
|
308
226
|
"""
|
|
309
227
|
base = os.environ.get("SCRIPTCONV_CACHE") or os.environ.get(
|
|
310
228
|
"XDG_CACHE_HOME", os.path.expanduser("~/.cache"))
|
|
@@ -315,10 +233,7 @@ def _default_phonikud_model() -> str:
|
|
|
315
233
|
fd, tmp_path = tempfile.mkstemp(dir=str(cache_dir), prefix=".phonikud-", suffix=".tmp")
|
|
316
234
|
try:
|
|
317
235
|
with os.fdopen(fd, "wb") as tmp_f, urllib.request.urlopen(_PHONIKUD_URL) as resp:
|
|
318
|
-
while
|
|
319
|
-
chunk = resp.read(1024 * 1024)
|
|
320
|
-
if not chunk:
|
|
321
|
-
break
|
|
236
|
+
while chunk := resp.read(1024 * 1024):
|
|
322
237
|
tmp_f.write(chunk)
|
|
323
238
|
os.replace(tmp_path, dest)
|
|
324
239
|
except BaseException:
|
|
@@ -329,16 +244,7 @@ def _default_phonikud_model() -> str:
|
|
|
329
244
|
|
|
330
245
|
|
|
331
246
|
def _phonikud(phonikud_model=None):
|
|
332
|
-
"""
|
|
333
|
-
|
|
334
|
-
``phonikud_model`` is optional: a local path to a phonikud ONNX model, or
|
|
335
|
-
a zero-arg callable resolving one lazily. When omitted, scriptconv
|
|
336
|
-
auto-provisions the small public phonikud model, downloading it once into
|
|
337
|
-
a cache dir (see :func:`_default_phonikud_model`) and reusing it on
|
|
338
|
-
subsequent calls. Pass an explicit path/callable to override — e.g. to
|
|
339
|
-
point at a model already on disk, or on an air-gapped host. Install
|
|
340
|
-
phonikud-onnx with ``pip install scriptconv[he]`` (or ``pip install
|
|
341
|
-
phonikud-onnx``)."""
|
|
247
|
+
"""The cached phonikud instance of *phonikud_model*: a path, a zero-arg callable that gives one, or ``None`` for the default model."""
|
|
342
248
|
model = phonikud_model() if callable(phonikud_model) else phonikud_model
|
|
343
249
|
if not model:
|
|
344
250
|
model = _default_phonikud_model()
|
|
@@ -466,13 +372,7 @@ def _nakdimon(text: str) -> str:
|
|
|
466
372
|
|
|
467
373
|
|
|
468
374
|
def _tashkeel(model: Optional[str] = None, waqf: bool = False):
|
|
469
|
-
"""
|
|
470
|
-
|
|
471
|
-
text2tashkeel is a dependency of the ``[ar]`` extra; it restores hamza and the
|
|
472
|
-
dagger alef in addition to the standard marks. With ``waqf=True`` the
|
|
473
|
-
Diacritizer drops the case and mood endings and gives the pausal form.
|
|
474
|
-
Install with ``pip install scriptconv[tashkeel]`` (or ``pip install
|
|
475
|
-
text2tashkeel``)."""
|
|
375
|
+
"""The cached text2tashkeel Diacritizer; ``waqf=True`` gives the pausal form, without case and mood endings."""
|
|
476
376
|
model = model or _DEFAULT_DIACRITIZER_MODEL
|
|
477
377
|
key = (model, waqf)
|
|
478
378
|
if key not in _TASHKEEL_CACHE:
|
|
@@ -488,13 +388,7 @@ def _tashkeel(model: Optional[str] = None, waqf: bool = False):
|
|
|
488
388
|
|
|
489
389
|
|
|
490
390
|
def _stress(text: str, lang: str, model: Optional[str] = None) -> str:
|
|
491
|
-
"""
|
|
492
|
-
it covers (see ``STRESS_LANGS``) — East Slavic, Bulgarian/Macedonian/
|
|
493
|
-
Slovene, Latvian, Armenian, Georgian, and Turkic/Caucasian languages.
|
|
494
|
-
|
|
495
|
-
stressonnx is not on PyPI yet; install straight from source. Install
|
|
496
|
-
with ``pip install scriptconv[stress]`` (or ``pip install
|
|
497
|
-
stressonnx``)."""
|
|
391
|
+
"""*text* with word stress from stressonnx."""
|
|
498
392
|
try:
|
|
499
393
|
from stressonnx import stress
|
|
500
394
|
except ImportError as e:
|
|
@@ -506,15 +400,10 @@ def _stress(text: str, lang: str, model: Optional[str] = None) -> str:
|
|
|
506
400
|
|
|
507
401
|
|
|
508
402
|
def _sense_diacritics_pt(text: str, lang: str) -> str:
|
|
509
|
-
"""European-Portuguese
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
"
|
|
513
|
-
vowel diacritic. These are ordinary Portuguese orthographic marks,
|
|
514
|
-
chosen so any downstream G2P — rule-based, neural, or espeak —
|
|
515
|
-
reads them correctly. *lang* goes to bifonia unchanged, so a lect tag
|
|
516
|
-
such as ``pt-PT-x-porto`` reaches bifonia's per-lect rows. Install with
|
|
517
|
-
``pip install scriptconv[pt]`` (or ``pip install bifonia``)."""
|
|
403
|
+
"""*text* with bifonia's open or closed vowel marks on European-Portuguese homographs, as "sêde" (thirst).
|
|
404
|
+
|
|
405
|
+
*lang* goes to bifonia unchanged, so a lect tag reaches its per-lect rows.
|
|
406
|
+
"""
|
|
518
407
|
try:
|
|
519
408
|
from bifonia import add_extra_diacritics
|
|
520
409
|
except ImportError as e:
|
|
@@ -535,42 +424,26 @@ def diacritize(text: str, lang: str = "und", diacritizer_model=None,
|
|
|
535
424
|
waqf: Optional[bool] = None, **kwargs) -> str:
|
|
536
425
|
"""Add pronunciation-disambiguating diacritics to *text* for *lang*.
|
|
537
426
|
|
|
538
|
-
``diacritizer_model
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
- East Slavic, Bulgarian/Macedonian/Slovene, Latvian, Armenian, Georgian,
|
|
558
|
-
and Turkic/Caucasian languages (``STRESS_LANGS``, 26 stressonnx tags) —
|
|
559
|
-
word stress via stressonnx (``[stress]``); ``diacritizer_model`` is the
|
|
560
|
-
stressonnx model. Stress is unwritten or under-marked in these languages,
|
|
561
|
-
and in East Slavic unstressed vowels also reduce, so a missing mark can
|
|
562
|
-
corrupt more than prosody.
|
|
563
|
-
- European Portuguese (``pt``, ``pt-PT`` and its lects, never ``pt-BR``) —
|
|
564
|
-
heterophonic-homograph sense diacritics via bifonia (``[pt]``);
|
|
565
|
-
ordinary Portuguese orthographic marks that any downstream G2P reads
|
|
566
|
-
correctly.
|
|
567
|
-
|
|
568
|
-
Unrecognized languages are returned unchanged. Each backend raises
|
|
569
|
-
``ImportError`` naming its extra when the optional dependency is missing
|
|
570
|
-
— scriptconv never installs anything on the caller's behalf.
|
|
427
|
+
``diacritizer_model`` is the model of whichever backend *lang* routes to:
|
|
428
|
+
|
|
429
|
+
- Hebrew (``he``): niqqud from phonikud. The model is a phonikud ONNX
|
|
430
|
+
path or a zero-arg callable; without one the public model is downloaded
|
|
431
|
+
and cached. The ``|`` that phonikud writes after a prefix letter
|
|
432
|
+
(``שֶׁ|אֵינָם``) is removed inside a word, so a phonemizer that splits at
|
|
433
|
+
``|`` keeps the word whole; a ``|`` between words stays.
|
|
434
|
+
``"nakdimon"`` selects Nakdimon, downloaded the same way; text that
|
|
435
|
+
already holds niqqud stays as written.
|
|
436
|
+
- Arabic in Arabic script (``ar``, ``arz``, ``apc``, Hassaniyya ``mey``):
|
|
437
|
+
tashkeel from text2tashkeel, model name default ``rawi-ensemble``.
|
|
438
|
+
``waqf=True`` gives the pausal form; other backends ignore ``waqf``.
|
|
439
|
+
- ``STRESS_LANGS``: word stress from stressonnx.
|
|
440
|
+
- European Portuguese (``pt``, ``pt-PT`` and its lects, never ``pt-BR``):
|
|
441
|
+
homograph sense diacritics from bifonia.
|
|
442
|
+
|
|
443
|
+
Other languages come back unchanged. A missing backend raises
|
|
444
|
+
``ImportError`` that names its extra. ``phonikud_model=`` and ``model=``
|
|
445
|
+
are accepted as other names of ``diacritizer_model``.
|
|
571
446
|
"""
|
|
572
|
-
# one knob for the diacritizer edge; fold the pre-unification kwargs so
|
|
573
|
-
# older callers keep working (phonikud_model was the Hebrew-only name).
|
|
574
447
|
diacritizer_model = (diacritizer_model or kwargs.get("phonikud_model")
|
|
575
448
|
or kwargs.get("model"))
|
|
576
449
|
family = _diacritizer_family(lang)
|
|
@@ -581,11 +454,7 @@ def diacritize(text: str, lang: str = "und", diacritizer_model=None,
|
|
|
581
454
|
if family == "ar":
|
|
582
455
|
return _tashkeel(diacritizer_model, waqf=bool(waqf)).diacritize(text)
|
|
583
456
|
if family == "stress":
|
|
584
|
-
#
|
|
585
|
-
# primary-subtag test (also used for stripping); generation needs
|
|
586
|
-
# stressonnx's stricter, script-aware resolution — a bare az/uz or
|
|
587
|
-
# a script-mismatched regional tag (e.g. "ru-Latn") is script-
|
|
588
|
-
# ambiguous/unsupported and must not reach the backend at all.
|
|
457
|
+
# a bare az/uz, or a script that stressonnx does not write (ru-Latn), never reaches it
|
|
589
458
|
if _is_stress_lang(lang):
|
|
590
459
|
return _stress(text, lang, diacritizer_model)
|
|
591
460
|
return text
|
|
@@ -594,15 +463,9 @@ def diacritize(text: str, lang: str = "und", diacritizer_model=None,
|
|
|
594
463
|
return text
|
|
595
464
|
|
|
596
465
|
|
|
597
|
-
#
|
|
598
|
-
#
|
|
599
|
-
# which (via NFD) would decompose and destroy precomposed native letters:
|
|
600
|
-
# Cyrillic й/ё, Latvian ī, Azerbaijani ç/ö, and Arabic hamza carriers أ إ آ ؤ ئ.
|
|
466
|
+
# The combining marks each backend overlays on the bare text, which strip removes.
|
|
467
|
+
# stressonnx writes the acute; the grave also writes stress, as in Bulgarian.
|
|
601
468
|
_STRESS_MARKS = frozenset({0x0300, 0x0301}) # combining grave / acute
|
|
602
|
-
# U+0300 is included defensively alongside the U+0301 that stressonnx
|
|
603
|
-
# actually emits, in case any backend/locale marks secondary stress with a
|
|
604
|
-
# grave instead of an acute; harmless to strip since native precomposed
|
|
605
|
-
# letters (e.g. Cyrillic й/ё) are unaffected either way.
|
|
606
469
|
_ARABIC_MARKS = frozenset(range(0x064B, 0x0660)) | frozenset({0x0670}) # tashkeel + dagger alef
|
|
607
470
|
_HEBREW_MARKS = (frozenset(range(0x05B0, 0x05BE))
|
|
608
471
|
| frozenset({0x05BF, 0x05C1, 0x05C2, 0x05C4, 0x05C5, 0x05C7})) # niqqud
|
|
@@ -613,14 +476,7 @@ _NATIVE_ACCENTED_LETTERS = {"mk": frozenset("ЃѓЌќ")}
|
|
|
613
476
|
|
|
614
477
|
|
|
615
478
|
def _overlay_marks(lang: str) -> "frozenset | None":
|
|
616
|
-
"""The overlay codepoints
|
|
617
|
-
|
|
618
|
-
Resolves the backend family through :func:`_diacritizer_family` (the shared
|
|
619
|
-
lang→backend routing), so this can never disagree with
|
|
620
|
-
:func:`diacritize` about which language a backend owns.
|
|
621
|
-
Only *overlay* families are strippable: ``"pt"`` (bifonia sense marks are
|
|
622
|
-
native orthography) and ``None`` both return None.
|
|
623
|
-
"""
|
|
479
|
+
"""The overlay codepoints of *lang*'s diacritizer family, or None where its marks are spelling or it has none."""
|
|
624
480
|
family = _diacritizer_family(lang)
|
|
625
481
|
if family == "stress":
|
|
626
482
|
return _STRESS_MARKS
|
|
@@ -638,19 +494,12 @@ def _supports_strip(lang: str) -> bool:
|
|
|
638
494
|
|
|
639
495
|
|
|
640
496
|
def strip_diacritics(text: str, lang: str = "und", **_) -> str:
|
|
641
|
-
"""
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
left intact. A mark that composes with the letter before it into a letter
|
|
648
|
-
of the language's alphabet is kept too, composed with that letter. So when
|
|
649
|
-
U+0301 comes right after г or к, as in NFD ѓ and ќ, strip writes the
|
|
650
|
-
precomposed letter that NFC input gives. Raises
|
|
651
|
-
:class:`ValueError` for languages whose diacritics are part of the native
|
|
652
|
-
orthography (e.g. European Portuguese), where any removal would corrupt
|
|
653
|
-
the spelling.
|
|
497
|
+
"""*text* without the overlay diacritics that *lang*'s backend adds; native letters stay.
|
|
498
|
+
|
|
499
|
+
A mark that composes with the letter before it into a letter of the
|
|
500
|
+
language's alphabet, as U+0301 after г in NFD ѓ, is kept and written
|
|
501
|
+
composed. Raises :class:`ValueError` where the diacritics are spelling, as
|
|
502
|
+
in European Portuguese.
|
|
654
503
|
"""
|
|
655
504
|
marks = _overlay_marks(lang)
|
|
656
505
|
if marks is None:
|
|
@@ -738,18 +587,12 @@ def replace_stress_mark(text: str, lang: str, before: str = "", after: str = "")
|
|
|
738
587
|
|
|
739
588
|
|
|
740
589
|
def register(graph) -> None:
|
|
741
|
-
"""
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
``"text-diacritized" -> "ipa"`` reachable.
|
|
748
|
-
|
|
749
|
-
``text-diacritized -> text`` (:func:`strip_diacritics`) is cheap but not
|
|
750
|
-
lossless: a letter with a mark and the bare letter strip to one string, so
|
|
751
|
-
no reverse returns both. It is gated: it raises for languages whose
|
|
752
|
-
diacritics are native orthography rather than removable overlays.
|
|
590
|
+
"""Add the ``text <-> text-diacritized`` edges to *graph*.
|
|
591
|
+
|
|
592
|
+
Both are ``lossless=False``: the diacritize edge is model-based, and
|
|
593
|
+
:func:`strip_diacritics` maps a marked and a bare letter to one string.
|
|
594
|
+
Pair with :func:`scriptconv.phonemizers.register` to reach
|
|
595
|
+
``"text-diacritized" -> "ipa"``.
|
|
753
596
|
"""
|
|
754
597
|
graph.register(
|
|
755
598
|
Edge("text", DIACRITIZED,
|