scriptconv 0.0.4a151__tar.gz → 0.0.4a152__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.4a151/scriptconv.egg-info → scriptconv-0.0.4a152}/PKG-INFO +1 -1
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/__init__.py +0 -3
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/__main__.py +12 -12
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/conventions.py +36 -69
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/notation.py +65 -188
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/__init__.py +4 -9
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/base.py +128 -356
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/registry.py +31 -64
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/readings.py +12 -24
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/scripts.py +27 -104
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/version.py +1 -1
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152/scriptconv.egg-info}/PKG-INFO +1 -1
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/LICENSE +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/README.md +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/pyproject.toml +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/cangjie.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/data/LICENSE.cangjie5 +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/data/__init__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/data/cangjie5_tc.tsv.gz +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/diacritics.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/frontend.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/graph.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_identity_cache.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_moved.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_revision.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/LICENSE.f5tts +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/LICENSE.hangul_to_ipa +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/__init__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/bw2ipa.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/LICENSE +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/UPSTREAM.md +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/__init__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/__main__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/align.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.cmudict +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.homograph-data +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/built/align.json +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/built/g2p.json +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/built/g2p.npz +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/built/homographs.json +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/built/lexicon.json +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/built/lexicon.tsv +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/built/sources.json +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/convert.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/data/abbreviations.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/data/chat.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/data/endings.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/data/exceptions.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/data/function_words.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/data/homograph_fixes.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/data/homograph_rules.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/data/letters.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/data/phrases.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/data/units.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/engine.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/g2p.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/homographs.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/morphology.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/normalize.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/sentence.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/symbols.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/dizione/tables.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/f5tts.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/g2pw/LICENSE +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/g2pw/__init__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/g2pw/bert-base-chinese_s2t_dict.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/g2pw/bopomofo_to_pinyin_wo_tune_dict.json +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/g2pw/char_bopomofo_dict.json +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/hangul2ipa.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/ko_tables/aspiration.csv +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/ko_tables/assimilation.csv +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/ko_tables/double_coda.csv +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/ko_tables/hanja.tsv +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/ko_tables/ipa.csv +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/ko_tables/neutralization.csv +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/ko_tables/tensification.csv +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/ko_tables/yale.csv +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/leokani/LICENSE +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/leokani/LICENSE-CC-BY-4.0.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/leokani/NOTICE +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/leokani/__init__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/leokani/leokani_g2p.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/nakdimon/LICENSE +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/nakdimon/__init__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/nemo/NOTICE +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/shami/__init__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/shami/codeswitch.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/shami/diacritize.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/shami/dialectal.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/shami/english_g2p.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/shami/espeak.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/shami/frontend.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/shami/levantine_g2p.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/shami/normalize.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/shami/phoneme_inventory.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/vosk_g2p.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_thirdparty/zh_num.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_vendored/__init__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_vendored/matoub_kab/LICENSE.md +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/_vendored/matoub_kab/__init__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/africa.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/ar.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/ber.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/dizione.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/en.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/enums.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/eu.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/f5tts.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/fa.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/g2pw.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/ghana.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/gl.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/he.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/ja.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/ko.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/leokani.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/lir.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/mul.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/mwl.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/nemo_ipa.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/o2ipa.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/openjtalk_engine.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/pt.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/ru.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/shami.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/vi.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/phonemizers/zh.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/py.typed +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/testing/__init__.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/testing/compare.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv/translit.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv.egg-info/SOURCES.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv.egg-info/dependency_links.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv.egg-info/requires.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/scriptconv.egg-info/top_level.txt +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/setup.cfg +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_arabic_diacritics_routing.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_arpa_stress.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_backend_table.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_byt5_lang_prefix.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_cangjie.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_charsiu_match_tags.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_cli.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_conventions.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_core_imports.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_diacritics.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_diacritics_graph.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_diacritics_nakdimon.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_diacritics_nfd_letters.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_doc_pages.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_errors_policy.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_examples.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_frontend.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_frontend_chunks.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_frontend_join.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_frontend_order.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_frontend_phonemizer_lang.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_frontend_say_as.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_frontend_stage_edges.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_graph.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_graph_lossless.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_gruut_lexicon_cache.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_he_extra_declares_phonikud.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_identity_cache.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_lang_default_region.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_match_lang_direction.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_match_lang_preferred_value.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_notation.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_notation_sources.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_notation_strict.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_openjtalk_engine.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_base.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_cjk_ar.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_copyleft_he_ja_th.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_dizione.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_dizione_long_tokens.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_epitran_english.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_epitran_japanese.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_epitran_korean.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_espeak_lt_accent.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_eu_euskaphone.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_f5tts.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_friendly_import_errors.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_g2pw.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_goruut_marks.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_goruut_server.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_grapheme_arguments.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_identity.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_kolokwa.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_leokani.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_marks.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_matoub_kab.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_mwl_barranquenho.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_nemo_ipa.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_o2i_lexicons.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_phonetisaurus.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_phonetisaurus_engine.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_pt_tugaphone.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_punctuation.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_ru.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_shami_digit_runs.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_phonemizers_shami_inventory.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_readings_zh.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_scripts.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_scripts_stressonnx_compat.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_sister_packages.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_stress_marks.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_testing_compare.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_translit.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/tests/test_tugaphone_identity_no_revision.py +0 -0
- {scriptconv-0.0.4a151 → scriptconv-0.0.4a152}/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.4a152
|
|
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
|
|
@@ -33,9 +33,6 @@ conventions:
|
|
|
33
33
|
Orthographic conventions — script-scoped decorations orthogonal to
|
|
34
34
|
identity (tashkeel, niqqud, wakachigaki, pinyin tone spelling…).
|
|
35
35
|
Scripts are nodes; conventions are parameters, never nodes.
|
|
36
|
-
|
|
37
|
-
Zero required runtime dependencies (stdlib only); the readings module
|
|
38
|
-
needs the optional ``ja``/``zh`` extras.
|
|
39
36
|
"""
|
|
40
37
|
|
|
41
38
|
from scriptconv.scripts import (
|
|
@@ -83,19 +83,19 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
83
83
|
return 1
|
|
84
84
|
|
|
85
85
|
dispatch = {
|
|
86
|
-
"convert":
|
|
87
|
-
"detect":
|
|
88
|
-
"distribution":
|
|
89
|
-
"direction":
|
|
90
|
-
"decompose":
|
|
91
|
-
"lang":
|
|
92
|
-
"strip":
|
|
93
|
-
"restyle":
|
|
94
|
-
"conventions":
|
|
95
|
-
"route":
|
|
96
|
-
"phonemize":
|
|
86
|
+
"convert": _do_convert,
|
|
87
|
+
"detect": _do_detect,
|
|
88
|
+
"distribution": _do_distribution,
|
|
89
|
+
"direction": _do_direction,
|
|
90
|
+
"decompose": _do_decompose,
|
|
91
|
+
"lang": _do_lang,
|
|
92
|
+
"strip": _do_strip,
|
|
93
|
+
"restyle": _do_restyle,
|
|
94
|
+
"conventions": _do_conventions,
|
|
95
|
+
"route": _do_route,
|
|
96
|
+
"phonemize": _do_phonemize,
|
|
97
97
|
}
|
|
98
|
-
dispatch[args.command]()
|
|
98
|
+
dispatch[args.command](args)
|
|
99
99
|
return 0
|
|
100
100
|
|
|
101
101
|
|
|
@@ -1,46 +1,27 @@
|
|
|
1
1
|
"""Orthographic conventions — script-scoped decorations, orthogonal to identity.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
word segmentation) are orthography too, but live behind the optional
|
|
26
|
-
extras, like :mod:`scriptconv.readings`;
|
|
27
|
-
* transitions that need contextual *prediction* (restoring tashkeel or
|
|
28
|
-
niqqud, i.e. diacritization) are linguistic inference, so they belong to
|
|
29
|
-
:mod:`scriptconv.diacritics` and not to this module, as grapheme-to-phoneme
|
|
30
|
-
belongs to :mod:`scriptconv.phonemizers`. Their absence is queryable data,
|
|
31
|
-
not a runtime surprise.
|
|
32
|
-
|
|
33
|
-
What is **not** a convention: marks that are letter identity rather than
|
|
34
|
-
decoration. Vietnamese tone diacritics spell different words, Arabic
|
|
35
|
-
hamza/madda (U+0653–U+0655) distinguish letters, and stripping them corrupts
|
|
36
|
-
text — none are registered. Casing on bicameral scripts *is* a convention in
|
|
37
|
-
the sense used here, but the stdlib (``str.lower``/``str.casefold``) already
|
|
38
|
-
models it correctly, so it is deliberately not duplicated.
|
|
39
|
-
|
|
40
|
-
``jamo-form`` is the registry's one documented impurity: compatibility vs
|
|
41
|
-
conjoining jamo is a Unicode *representation* convention rather than an
|
|
42
|
-
orthographic one, registered because free text genuinely occurs in both
|
|
43
|
-
repertoires and the restyle is deterministic.
|
|
3
|
+
A script is text identity and a node of the conversion graph
|
|
4
|
+
(:mod:`scriptconv.scripts`). A convention is a decoration that a script's
|
|
5
|
+
orthography can carry or omit: vocalization (Arabic tashkeel, Hebrew niqqud),
|
|
6
|
+
justification (kashida), spacing (Japanese wakachigaki), or exclusive
|
|
7
|
+
spellings of the same information (pinyin tone marks or digits). A convention
|
|
8
|
+
is a parameter, never a node, and plays no part in script detection.
|
|
9
|
+
|
|
10
|
+
Each convention declares its *styles*, the exclusive states its text can be
|
|
11
|
+
in: ``("marked", "none")`` for a binary decoration, or named spellings such as
|
|
12
|
+
``("mark", "number", "none")``. :func:`restyle` runs a transition between two
|
|
13
|
+
styles; :func:`strip` and :func:`apply` restyle to and from ``"none"``.
|
|
14
|
+
Stripping and deterministic respelling need no dependency. A transition that
|
|
15
|
+
needs a dictionary (applying wakachigaki is word segmentation) needs an
|
|
16
|
+
optional extra. Restoring tashkeel or niqqud is prediction, so it belongs to
|
|
17
|
+
:mod:`scriptconv.diacritics` and has no transition here.
|
|
18
|
+
|
|
19
|
+
Marks that are letter identity are not conventions: Vietnamese tone marks and
|
|
20
|
+
Arabic hamza/madda (U+0653–U+0655) spell different words, so stripping them
|
|
21
|
+
corrupts the text. Casing is left to ``str.lower`` and ``str.casefold``.
|
|
22
|
+
``jamo-form`` (compatibility or conjoining jamo) is a Unicode representation
|
|
23
|
+
choice, not an orthographic one; it is registered because free text holds
|
|
24
|
+
both and the restyle is deterministic.
|
|
44
25
|
"""
|
|
45
26
|
from __future__ import annotations
|
|
46
27
|
|
|
@@ -175,19 +156,15 @@ class Convention:
|
|
|
175
156
|
# Shared helpers
|
|
176
157
|
# ---------------------------------------------------------------------------
|
|
177
158
|
|
|
178
|
-
def
|
|
179
|
-
return any(lo <= cp <= hi for lo, hi in ranges)
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
def _range_strip(ranges: Tuple[Tuple[int, int], ...]) -> Callable[[str], str]:
|
|
159
|
+
def _range_strip(pattern: re.Pattern) -> Callable[[str], str]:
|
|
183
160
|
def _strip(text: str) -> str:
|
|
184
|
-
return ""
|
|
161
|
+
return pattern.sub("", text)
|
|
185
162
|
return _strip
|
|
186
163
|
|
|
187
164
|
|
|
188
|
-
def _range_detector(
|
|
165
|
+
def _range_detector(pattern: re.Pattern) -> Callable[[str], Optional[str]]:
|
|
189
166
|
def _detect(text: str) -> Optional[str]:
|
|
190
|
-
return "marked" if
|
|
167
|
+
return "marked" if pattern.search(text) else "none"
|
|
191
168
|
return _detect
|
|
192
169
|
|
|
193
170
|
|
|
@@ -212,21 +189,12 @@ _WAKACHI_SPACE = re.compile(r"[ ]+")
|
|
|
212
189
|
|
|
213
190
|
|
|
214
191
|
def _wakachigaki_strip(text: str) -> str:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
after = text[m.end():m.end() + 1]
|
|
222
|
-
if not (before and after and _is_japanese_flank(before[-1])
|
|
223
|
-
and _is_japanese_flank(after)):
|
|
224
|
-
out.append(m.group(0))
|
|
225
|
-
i = m.end()
|
|
226
|
-
else:
|
|
227
|
-
out.append(text[i])
|
|
228
|
-
i += 1
|
|
229
|
-
return "".join(out)
|
|
192
|
+
def space(m: re.Match) -> str:
|
|
193
|
+
start, end = m.span()
|
|
194
|
+
if start and end < len(text) and _is_japanese_flank(text[start - 1]) and _is_japanese_flank(text[end]):
|
|
195
|
+
return ""
|
|
196
|
+
return m.group(0)
|
|
197
|
+
return _WAKACHI_SPACE.sub(space, text)
|
|
230
198
|
|
|
231
199
|
|
|
232
200
|
def _wakachigaki_apply(text: str) -> str:
|
|
@@ -284,9 +252,7 @@ def _mark_syllable(syl: str, tone: int) -> str:
|
|
|
284
252
|
break
|
|
285
253
|
if pos == -1:
|
|
286
254
|
return syl
|
|
287
|
-
|
|
288
|
-
"NFC", syl[:pos + 1] + _TONE_COMBINING[tone] + syl[pos + 1:])
|
|
289
|
-
return marked
|
|
255
|
+
return unicodedata.normalize("NFC", syl[:pos + 1] + _TONE_COMBINING[tone] + syl[pos + 1:])
|
|
290
256
|
|
|
291
257
|
|
|
292
258
|
_NUM_SYL = re.compile(r"([a-zA-ZüÜ:]+)([0-5])")
|
|
@@ -449,10 +415,11 @@ def _marks(id: str, name: str, scripts: Tuple[str, ...],
|
|
|
449
415
|
ranges: Tuple[Tuple[int, int], ...], reference: str,
|
|
450
416
|
*, default: str = "marked") -> Convention:
|
|
451
417
|
"""A binary decoration: strippable marks with a range-based detector."""
|
|
418
|
+
pattern = re.compile("[" + "".join(f"{re.escape(chr(lo))}-{re.escape(chr(hi))}" for lo, hi in ranges) + "]")
|
|
452
419
|
return Convention(id, name, scripts, None, ("marked", "none"), default,
|
|
453
420
|
ranges, reference,
|
|
454
|
-
transitions=(Transition("marked", "none", _range_strip(
|
|
455
|
-
detector=_range_detector(
|
|
421
|
+
transitions=(Transition("marked", "none", _range_strip(pattern)),),
|
|
422
|
+
detector=_range_detector(pattern))
|
|
456
423
|
|
|
457
424
|
|
|
458
425
|
CONVENTION_REGISTRY: Dict[str, Convention] = {c.id: c for c in (
|
|
@@ -203,7 +203,6 @@ _ARPA_SYLLABIC = {"EM", "EN", "ENG", "EL"}
|
|
|
203
203
|
_STRESS_MARKS = {"ˈ": "1", "ˌ": "2"} # IPA primary/secondary stress
|
|
204
204
|
|
|
205
205
|
|
|
206
|
-
|
|
207
206
|
class UnknownSymbolError(ValueError):
|
|
208
207
|
"""A symbol has no mapping in the requested notation (``errors="strict"``)."""
|
|
209
208
|
|
|
@@ -242,6 +241,24 @@ def _unknown(symbol: str, position: int, notation: str, errors: str,
|
|
|
242
241
|
raise ValueError(f"errors must be one of {_ERROR_POLICIES}, not {errors!r}")
|
|
243
242
|
|
|
244
243
|
|
|
244
|
+
def _transcode(text: str, pattern: re.Pattern, table: dict[str, str],
|
|
245
|
+
notation: str, errors: str) -> str:
|
|
246
|
+
"""Map *text* through *table*, matching *pattern* (longest key first) at each position."""
|
|
247
|
+
result = []
|
|
248
|
+
pos = 0
|
|
249
|
+
while pos < len(text):
|
|
250
|
+
m = pattern.match(text, pos)
|
|
251
|
+
if m:
|
|
252
|
+
result.append(table[m.group(0)])
|
|
253
|
+
pos = m.end()
|
|
254
|
+
else:
|
|
255
|
+
out = _unknown(text[pos], pos, notation, errors)
|
|
256
|
+
if out:
|
|
257
|
+
result.append(out)
|
|
258
|
+
pos += 1
|
|
259
|
+
return "".join(result)
|
|
260
|
+
|
|
261
|
+
|
|
245
262
|
def arpa_to_ipa(arpa_sequence: str, errors: str = "pass",
|
|
246
263
|
stress: bool = False) -> str:
|
|
247
264
|
"""Convert a space-separated ARPABET sequence to an IPA string.
|
|
@@ -249,11 +266,11 @@ def arpa_to_ipa(arpa_sequence: str, errors: str = "pass",
|
|
|
249
266
|
With ``stress=True``, ARPABET stress digits are preserved as IPA stress
|
|
250
267
|
marks placed immediately before the stressed vowel's symbol: ``AH1`` →
|
|
251
268
|
``ˈʌ``, ``AH2`` → ``ˌʌ``, ``AH0`` → unmarked (a purely notational,
|
|
252
|
-
reversible convention — no syllabification is performed).
|
|
253
|
-
``stress=False``
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
269
|
+
reversible convention — no syllabification is performed). With the
|
|
270
|
+
default ``stress=False`` the digits are stripped. ``errors`` selects the
|
|
271
|
+
unknown-token policy: ``"pass"`` (default) keeps the token, ``"replace"``
|
|
272
|
+
substitutes ``?``, ``"ignore"`` drops it, ``"strict"`` raises
|
|
273
|
+
:class:`UnknownSymbolError`.
|
|
257
274
|
|
|
258
275
|
Examples
|
|
259
276
|
--------
|
|
@@ -282,23 +299,20 @@ def ipa_to_arpa(ipa_string: str, unknown: str = "?",
|
|
|
282
299
|
errors: str = "replace", stress: bool = False) -> str:
|
|
283
300
|
"""Convert an IPA string to a space-separated ARPABET sequence.
|
|
284
301
|
|
|
285
|
-
Matches longest IPA symbol first. With ``stress=True``,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
``errors`` selects the unknown-symbol policy
|
|
292
|
-
|
|
293
|
-
``
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
policy, because the caller asked for no stress digits. Spaces, the
|
|
300
|
-
characters with the Unicode White_Space property, are dropped too: ARPABET
|
|
301
|
-
tokens are space-separated, so the output keeps no word boundary.
|
|
302
|
+
Matches the longest IPA symbol first. With ``stress=True``, a stress mark
|
|
303
|
+
(``ˈ``/``ˌ``) becomes the digit ``1``/``2`` of the next vowel, after any
|
|
304
|
+
onset, and an unmarked vowel takes ``0``: the reverse of
|
|
305
|
+
:func:`arpa_to_ipa` with ``stress=True``. With ``stress=False`` every
|
|
306
|
+
stress mark is dropped.
|
|
307
|
+
|
|
308
|
+
``errors`` selects the unknown-symbol policy. The default ``"replace"``
|
|
309
|
+
writes *unknown*; ``unknown=""`` drops the symbol. Except under
|
|
310
|
+
``"strict"``, combining marks and modifier letters qualify the phoneme
|
|
311
|
+
before them and are dropped. ``"strict"`` raises on a mark with no
|
|
312
|
+
ARPABET value, on a stress mark that no vowel follows, and on a stress
|
|
313
|
+
mark whose syllable has a syllabic consonant (``EL``, ``EM``, ``EN``,
|
|
314
|
+
``ENG``) and no vowel. White_Space characters are dropped: ARPABET tokens
|
|
315
|
+
are space-separated, so the output keeps no word boundary.
|
|
302
316
|
|
|
303
317
|
Examples
|
|
304
318
|
--------
|
|
@@ -878,19 +892,7 @@ def ipa_to_lexique(ipa: str, errors: str = "pass") -> str:
|
|
|
878
892
|
>>> ipa_to_lexique("dø")
|
|
879
893
|
'd2'
|
|
880
894
|
"""
|
|
881
|
-
|
|
882
|
-
pos = 0
|
|
883
|
-
while pos < len(ipa):
|
|
884
|
-
m = _IPA_LX_RE.match(ipa, pos)
|
|
885
|
-
if m:
|
|
886
|
-
result.append(_IPA_TO_LEXIQUE[m.group(0)])
|
|
887
|
-
pos = m.end()
|
|
888
|
-
else:
|
|
889
|
-
out = _unknown(ipa[pos], pos, "lexique", errors)
|
|
890
|
-
if out:
|
|
891
|
-
result.append(out)
|
|
892
|
-
pos += 1
|
|
893
|
-
return "".join(result)
|
|
895
|
+
return _transcode(ipa, _IPA_LX_RE, _IPA_TO_LEXIQUE, "lexique", errors)
|
|
894
896
|
|
|
895
897
|
|
|
896
898
|
# ---------------------------------------------------------------------------
|
|
@@ -1037,19 +1039,7 @@ def cotovia_to_ipa(cotovia: str, errors: str = "pass") -> str:
|
|
|
1037
1039
|
>>> cotovia_to_ipa("karro")
|
|
1038
1040
|
'karo'
|
|
1039
1041
|
"""
|
|
1040
|
-
|
|
1041
|
-
pos = 0
|
|
1042
|
-
while pos < len(cotovia):
|
|
1043
|
-
m = _CV_RE.match(cotovia, pos)
|
|
1044
|
-
if m:
|
|
1045
|
-
result.append(_COTOVIA_TO_IPA[m.group(0)])
|
|
1046
|
-
pos = m.end()
|
|
1047
|
-
else:
|
|
1048
|
-
out = _unknown(cotovia[pos], pos, "cotovia", errors)
|
|
1049
|
-
if out:
|
|
1050
|
-
result.append(out)
|
|
1051
|
-
pos += 1
|
|
1052
|
-
return "".join(result)
|
|
1042
|
+
return _transcode(cotovia, _CV_RE, _COTOVIA_TO_IPA, "cotovia", errors)
|
|
1053
1043
|
|
|
1054
1044
|
|
|
1055
1045
|
def ipa_to_cotovia(ipa: str, errors: str = "pass") -> str:
|
|
@@ -1065,19 +1055,7 @@ def ipa_to_cotovia(ipa: str, errors: str = "pass") -> str:
|
|
|
1065
1055
|
>>> ipa_to_cotovia("ʎ")
|
|
1066
1056
|
'L'
|
|
1067
1057
|
"""
|
|
1068
|
-
|
|
1069
|
-
pos = 0
|
|
1070
|
-
while pos < len(ipa):
|
|
1071
|
-
m = _IPA_CV_RE.match(ipa, pos)
|
|
1072
|
-
if m:
|
|
1073
|
-
result.append(_IPA_TO_COTOVIA[m.group(0)])
|
|
1074
|
-
pos = m.end()
|
|
1075
|
-
else:
|
|
1076
|
-
out = _unknown(ipa[pos], pos, "cotovia", errors)
|
|
1077
|
-
if out:
|
|
1078
|
-
result.append(out)
|
|
1079
|
-
pos += 1
|
|
1080
|
-
return "".join(result)
|
|
1058
|
+
return _transcode(ipa, _IPA_CV_RE, _IPA_TO_COTOVIA, "cotovia", errors)
|
|
1081
1059
|
|
|
1082
1060
|
|
|
1083
1061
|
# ---------------------------------------------------------------------------
|
|
@@ -1161,19 +1139,7 @@ def rfe_to_ipa(rfe: str, errors: str = "pass") -> str:
|
|
|
1161
1139
|
>>> rfe_to_ipa("kaša")
|
|
1162
1140
|
'kaʃa'
|
|
1163
1141
|
"""
|
|
1164
|
-
|
|
1165
|
-
pos = 0
|
|
1166
|
-
while pos < len(rfe):
|
|
1167
|
-
m = _RFE_RE.match(rfe, pos)
|
|
1168
|
-
if m:
|
|
1169
|
-
result.append(_RFE_TO_IPA[m.group(0)])
|
|
1170
|
-
pos = m.end()
|
|
1171
|
-
else:
|
|
1172
|
-
out = _unknown(rfe[pos], pos, "rfe", errors)
|
|
1173
|
-
if out:
|
|
1174
|
-
result.append(out)
|
|
1175
|
-
pos += 1
|
|
1176
|
-
return "".join(result)
|
|
1142
|
+
return _transcode(rfe, _RFE_RE, _RFE_TO_IPA, "rfe", errors)
|
|
1177
1143
|
|
|
1178
1144
|
|
|
1179
1145
|
def ipa_to_rfe(ipa: str, errors: str = "pass") -> str:
|
|
@@ -1189,20 +1155,7 @@ def ipa_to_rfe(ipa: str, errors: str = "pass") -> str:
|
|
|
1189
1155
|
>>> ipa_to_rfe("ɲ")
|
|
1190
1156
|
'ñ'
|
|
1191
1157
|
"""
|
|
1192
|
-
|
|
1193
|
-
pos = 0
|
|
1194
|
-
while pos < len(ipa):
|
|
1195
|
-
m = _IPA_RFE_RE.match(ipa, pos)
|
|
1196
|
-
if m:
|
|
1197
|
-
result.append(_IPA_TO_RFE[m.group(0)])
|
|
1198
|
-
pos = m.end()
|
|
1199
|
-
else:
|
|
1200
|
-
out = _unknown(ipa[pos], pos, "rfe", errors)
|
|
1201
|
-
if out:
|
|
1202
|
-
result.append(out)
|
|
1203
|
-
pos += 1
|
|
1204
|
-
return "".join(result)
|
|
1205
|
-
|
|
1158
|
+
return _transcode(ipa, _IPA_RFE_RE, _IPA_TO_RFE, "rfe", errors)
|
|
1206
1159
|
|
|
1207
1160
|
|
|
1208
1161
|
# ---------------------------------------------------------------------------
|
|
@@ -1306,17 +1259,13 @@ def halabi_to_ipa(halabi: str | list[str], errors: str = "pass") -> str:
|
|
|
1306
1259
|
and not out[-1].endswith("ː"):
|
|
1307
1260
|
out[-1] += "ː"
|
|
1308
1261
|
continue
|
|
1309
|
-
if tok
|
|
1262
|
+
if tok in ("_sil_", "_+_"):
|
|
1310
1263
|
out.append(" ")
|
|
1311
1264
|
last_tok = None
|
|
1312
1265
|
continue
|
|
1313
1266
|
if tok in ("_eos_", "_pad_"):
|
|
1314
1267
|
last_tok = None
|
|
1315
1268
|
continue
|
|
1316
|
-
if tok == "_+_":
|
|
1317
|
-
out.append(" ")
|
|
1318
|
-
last_tok = None
|
|
1319
|
-
continue
|
|
1320
1269
|
if tok == "<":
|
|
1321
1270
|
out.append("ʔ")
|
|
1322
1271
|
last_tok = tok
|
|
@@ -1410,44 +1359,16 @@ def convert(text: str, src: str | Notation, dst: str | Notation,
|
|
|
1410
1359
|
errors: str = "pass") -> str:
|
|
1411
1360
|
"""Convert *text* from *src* notation to *dst* notation.
|
|
1412
1361
|
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
Indirect pairs route through IPA (e.g. ``arpa`` → ``x-sampa`` goes
|
|
1420
|
-
``arpa`` → ``ipa`` → ``x-sampa``).
|
|
1421
|
-
|
|
1422
|
-
Parameters
|
|
1423
|
-
----------
|
|
1424
|
-
text:
|
|
1425
|
-
Input string.
|
|
1426
|
-
src:
|
|
1427
|
-
Source notation (``Notation`` member or its string value).
|
|
1428
|
-
dst:
|
|
1429
|
-
Target notation.
|
|
1430
|
-
|
|
1431
|
-
Returns
|
|
1432
|
-
-------
|
|
1433
|
-
str
|
|
1434
|
-
Converted string.
|
|
1435
|
-
|
|
1436
|
-
Raises
|
|
1437
|
-
------
|
|
1438
|
-
ValueError
|
|
1439
|
-
When *src* or *dst* is not a recognised ``Notation`` value, or when
|
|
1440
|
-
the requested conversion path is not supported.
|
|
1362
|
+
*src* and *dst* are :class:`Notation` members or their values. The route
|
|
1363
|
+
comes from :data:`scriptconv.graph.DEFAULT_GRAPH`: a notation pair goes
|
|
1364
|
+
through IPA (``arpa`` → ``ipa`` → ``x-sampa``), Buckwalter ↔ Arabic is
|
|
1365
|
+
direct. Raises :class:`ValueError` for an unknown notation or a pair with
|
|
1366
|
+
no route.
|
|
1441
1367
|
"""
|
|
1442
1368
|
src = Notation(src)
|
|
1443
1369
|
dst = Notation(dst)
|
|
1444
|
-
|
|
1445
1370
|
if src == dst:
|
|
1446
1371
|
return text
|
|
1447
|
-
|
|
1448
|
-
# Routing lives on the shared conversion graph; the notation tables below
|
|
1449
|
-
# are registered there as edges (IPA-pivot pairs route through the "ipa"
|
|
1450
|
-
# node, Buckwalter <-> Arabic is a direct edge).
|
|
1451
1372
|
from scriptconv.graph import DEFAULT_GRAPH
|
|
1452
1373
|
try:
|
|
1453
1374
|
return DEFAULT_GRAPH.convert(text, src.value, dst.value, errors=errors)
|
|
@@ -1498,12 +1419,8 @@ _NOTATION_VALUES = {n.value for n in Notation}
|
|
|
1498
1419
|
def can_convert(src: str | Notation, dst: str | Notation) -> bool:
|
|
1499
1420
|
"""Return ``True`` if a conversion from *src* to *dst* is supported.
|
|
1500
1421
|
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
src:
|
|
1504
|
-
Source notation.
|
|
1505
|
-
dst:
|
|
1506
|
-
Target notation.
|
|
1422
|
+
A notation to itself is no conversion and gives ``False``, unlike
|
|
1423
|
+
:meth:`scriptconv.graph.ConversionGraph.can_convert`.
|
|
1507
1424
|
|
|
1508
1425
|
Examples
|
|
1509
1426
|
--------
|
|
@@ -1517,17 +1434,13 @@ def can_convert(src: str | Notation, dst: str | Notation) -> bool:
|
|
|
1517
1434
|
src = Notation(src)
|
|
1518
1435
|
dst = Notation(dst)
|
|
1519
1436
|
if src == dst:
|
|
1520
|
-
# historical contract: identity is not a "conversion" here, unlike
|
|
1521
|
-
# graph.ConversionGraph.can_convert (which deliberately returns True
|
|
1522
|
-
# for identity — an empty route is a valid, zero-cost conversion there)
|
|
1523
1437
|
return False
|
|
1524
1438
|
from scriptconv.graph import DEFAULT_GRAPH
|
|
1525
1439
|
try:
|
|
1526
1440
|
route = DEFAULT_GRAPH.route(src.value, dst.value)
|
|
1527
1441
|
except ValueError:
|
|
1528
1442
|
return False
|
|
1529
|
-
#
|
|
1530
|
-
# that would leave the notation node set (none exist today, cheap to keep)
|
|
1443
|
+
# Only a route that stays on notation nodes counts.
|
|
1531
1444
|
return all(e.src in _NOTATION_VALUES and e.dst in _NOTATION_VALUES
|
|
1532
1445
|
for e in route)
|
|
1533
1446
|
|
|
@@ -1635,29 +1548,14 @@ NOTATION_INFO: dict[Notation, NotationInfo] = {
|
|
|
1635
1548
|
# convert_batch — line-by-line generator
|
|
1636
1549
|
# ---------------------------------------------------------------------------
|
|
1637
1550
|
|
|
1638
|
-
|
|
1639
1551
|
def convert_batch(
|
|
1640
1552
|
lines: Iterable[str],
|
|
1641
1553
|
src: str | Notation,
|
|
1642
1554
|
dst: str | Notation,
|
|
1643
1555
|
) -> Generator[str, None, None]:
|
|
1644
|
-
"""Convert each line from *src* to *dst* notation
|
|
1556
|
+
"""Convert each line from *src* to *dst* notation.
|
|
1645
1557
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
Parameters
|
|
1649
|
-
----------
|
|
1650
|
-
lines:
|
|
1651
|
-
Iterable of input strings (e.g. file lines).
|
|
1652
|
-
src:
|
|
1653
|
-
Source notation.
|
|
1654
|
-
dst:
|
|
1655
|
-
Target notation.
|
|
1656
|
-
|
|
1657
|
-
Yields
|
|
1658
|
-
------
|
|
1659
|
-
str
|
|
1660
|
-
Converted string for each input line.
|
|
1558
|
+
Line endings are stripped; a blank line is yielded empty.
|
|
1661
1559
|
|
|
1662
1560
|
Examples
|
|
1663
1561
|
--------
|
|
@@ -1678,42 +1576,21 @@ def convert_batch(
|
|
|
1678
1576
|
# looks_like_ipa — heuristic notation detection
|
|
1679
1577
|
# ---------------------------------------------------------------------------
|
|
1680
1578
|
|
|
1681
|
-
#
|
|
1682
|
-
#
|
|
1683
|
-
#
|
|
1684
|
-
#
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
(0x0363, 0x036F), # Combining diacritics used in IPA
|
|
1689
|
-
(0x1D00, 0x1D7F), # Phonetic Extensions
|
|
1690
|
-
(0x1D80, 0x1DBF), # Phonetic Extensions Supplement
|
|
1691
|
-
)
|
|
1692
|
-
# Individual combining marks common in IPA (nasalisation, syllabicity, etc.).
|
|
1693
|
-
_IPA_DISTINCTIVE_CHARS = frozenset("̩̪̥̃̊͜͡")
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
def _is_ipa_distinctive(ch: str) -> bool:
|
|
1697
|
-
cp = ord(ch)
|
|
1698
|
-
if ch in _IPA_DISTINCTIVE_CHARS:
|
|
1699
|
-
return True
|
|
1700
|
-
return any(lo <= cp <= hi for lo, hi in _IPA_DISTINCTIVE_RANGES)
|
|
1579
|
+
# Characters distinctive to IPA transcription: IPA Extensions and Spacing
|
|
1580
|
+
# Modifier Letters (U+0250-02FF), combining diacritics U+0363-036F, Phonetic
|
|
1581
|
+
# Extensions and its Supplement (U+1D00-1DBF), and the combining marks IPA uses
|
|
1582
|
+
# for nasalisation, syllabicity and ties. Basic Latin letters and the Greek
|
|
1583
|
+
# letters IPA borrows (β, θ, χ) carry no signal: ordinary text has them too.
|
|
1584
|
+
_IPA_DISTINCTIVE = re.compile("[\u0250-\u02ff\u0363-\u036f\u1d00-\u1dbf"
|
|
1585
|
+
"\u0303\u0329\u032a\u0325\u030a\u0361\u035c]")
|
|
1701
1586
|
|
|
1702
1587
|
|
|
1703
1588
|
def looks_like_ipa(text: str) -> bool:
|
|
1704
|
-
"""
|
|
1705
|
-
|
|
1706
|
-
Returns ``True`` when *text* contains at least one character that is
|
|
1707
|
-
distinctive to IPA — from the IPA Extensions, Spacing Modifier Letters,
|
|
1708
|
-
or Phonetic Extensions blocks, or an IPA combining diacritic (e.g.
|
|
1709
|
-
``ɑ``, ``ʃ``, ``ː``, ``ˈ``, nasalisation).
|
|
1589
|
+
"""Whether *text* holds a character distinctive to IPA (``ɑ``, ``ʃ``, ``ː``, ``ˈ``, nasalisation).
|
|
1710
1590
|
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
It cannot be otherwise — those characters are the same codepoints as
|
|
1715
|
-
ordinary text. Use it to *guard* against feeding IPA where orthography
|
|
1716
|
-
is expected, not to prove a string is not IPA.
|
|
1591
|
+
A transcription written only with letters that IPA shares with Latin
|
|
1592
|
+
(``"pat"``) gives ``False``, so use this to guard against IPA where
|
|
1593
|
+
orthography is expected, not to prove that a string is not IPA.
|
|
1717
1594
|
|
|
1718
1595
|
Examples
|
|
1719
1596
|
--------
|
|
@@ -1724,4 +1601,4 @@ def looks_like_ipa(text: str) -> bool:
|
|
|
1724
1601
|
>>> looks_like_ipa("hello")
|
|
1725
1602
|
False
|
|
1726
1603
|
"""
|
|
1727
|
-
return
|
|
1604
|
+
return _IPA_DISTINCTIVE.search(text) is not None
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
"""Phonemizer wrappers
|
|
1
|
+
"""Phonemizer wrappers: the :class:`BasePhonemizer` contract, the enums and the lazy registry.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
engines are optional extras; a missing one raises :class:`ImportError`
|
|
7
|
-
naming the extra to install. The wrappers under a copyleft or a
|
|
8
|
-
non-commercial licence are in the scriptconv-copyleft and scriptconv-nonfree
|
|
9
|
-
packages (see :mod:`scriptconv.phonemizers._moved`); the registry imports
|
|
10
|
-
them from there.
|
|
3
|
+
Backing engines are optional extras; a missing one raises :class:`ImportError`
|
|
4
|
+
naming the extra to install. The wrappers under a copyleft or a non-commercial
|
|
5
|
+
licence are in scriptconv-copyleft and scriptconv-nonfree.
|
|
11
6
|
"""
|
|
12
7
|
from scriptconv.phonemizers.enums import Alphabet, Phonemizer
|
|
13
8
|
from scriptconv.phonemizers.base import (
|