scriptconv 0.0.4a150__tar.gz → 0.0.4a151__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.4a150/scriptconv.egg-info → scriptconv-0.0.4a151}/PKG-INFO +9 -4
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/README.md +7 -3
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/pyproject.toml +1 -0
- scriptconv-0.0.4a151/scriptconv/phonemizers/_thirdparty/nemo/NOTICE +34 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/enums.py +1 -0
- scriptconv-0.0.4a151/scriptconv/phonemizers/nemo_ipa.py +245 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/registry.py +1 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/version.py +1 -1
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151/scriptconv.egg-info}/PKG-INFO +9 -4
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv.egg-info/SOURCES.txt +3 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_base.py +2 -1
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_identity.py +1 -1
- scriptconv-0.0.4a151/tests/test_phonemizers_nemo_ipa.py +160 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_wheel_licences.py +2 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/LICENSE +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/__main__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/cangjie.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/conventions.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/data/LICENSE.cangjie5 +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/data/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/data/cangjie5_tc.tsv.gz +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/diacritics.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/frontend.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/graph.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/notation.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_identity_cache.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_moved.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_revision.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/LICENSE.f5tts +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/LICENSE.hangul_to_ipa +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/bw2ipa.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/LICENSE +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/UPSTREAM.md +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/__main__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/align.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.cmudict +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.homograph-data +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/align.json +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/g2p.json +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/g2p.npz +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/homographs.json +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/lexicon.json +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/lexicon.tsv +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/sources.json +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/convert.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/abbreviations.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/chat.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/endings.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/exceptions.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/function_words.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/homograph_fixes.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/homograph_rules.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/letters.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/phrases.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/units.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/engine.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/g2p.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/homographs.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/morphology.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/normalize.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/sentence.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/symbols.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/tables.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/f5tts.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/g2pw/LICENSE +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/g2pw/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/g2pw/bert-base-chinese_s2t_dict.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/g2pw/bopomofo_to_pinyin_wo_tune_dict.json +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/g2pw/char_bopomofo_dict.json +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/hangul2ipa.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/aspiration.csv +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/assimilation.csv +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/double_coda.csv +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/hanja.tsv +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/ipa.csv +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/neutralization.csv +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/tensification.csv +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/yale.csv +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/leokani/LICENSE +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/leokani/LICENSE-CC-BY-4.0.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/leokani/NOTICE +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/leokani/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/leokani/leokani_g2p.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/nakdimon/LICENSE +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/nakdimon/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/codeswitch.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/diacritize.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/dialectal.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/english_g2p.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/espeak.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/frontend.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/levantine_g2p.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/normalize.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/phoneme_inventory.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/vosk_g2p.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/zh_num.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_vendored/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_vendored/matoub_kab/LICENSE.md +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_vendored/matoub_kab/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/africa.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ar.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/base.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ber.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/dizione.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/en.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/eu.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/f5tts.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/fa.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/g2pw.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ghana.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/gl.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/he.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ja.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ko.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/leokani.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/lir.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/mul.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/mwl.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/o2ipa.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/openjtalk_engine.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/pt.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ru.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/shami.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/vi.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/phonemizers/zh.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/py.typed +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/readings.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/scripts.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/testing/__init__.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/testing/compare.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv/translit.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv.egg-info/dependency_links.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv.egg-info/requires.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/scriptconv.egg-info/top_level.txt +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/setup.cfg +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_arabic_diacritics_routing.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_arpa_stress.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_backend_table.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_byt5_lang_prefix.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_cangjie.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_charsiu_match_tags.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_cli.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_conventions.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_core_imports.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_diacritics.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_diacritics_graph.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_diacritics_nakdimon.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_diacritics_nfd_letters.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_doc_pages.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_errors_policy.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_examples.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_frontend.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_frontend_chunks.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_frontend_join.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_frontend_order.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_frontend_phonemizer_lang.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_frontend_say_as.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_frontend_stage_edges.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_graph.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_graph_lossless.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_gruut_lexicon_cache.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_he_extra_declares_phonikud.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_identity_cache.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_lang_default_region.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_match_lang_direction.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_match_lang_preferred_value.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_notation.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_notation_sources.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_notation_strict.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_openjtalk_engine.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_cjk_ar.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_copyleft_he_ja_th.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_dizione.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_dizione_long_tokens.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_epitran_english.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_epitran_japanese.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_epitran_korean.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_espeak_lt_accent.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_eu_euskaphone.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_f5tts.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_friendly_import_errors.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_g2pw.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_goruut_marks.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_goruut_server.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_grapheme_arguments.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_kolokwa.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_leokani.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_marks.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_matoub_kab.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_mwl_barranquenho.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_o2i_lexicons.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_phonetisaurus.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_phonetisaurus_engine.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_pt_tugaphone.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_punctuation.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_ru.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_shami_digit_runs.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_phonemizers_shami_inventory.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_readings_zh.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_scripts.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_scripts_stressonnx_compat.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_sister_packages.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_stress_marks.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_testing_compare.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_translit.py +0 -0
- {scriptconv-0.0.4a150 → scriptconv-0.0.4a151}/tests/test_tugaphone_identity_no_revision.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.4a151
|
|
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
|
|
@@ -30,6 +30,7 @@ License-File: scriptconv/phonemizers/_thirdparty/leokani/LICENSE
|
|
|
30
30
|
License-File: scriptconv/phonemizers/_thirdparty/leokani/NOTICE
|
|
31
31
|
License-File: scriptconv/phonemizers/_thirdparty/leokani/LICENSE-CC-BY-4.0.txt
|
|
32
32
|
License-File: scriptconv/phonemizers/_thirdparty/nakdimon/LICENSE
|
|
33
|
+
License-File: scriptconv/phonemizers/_thirdparty/nemo/NOTICE
|
|
33
34
|
Provides-Extra: ja
|
|
34
35
|
Requires-Dist: scriptconv-copyleft[ja]>=0.1.2a1; extra == "ja"
|
|
35
36
|
Provides-Extra: zh
|
|
@@ -505,8 +506,8 @@ Three rules hold for every backend:
|
|
|
505
506
|
and phonetisaurus need a local `model=` path. These download on first use:
|
|
506
507
|
the phonikud and Nakdimon Hebrew diacritizers, the fp32 text2tashkeel
|
|
507
508
|
weights, the stressonnx models, the g2pW model, the Leokani G2P and
|
|
508
|
-
kolokwa-g2p models,
|
|
509
|
-
the `g2pen` backend.
|
|
509
|
+
kolokwa-g2p models, the two data files of the `nemo_ipa` backend, a named
|
|
510
|
+
DeepPhonemizer checkpoint and the NLTK data of the `g2pen` backend.
|
|
510
511
|
[docs/backends.md](docs/backends.md#model-files) names each cache location.
|
|
511
512
|
- **orthography2ipa uses the packaged lexicons.** The `o2i` extra installs
|
|
512
513
|
[o2i-lexicons](https://github.com/TigreGotico/o2i-lexicons), which holds
|
|
@@ -588,6 +589,7 @@ part in this table:
|
|
|
588
589
|
| dizione dictionary, alignment table and model (CMUdict) | CMUdict | `scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.cmudict` |
|
|
589
590
|
| dizione homograph weights (Wikipedia Homograph Data) | Apache-2.0 | `scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.homograph-data` |
|
|
590
591
|
| Leokani G2P English phonemizer of Milliwatt Labs | MIT | `scriptconv/phonemizers/_thirdparty/leokani/LICENSE` and `NOTICE` |
|
|
592
|
+
| NVIDIA NeMo IpaG2p logic, in the `nemo_ipa` backend (no NeMo file) | Apache-2.0 | `scriptconv/phonemizers/_thirdparty/nemo/NOTICE` |
|
|
591
593
|
|
|
592
594
|
The CMUdict licence is BSD-2-Clause with one added sentence and an
|
|
593
595
|
acknowledgement. It has no SPDX identifier, so the wheel names it
|
|
@@ -602,7 +604,10 @@ notice file.
|
|
|
602
604
|
The Leokani G2P model files are CC BY 4.0, and the wheel holds the text of
|
|
603
605
|
that licence in `scriptconv/phonemizers/_thirdparty/leokani/`. The model of
|
|
604
606
|
the `kolokwa` backend is MIT. Neither model is in the wheel: each backend
|
|
605
|
-
downloads its model.
|
|
607
|
+
downloads its model. The `nemo_ipa` backend downloads two NVIDIA files in the
|
|
608
|
+
copies of the Magpie TTS checkpoint: a pronunciation dictionary, which is the
|
|
609
|
+
CMU Pronouncing Dictionary with IPA pronunciations, and a heteronyms file. Both
|
|
610
|
+
are Apache-2.0 in the NeMo tree. Neither file is in the wheel.
|
|
606
611
|
|
|
607
612
|
The phonemizer wrappers whose code, engine or dependencies are under a
|
|
608
613
|
copyleft or a non-commercial licence are in two sister packages:
|
|
@@ -312,8 +312,8 @@ Three rules hold for every backend:
|
|
|
312
312
|
and phonetisaurus need a local `model=` path. These download on first use:
|
|
313
313
|
the phonikud and Nakdimon Hebrew diacritizers, the fp32 text2tashkeel
|
|
314
314
|
weights, the stressonnx models, the g2pW model, the Leokani G2P and
|
|
315
|
-
kolokwa-g2p models,
|
|
316
|
-
the `g2pen` backend.
|
|
315
|
+
kolokwa-g2p models, the two data files of the `nemo_ipa` backend, a named
|
|
316
|
+
DeepPhonemizer checkpoint and the NLTK data of the `g2pen` backend.
|
|
317
317
|
[docs/backends.md](docs/backends.md#model-files) names each cache location.
|
|
318
318
|
- **orthography2ipa uses the packaged lexicons.** The `o2i` extra installs
|
|
319
319
|
[o2i-lexicons](https://github.com/TigreGotico/o2i-lexicons), which holds
|
|
@@ -395,6 +395,7 @@ part in this table:
|
|
|
395
395
|
| dizione dictionary, alignment table and model (CMUdict) | CMUdict | `scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.cmudict` |
|
|
396
396
|
| dizione homograph weights (Wikipedia Homograph Data) | Apache-2.0 | `scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.homograph-data` |
|
|
397
397
|
| Leokani G2P English phonemizer of Milliwatt Labs | MIT | `scriptconv/phonemizers/_thirdparty/leokani/LICENSE` and `NOTICE` |
|
|
398
|
+
| NVIDIA NeMo IpaG2p logic, in the `nemo_ipa` backend (no NeMo file) | Apache-2.0 | `scriptconv/phonemizers/_thirdparty/nemo/NOTICE` |
|
|
398
399
|
|
|
399
400
|
The CMUdict licence is BSD-2-Clause with one added sentence and an
|
|
400
401
|
acknowledgement. It has no SPDX identifier, so the wheel names it
|
|
@@ -409,7 +410,10 @@ notice file.
|
|
|
409
410
|
The Leokani G2P model files are CC BY 4.0, and the wheel holds the text of
|
|
410
411
|
that licence in `scriptconv/phonemizers/_thirdparty/leokani/`. The model of
|
|
411
412
|
the `kolokwa` backend is MIT. Neither model is in the wheel: each backend
|
|
412
|
-
downloads its model.
|
|
413
|
+
downloads its model. The `nemo_ipa` backend downloads two NVIDIA files in the
|
|
414
|
+
copies of the Magpie TTS checkpoint: a pronunciation dictionary, which is the
|
|
415
|
+
CMU Pronouncing Dictionary with IPA pronunciations, and a heteronyms file. Both
|
|
416
|
+
are Apache-2.0 in the NeMo tree. Neither file is in the wheel.
|
|
413
417
|
|
|
414
418
|
The phonemizer wrappers whose code, engine or dependencies are under a
|
|
415
419
|
copyleft or a non-commercial licence are in two sister packages:
|
|
@@ -22,6 +22,7 @@ license-files = [
|
|
|
22
22
|
"scriptconv/phonemizers/_thirdparty/leokani/NOTICE",
|
|
23
23
|
"scriptconv/phonemizers/_thirdparty/leokani/LICENSE-CC-BY-4.0.txt",
|
|
24
24
|
"scriptconv/phonemizers/_thirdparty/nakdimon/LICENSE",
|
|
25
|
+
"scriptconv/phonemizers/_thirdparty/nemo/NOTICE",
|
|
25
26
|
]
|
|
26
27
|
requires-python = ">=3.11"
|
|
27
28
|
dependencies = []
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
NeMo IPA phonemizer (scriptconv/phonemizers/nemo_ipa.py)
|
|
2
|
+
|
|
3
|
+
This module follows the logic of the IpaG2p, IPATokenizer and text
|
|
4
|
+
preprocessing code of NVIDIA NeMo, https://github.com/NVIDIA/NeMo, at commit
|
|
5
|
+
fd6a877539710e2b98f28c43272ff81312f83417 (tag v3.0.0):
|
|
6
|
+
|
|
7
|
+
nemo/collections/tts/g2p/models/i18n_ipa.py
|
|
8
|
+
nemo/collections/common/tokenizers/text_to_speech/tokenizer_utils.py
|
|
9
|
+
nemo/collections/common/tokenizers/text_to_speech/tts_tokenizers.py
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
12
|
+
|
|
13
|
+
NeMo is licensed under the Apache License, Version 2.0
|
|
14
|
+
(http://www.apache.org/licenses/LICENSE-2.0). NeMo has no NOTICE file. The
|
|
15
|
+
module is a new implementation for strings of that logic: it holds no file of
|
|
16
|
+
NeMo, it needs no NeMo or torch package, and it differs from NeMo in the two
|
|
17
|
+
places that its module docstring lists.
|
|
18
|
+
|
|
19
|
+
The module downloads two data files from the Hugging Face repository
|
|
20
|
+
Phoonnx/magpietts-multi-357m-unicode, at the copy that the Magpie TTS
|
|
21
|
+
checkpoint holds. Neither file is in the wheel.
|
|
22
|
+
|
|
23
|
+
ipa_cmudict-0.7b_nv23.01.txt is an NVIDIA file of the NeMo tree
|
|
24
|
+
(scripts/tts_dataset_files, Apache-2.0). It holds the pronunciations of the
|
|
25
|
+
CMU Pronouncing Dictionary, whose licence is BSD-2-Clause with one added
|
|
26
|
+
sentence (see scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.cmudict),
|
|
27
|
+
converted to IPA by NVIDIA. heteronyms-052722 is also an NVIDIA file of that
|
|
28
|
+
tree, under Apache-2.0.
|
|
29
|
+
|
|
30
|
+
The Magpie copy of the dictionary has sha256 7ea5c4c2. The copy in NeMo at the
|
|
31
|
+
commit above has sha256 dd0927ff. Both have the same size, and they differ
|
|
32
|
+
only in the order of the two readings of A: Magpie has the schwa reading
|
|
33
|
+
first, and NeMo has the diphthong reading first. The module pins the Magpie
|
|
34
|
+
copy.
|
|
@@ -61,6 +61,7 @@ class Phonemizer(str, Enum):
|
|
|
61
61
|
G2PEN = "g2pen" # en
|
|
62
62
|
DIZIONE = "dizione" # en-US (CMUdict lexicon, homograph rules, text rules)
|
|
63
63
|
LEOKANI = "leokani" # en-US (Kokoro/misaki codes; lexicon, ONNX letter-to-sound and context models)
|
|
64
|
+
NEMO_IPA = "nemo_ipa" # en-US (NVIDIA NeMo IpaG2p: ipa_cmudict-0.7b_nv23.01 plus heteronyms-052722)
|
|
64
65
|
KOLOKWA = "kolokwa" # lir, Liberian English (kolokwa-g2p model)
|
|
65
66
|
|
|
66
67
|
TUGAPHONE = "tugaphone" # pt
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"""American English phonemizer: the IPA G2P of NVIDIA NeMo, as Magpie TTS reads it.
|
|
2
|
+
|
|
3
|
+
Magpie TTS reads English through its ``english_phoneme`` sub-tokenizer, an
|
|
4
|
+
``IPATokenizer`` over an ``IpaG2p``. This backend gives the symbol string
|
|
5
|
+
that the sub-tokenizer encodes: one character for each of the 94 symbols of
|
|
6
|
+
its vocabulary (the tokenizer has 96 tokens, with ``<pad>`` and ``<oov>``), so
|
|
7
|
+
a caller maps each character to its token id. It takes
|
|
8
|
+
no random draw. NeMo keeps a word as letters with a probability while it
|
|
9
|
+
trains, and this backend always gives the phonemes of the word.
|
|
10
|
+
|
|
11
|
+
The steps follow NeMo at commit ``fd6a877539710e2b98f28c43272ff81312f83417``
|
|
12
|
+
(tag v3.0.0), in these files:
|
|
13
|
+
|
|
14
|
+
- ``nemo/collections/common/tokenizers/text_to_speech/tokenizer_utils.py``:
|
|
15
|
+
``english_text_preprocessing`` and ``english_word_tokenize``;
|
|
16
|
+
- ``nemo/collections/tts/g2p/models/i18n_ipa.py``: ``IpaG2p``;
|
|
17
|
+
- ``nemo/collections/common/tokenizers/text_to_speech/tts_tokenizers.py``:
|
|
18
|
+
``IPATokenizer.encode_from_g2p``.
|
|
19
|
+
|
|
20
|
+
NeMo is Apache-2.0, Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. See
|
|
21
|
+
``scriptconv/phonemizers/_thirdparty/nemo/NOTICE``. This module holds no code
|
|
22
|
+
of NeMo, only its logic, written again for strings.
|
|
23
|
+
|
|
24
|
+
The settings are those of the ``english_phoneme`` entry in the Magpie TTS
|
|
25
|
+
config: ``ignore_ambiguous_words=False`` (a word with several pronunciations
|
|
26
|
+
takes the first), ``use_chars=True``, ``use_stresses=True``, ``punct=True``,
|
|
27
|
+
``apostrophe=True`` and ``pad_with_space=False``.
|
|
28
|
+
|
|
29
|
+
The data are two files that NeMo names in that config. They are not in the
|
|
30
|
+
wheel. By default they come from the Hugging Face Hub, from
|
|
31
|
+
:data:`DATA_REPO` at :data:`DATA_REVISION`, into the shared cache, and each
|
|
32
|
+
must have its pinned sha256. A caller can give the path of either file.
|
|
33
|
+
``ipa_cmudict-0.7b_nv23.01.txt`` is the CMU Pronouncing Dictionary with IPA
|
|
34
|
+
pronunciations, and ``heteronyms-052722`` lists the words that NeMo leaves as
|
|
35
|
+
letters. The pinned dictionary is the copy in the Magpie TTS checkpoint
|
|
36
|
+
(sha256 ``7ea5c4c2``), not the copy in ``scripts/tts_dataset_files`` of NeMo
|
|
37
|
+
(sha256 ``dd0927ff``). The two have the same size and differ only in the order
|
|
38
|
+
of the two readings of ``A``: Magpie has ``ˈʌ`` first and NeMo has ``ˈeɪ``
|
|
39
|
+
first. The pin follows the checkpoint.
|
|
40
|
+
|
|
41
|
+
The output differs from NeMo in two places. NeMo stops with an ``IndexError``
|
|
42
|
+
on any text whose kept symbols are only spaces, as ``½ ¼ ¾``, and this backend
|
|
43
|
+
gives an empty string. In a span between two ``|`` marks, which NeMo keeps
|
|
44
|
+
unchanged, the tokens ``<pad>`` and ``<oov>`` give the id of the special token
|
|
45
|
+
in NeMo and nothing here.
|
|
46
|
+
"""
|
|
47
|
+
import dataclasses
|
|
48
|
+
import re
|
|
49
|
+
import unicodedata
|
|
50
|
+
from pathlib import Path
|
|
51
|
+
from typing import Dict, List, Optional, Set, Tuple, Union
|
|
52
|
+
|
|
53
|
+
from scriptconv.phonemizers.base import (
|
|
54
|
+
BasePhonemizer,
|
|
55
|
+
MissingLanguageError,
|
|
56
|
+
PhonemizerIdentity,
|
|
57
|
+
UnsupportedLanguageError,
|
|
58
|
+
_check_alphabet,
|
|
59
|
+
)
|
|
60
|
+
from scriptconv.phonemizers.enums import Alphabet
|
|
61
|
+
from scriptconv.phonemizers.g2pw import _hub_file, _sha256
|
|
62
|
+
|
|
63
|
+
__all__ = ["NemoIpaPhonemizer", "DATA_REPO", "DATA_REVISION", "DATA_FILES", "NEMO_COMMIT"]
|
|
64
|
+
|
|
65
|
+
NEMO_COMMIT = "fd6a877539710e2b98f28c43272ff81312f83417"
|
|
66
|
+
DATA_REPO = "Phoonnx/magpietts-multi-357m-unicode"
|
|
67
|
+
DATA_REVISION = "a0e169ad4a160578974af51181a126d52dab6ab6"
|
|
68
|
+
#: name -> (path in :data:`DATA_REPO`, sha256)
|
|
69
|
+
DATA_FILES = {
|
|
70
|
+
"dictionary": ("assets/tokenizer/dc7d60d6b15a4651b21c9ca2932b62c6_ipa_cmudict-0.7b_nv23.01.txt",
|
|
71
|
+
"7ea5c4c2c59cc780748b24d4ab60bd689779c4ac4ea7e27c0a8c3e20f300c0fa"),
|
|
72
|
+
"heteronyms": ("assets/tokenizer/61d57a4ccb064d1e8e3d9f871c571932_heteronyms-052722",
|
|
73
|
+
"b701909aedf753172eff223950f8859cd4b9b4c80199cf0a6e9ac4a307c8f8ec"),
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_LATIN = "A-Za-z"
|
|
77
|
+
_WORD_CHARS = (_LATIN + "À-ÖØ-öø-ÿ"
|
|
78
|
+
r"ऀ-ॣ०-ॿঀ--ఀ-౿ಀ--૿"
|
|
79
|
+
r"가-힣ᄀ-ᇿ-")
|
|
80
|
+
_HAS_CHAR = re.compile(fr"[{_WORD_CHARS}\d]")
|
|
81
|
+
_NOT_CHAR = re.compile(fr"[^{_WORD_CHARS}\d]")
|
|
82
|
+
_ENTRY = re.compile(fr"[{_WORD_CHARS}']")
|
|
83
|
+
_ALTERNATIVE = re.compile(r"\([0-9]+\)")
|
|
84
|
+
# a word, a span between two bars that stays unchanged, or anything else
|
|
85
|
+
_ENGLISH_WORDS = re.compile(
|
|
86
|
+
fr"([{_LATIN}]+(?:[{_LATIN}\-']*[{_LATIN}]+)*)|(\|[^|]*\|)|([^{_LATIN}|]+)")
|
|
87
|
+
_SYNOGLYPHS = str.maketrans({"’": "'", "”": '"', "“": '"'})
|
|
88
|
+
#: NeMo's ``DEFAULT_PUNCTUATION``, the punctuation of ``en-US``
|
|
89
|
+
_PUNCTUATION = frozenset(",.!?-:;/\"()[]{}")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _preprocess(text: str) -> str:
|
|
93
|
+
"""*text* without combining marks and with straight quotes, in NFC, as the tokenizer and the G2P read it."""
|
|
94
|
+
text = "".join(c for c in unicodedata.normalize("NFD", text) if unicodedata.category(c) != "Mn")
|
|
95
|
+
return unicodedata.normalize("NFC", text.translate(_SYNOGLYPHS))
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _read_dictionary(path: str) -> Tuple[Dict[str, List[List[str]]], Set[str]]:
|
|
99
|
+
"""The pronunciations by upper-case word, and the symbols of the dictionary.
|
|
100
|
+
|
|
101
|
+
A word with ``(2)`` and the like after it adds a pronunciation to the
|
|
102
|
+
word. The symbols are the characters of each pronunciation and of each
|
|
103
|
+
word without punctuation.
|
|
104
|
+
"""
|
|
105
|
+
entries: Dict[str, List[List[str]]] = {}
|
|
106
|
+
with open(path, encoding="utf-8") as f:
|
|
107
|
+
for line in f:
|
|
108
|
+
line = unicodedata.normalize("NFC", line)
|
|
109
|
+
if _ENTRY.match(line):
|
|
110
|
+
word, pronunciation = line.strip().split(maxsplit=1)
|
|
111
|
+
entries.setdefault(_ALTERNATIVE.sub("", word), []).append(list(re.sub(r"\s+", "", pronunciation)))
|
|
112
|
+
pronunciations: Dict[str, List[List[str]]] = {}
|
|
113
|
+
symbols: Set[str] = set()
|
|
114
|
+
for word, variants in entries.items():
|
|
115
|
+
word = word.upper()
|
|
116
|
+
symbols.update(_NOT_CHAR.sub("", word))
|
|
117
|
+
for variant in variants:
|
|
118
|
+
symbols.update(variant)
|
|
119
|
+
pronunciations[word] = variants
|
|
120
|
+
return pronunciations, symbols
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class NemoIpaPhonemizer(BasePhonemizer):
|
|
124
|
+
"""NVIDIA NeMo's English IPA G2P: text to the symbols of the Magpie TTS ``english_phoneme`` vocabulary.
|
|
125
|
+
|
|
126
|
+
A word of the dictionary gives the IPA symbols of its first
|
|
127
|
+
pronunciation, with the stress marks ``ˈ`` and ``ˌ``. A word of the
|
|
128
|
+
heteronyms file, a word that the dictionary lacks and a digit give upper-case
|
|
129
|
+
letters and digits. A character that the vocabulary lacks is dropped.
|
|
130
|
+
Spaces stay, also two in a row, except at the end of the text. The
|
|
131
|
+
punctuation of the vocabulary stays.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
alphabet: must be :attr:`Alphabet.IPA`.
|
|
135
|
+
dictionary: the path of a dictionary in the format of
|
|
136
|
+
``ipa_cmudict-0.7b_nv23.01.txt``. The default is the file of
|
|
137
|
+
:data:`DATA_FILES`, downloaded from :data:`DATA_REPO`.
|
|
138
|
+
heteronyms: the path of a file with one heteronym on each line. The
|
|
139
|
+
default is the file of :data:`DATA_FILES`.
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
def __init__(self, alphabet: Alphabet = Alphabet.IPA,
|
|
143
|
+
dictionary: Optional[Union[str, Path]] = None,
|
|
144
|
+
heteronyms: Optional[Union[str, Path]] = None):
|
|
145
|
+
_check_alphabet(self, alphabet, [Alphabet.IPA])
|
|
146
|
+
super().__init__(alphabet)
|
|
147
|
+
paths: Dict[str, str] = {}
|
|
148
|
+
self.sha256: Dict[str, str] = {}
|
|
149
|
+
for name, given in (("dictionary", dictionary), ("heteronyms", heteronyms)):
|
|
150
|
+
filename, sha256 = DATA_FILES[name]
|
|
151
|
+
if given is None:
|
|
152
|
+
try:
|
|
153
|
+
import huggingface_hub # noqa: F401
|
|
154
|
+
except ImportError:
|
|
155
|
+
raise ImportError(
|
|
156
|
+
"The NeMo IPA phonemizer needs huggingface_hub to download its data. Install it with "
|
|
157
|
+
"`pip install scriptconv[en-phonemizers]`, or pass the paths of the files.") from None
|
|
158
|
+
paths[name] = _hub_file(DATA_REPO, "model", filename, DATA_REVISION, sha256)
|
|
159
|
+
self.sha256[name] = sha256
|
|
160
|
+
else:
|
|
161
|
+
paths[name] = str(given)
|
|
162
|
+
self.sha256[name] = _sha256(paths[name])
|
|
163
|
+
self.pronunciations, symbols = _read_dictionary(paths["dictionary"])
|
|
164
|
+
with open(paths["heteronyms"], encoding="utf-8") as f:
|
|
165
|
+
self.heteronyms = {line.rstrip().upper() for line in f}
|
|
166
|
+
self.vocabulary = symbols | _PUNCTUATION | {"'", " "}
|
|
167
|
+
|
|
168
|
+
@classmethod
|
|
169
|
+
def get_lang(cls, target_lang: str) -> str:
|
|
170
|
+
"""*target_lang* as a standard tag, when it is American English.
|
|
171
|
+
|
|
172
|
+
A tag with no region takes its default region, so ``en`` is ``en-GB``
|
|
173
|
+
and is refused.
|
|
174
|
+
|
|
175
|
+
Raises:
|
|
176
|
+
MissingLanguageError: If no language is given.
|
|
177
|
+
UnsupportedLanguageError: If the tag is not English of the US.
|
|
178
|
+
"""
|
|
179
|
+
if target_lang in (None, "", "und"):
|
|
180
|
+
raise MissingLanguageError(f"no language provided to phonemize: {target_lang!r}")
|
|
181
|
+
from linguatag import closest_lang, with_default_region
|
|
182
|
+
tag = with_default_region(target_lang)
|
|
183
|
+
if closest_lang(tag, ["en-US"], max_distance=0) is None:
|
|
184
|
+
raise UnsupportedLanguageError(
|
|
185
|
+
f"unsupported language code: {target_lang}; the NeMo IPA G2P reads en-US only")
|
|
186
|
+
return tag
|
|
187
|
+
|
|
188
|
+
def phonemize_string(self, text: str, lang: str) -> str:
|
|
189
|
+
self.get_lang(lang)
|
|
190
|
+
symbols: List[str] = []
|
|
191
|
+
for word, unchanged, other in _ENGLISH_WORDS.findall(_preprocess(text)):
|
|
192
|
+
if word:
|
|
193
|
+
symbols += self._read(word.lower())
|
|
194
|
+
elif other:
|
|
195
|
+
symbols += self._read(other)
|
|
196
|
+
else:
|
|
197
|
+
symbols += unchanged[1:-1].split(" ")
|
|
198
|
+
return "".join(s for s in symbols if s in self.vocabulary).rstrip(" ")
|
|
199
|
+
|
|
200
|
+
def _read(self, word: str) -> List[str]:
|
|
201
|
+
"""The symbols of a word, or of a run of characters between two words, as ``IpaG2p`` gives them.
|
|
202
|
+
|
|
203
|
+
A word that is not in the dictionary is read again in parts at its
|
|
204
|
+
hyphens, with a hyphen between the parts.
|
|
205
|
+
"""
|
|
206
|
+
symbols, found = self._lookup(word)
|
|
207
|
+
if not found and "-" in word:
|
|
208
|
+
symbols = []
|
|
209
|
+
for part in word.split("-"):
|
|
210
|
+
symbols += self._lookup(part)[0] + ["-"]
|
|
211
|
+
symbols.pop()
|
|
212
|
+
return symbols
|
|
213
|
+
|
|
214
|
+
def _lookup(self, word: str) -> Tuple[List[str], bool]:
|
|
215
|
+
"""The symbols of *word*, and whether the dictionary or a rule gave them.
|
|
216
|
+
|
|
217
|
+
A run with no letter or digit, a heteronym and a word that the
|
|
218
|
+
dictionary lacks give upper-case letters. A word in the dictionary
|
|
219
|
+
gives its first pronunciation. A word with ``'s`` or ``s`` after a
|
|
220
|
+
word of the dictionary gives its pronunciation and then ``s``, ``z``
|
|
221
|
+
or ``ɪz``.
|
|
222
|
+
"""
|
|
223
|
+
word = word.upper()
|
|
224
|
+
if not _HAS_CHAR.search(word) or word in self.heteronyms:
|
|
225
|
+
return list(word), True
|
|
226
|
+
pronunciations = self.pronunciations
|
|
227
|
+
if word in pronunciations:
|
|
228
|
+
return pronunciations[word][0], True
|
|
229
|
+
if len(word) > 2 and word.endswith("'S") and word[:-2] in pronunciations:
|
|
230
|
+
stem = word[:-2]
|
|
231
|
+
ending = ["s"] if stem[-1] == "T" else ["ɪ", "z"] if stem[-1] == "S" else ["z"]
|
|
232
|
+
return pronunciations[stem][0] + ending, True
|
|
233
|
+
if len(word) > 1 and word.endswith("S") and word[:-1] in pronunciations:
|
|
234
|
+
stem = word[:-1]
|
|
235
|
+
return pronunciations[stem][0] + ["s" if stem[-1] == "T" else "z"], True
|
|
236
|
+
return list(word), False
|
|
237
|
+
|
|
238
|
+
def identity(self, lang: str) -> PhonemizerIdentity:
|
|
239
|
+
"""The base identity, with ``revision`` the hash of the code on the
|
|
240
|
+
path of this backend, as
|
|
241
|
+
:func:`~scriptconv.phonemizers._revision.code_revision` gives it, and
|
|
242
|
+
of the sha256 of the dictionary and of the heteronyms file."""
|
|
243
|
+
from scriptconv.phonemizers._revision import code_revision
|
|
244
|
+
identity = super().identity(lang)
|
|
245
|
+
return dataclasses.replace(identity, revision=code_revision(self, identity.lang, self.sha256))
|
|
@@ -56,6 +56,7 @@ PHONEMIZER_REGISTRY: Dict[Phonemizer, Tuple[str, str, Optional[str]]] = {
|
|
|
56
56
|
_P.G2PEN: (f"{_BASE}.en", "G2PEnPhonemizer", "en-phonemizers"),
|
|
57
57
|
_P.DIZIONE: (f"{_BASE}.dizione", "DizionePhonemizer", "en-phonemizers"),
|
|
58
58
|
_P.LEOKANI: (f"{_BASE}.leokani", "LeokaniPhonemizer", "en-phonemizers"),
|
|
59
|
+
_P.NEMO_IPA: (f"{_BASE}.nemo_ipa", "NemoIpaPhonemizer", "en-phonemizers"),
|
|
59
60
|
_P.KOLOKWA: (f"{_BASE}.lir", "KolokwaPhonemizer", "lir"),
|
|
60
61
|
_P.TUGAPHONE: (f"{_BASE}.pt", "TugaphonePhonemizer", "pt-phonemizers"),
|
|
61
62
|
_P.BARRANQUENHO: (f"{_BASE}.pt", "BarranquenhoPhonemizer", "o2i"),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scriptconv
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4a151
|
|
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
|
|
@@ -30,6 +30,7 @@ License-File: scriptconv/phonemizers/_thirdparty/leokani/LICENSE
|
|
|
30
30
|
License-File: scriptconv/phonemizers/_thirdparty/leokani/NOTICE
|
|
31
31
|
License-File: scriptconv/phonemizers/_thirdparty/leokani/LICENSE-CC-BY-4.0.txt
|
|
32
32
|
License-File: scriptconv/phonemizers/_thirdparty/nakdimon/LICENSE
|
|
33
|
+
License-File: scriptconv/phonemizers/_thirdparty/nemo/NOTICE
|
|
33
34
|
Provides-Extra: ja
|
|
34
35
|
Requires-Dist: scriptconv-copyleft[ja]>=0.1.2a1; extra == "ja"
|
|
35
36
|
Provides-Extra: zh
|
|
@@ -505,8 +506,8 @@ Three rules hold for every backend:
|
|
|
505
506
|
and phonetisaurus need a local `model=` path. These download on first use:
|
|
506
507
|
the phonikud and Nakdimon Hebrew diacritizers, the fp32 text2tashkeel
|
|
507
508
|
weights, the stressonnx models, the g2pW model, the Leokani G2P and
|
|
508
|
-
kolokwa-g2p models,
|
|
509
|
-
the `g2pen` backend.
|
|
509
|
+
kolokwa-g2p models, the two data files of the `nemo_ipa` backend, a named
|
|
510
|
+
DeepPhonemizer checkpoint and the NLTK data of the `g2pen` backend.
|
|
510
511
|
[docs/backends.md](docs/backends.md#model-files) names each cache location.
|
|
511
512
|
- **orthography2ipa uses the packaged lexicons.** The `o2i` extra installs
|
|
512
513
|
[o2i-lexicons](https://github.com/TigreGotico/o2i-lexicons), which holds
|
|
@@ -588,6 +589,7 @@ part in this table:
|
|
|
588
589
|
| dizione dictionary, alignment table and model (CMUdict) | CMUdict | `scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.cmudict` |
|
|
589
590
|
| dizione homograph weights (Wikipedia Homograph Data) | Apache-2.0 | `scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.homograph-data` |
|
|
590
591
|
| Leokani G2P English phonemizer of Milliwatt Labs | MIT | `scriptconv/phonemizers/_thirdparty/leokani/LICENSE` and `NOTICE` |
|
|
592
|
+
| NVIDIA NeMo IpaG2p logic, in the `nemo_ipa` backend (no NeMo file) | Apache-2.0 | `scriptconv/phonemizers/_thirdparty/nemo/NOTICE` |
|
|
591
593
|
|
|
592
594
|
The CMUdict licence is BSD-2-Clause with one added sentence and an
|
|
593
595
|
acknowledgement. It has no SPDX identifier, so the wheel names it
|
|
@@ -602,7 +604,10 @@ notice file.
|
|
|
602
604
|
The Leokani G2P model files are CC BY 4.0, and the wheel holds the text of
|
|
603
605
|
that licence in `scriptconv/phonemizers/_thirdparty/leokani/`. The model of
|
|
604
606
|
the `kolokwa` backend is MIT. Neither model is in the wheel: each backend
|
|
605
|
-
downloads its model.
|
|
607
|
+
downloads its model. The `nemo_ipa` backend downloads two NVIDIA files in the
|
|
608
|
+
copies of the Magpie TTS checkpoint: a pronunciation dictionary, which is the
|
|
609
|
+
CMU Pronouncing Dictionary with IPA pronunciations, and a heteronyms file. Both
|
|
610
|
+
are Apache-2.0 in the NeMo tree. Neither file is in the wheel.
|
|
606
611
|
|
|
607
612
|
The phonemizer wrappers whose code, engine or dependencies are under a
|
|
608
613
|
copyleft or a non-commercial licence are in two sister packages:
|
|
@@ -46,6 +46,7 @@ scriptconv/phonemizers/leokani.py
|
|
|
46
46
|
scriptconv/phonemizers/lir.py
|
|
47
47
|
scriptconv/phonemizers/mul.py
|
|
48
48
|
scriptconv/phonemizers/mwl.py
|
|
49
|
+
scriptconv/phonemizers/nemo_ipa.py
|
|
49
50
|
scriptconv/phonemizers/o2ipa.py
|
|
50
51
|
scriptconv/phonemizers/openjtalk_engine.py
|
|
51
52
|
scriptconv/phonemizers/pt.py
|
|
@@ -115,6 +116,7 @@ scriptconv/phonemizers/_thirdparty/leokani/__init__.py
|
|
|
115
116
|
scriptconv/phonemizers/_thirdparty/leokani/leokani_g2p.py
|
|
116
117
|
scriptconv/phonemizers/_thirdparty/nakdimon/LICENSE
|
|
117
118
|
scriptconv/phonemizers/_thirdparty/nakdimon/__init__.py
|
|
119
|
+
scriptconv/phonemizers/_thirdparty/nemo/NOTICE
|
|
118
120
|
scriptconv/phonemizers/_thirdparty/shami/__init__.py
|
|
119
121
|
scriptconv/phonemizers/_thirdparty/shami/codeswitch.py
|
|
120
122
|
scriptconv/phonemizers/_thirdparty/shami/diacritize.py
|
|
@@ -187,6 +189,7 @@ tests/test_phonemizers_leokani.py
|
|
|
187
189
|
tests/test_phonemizers_marks.py
|
|
188
190
|
tests/test_phonemizers_matoub_kab.py
|
|
189
191
|
tests/test_phonemizers_mwl_barranquenho.py
|
|
192
|
+
tests/test_phonemizers_nemo_ipa.py
|
|
190
193
|
tests/test_phonemizers_o2i_lexicons.py
|
|
191
194
|
tests/test_phonemizers_phonetisaurus.py
|
|
192
195
|
tests/test_phonemizers_phonetisaurus_engine.py
|
|
@@ -33,12 +33,13 @@ class TestEnums(unittest.TestCase):
|
|
|
33
33
|
self.assertEqual(Phonemizer.DIZIONE.value, "dizione")
|
|
34
34
|
self.assertEqual(Phonemizer.G2PW.value, "g2pw")
|
|
35
35
|
self.assertEqual(Phonemizer.LEOKANI.value, "leokani")
|
|
36
|
+
self.assertEqual(Phonemizer.NEMO_IPA.value, "nemo_ipa")
|
|
36
37
|
self.assertEqual(Phonemizer.KOLOKWA.value, "kolokwa")
|
|
37
38
|
self.assertEqual(Phonemizer.ESPEAK_LT_ACCENT.value, "espeak_lt_accent")
|
|
38
39
|
self.assertEqual(Phonemizer.HEBREW_IPA.value, "hebrew_ipa")
|
|
39
40
|
self.assertEqual(Phonemizer.OPENJTALK_PROSODY.value, "openjtalk_prosody")
|
|
40
41
|
self.assertEqual(Phonemizer.TLTK.value, "tltk")
|
|
41
|
-
self.assertEqual(len(list(Phonemizer)),
|
|
42
|
+
self.assertEqual(len(list(Phonemizer)), 59) # +HALABI, +IQRA, +GHANA_G2P, +PHONETISAURUS, +MATOUB_KAB, +DIZIONE, +G2PW, +F5TTS_CHAR, +F5TTS_PINYIN, +LEOKANI, +KOLOKWA, +ESPEAK_LT_ACCENT, +HEBREW_IPA, +OPENJTALK_PROSODY, +TLTK, +NEMO_IPA
|
|
42
43
|
self.assertEqual(len(list(Alphabet)), 23) # incl. HALABI, VOSK, AFRICA_G2P
|
|
43
44
|
|
|
44
45
|
|
|
@@ -64,7 +64,7 @@ IN_TREE = {
|
|
|
64
64
|
Phonemizer.MANTOQ, Phonemizer.HALABI, Phonemizer.IQRA, Phonemizer.KOG2PK,
|
|
65
65
|
Phonemizer.SHAMI, Phonemizer.VOSK, Phonemizer.BYT5, Phonemizer.CHARSIU,
|
|
66
66
|
Phonemizer.DIZIONE, Phonemizer.G2PW, Phonemizer.F5TTS_CHAR, Phonemizer.LEOKANI,
|
|
67
|
-
Phonemizer.KOLOKWA, Phonemizer.HEBREW_IPA,
|
|
67
|
+
Phonemizer.KOLOKWA, Phonemizer.HEBREW_IPA, Phonemizer.NEMO_IPA,
|
|
68
68
|
}
|
|
69
69
|
# An engine that no extra can name: a binary, and a distribution the zh extra
|
|
70
70
|
# does not list.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"""The NeMo IPA backend gives the symbols that NVIDIA NeMo's English IpaG2p gives.
|
|
2
|
+
|
|
3
|
+
``tests/data/nemo_en_ids.json`` holds 63 lines. Each has the text, and the ids
|
|
4
|
+
and tokens that ``IPATokenizer.encode`` of the Magpie TTS ``english_phoneme``
|
|
5
|
+
sub-tokenizer gives with ``phoneme_probability`` 1.0, from an unmodified
|
|
6
|
+
nemo_toolkit 3.0.0 (NeMo commit fd6a877539710e2b98f28c43272ff81312f83417). The
|
|
7
|
+
generator is ``knowledge/wiki/audits/phoonnx-magpie-english/gen_nemo_ids.py`` of
|
|
8
|
+
the AgentWorkspaces tree. ``tests/data/nemo_vocab.json`` is the 96-token
|
|
9
|
+
vocabulary of that tokenizer, which is the first 96 tokens of the Magpie TTS
|
|
10
|
+
tokenizer asset. The expected string of a line is ``"".join(tokens)``.
|
|
11
|
+
"""
|
|
12
|
+
import inspect
|
|
13
|
+
import json
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from unittest.mock import patch
|
|
18
|
+
|
|
19
|
+
import pytest
|
|
20
|
+
|
|
21
|
+
from scriptconv.phonemizers import (
|
|
22
|
+
ModelUnavailableError,
|
|
23
|
+
Phonemizer,
|
|
24
|
+
UnsupportedLanguageError,
|
|
25
|
+
get_phonemizer,
|
|
26
|
+
get_phonemizer_class,
|
|
27
|
+
)
|
|
28
|
+
from scriptconv.phonemizers.nemo_ipa import DATA_FILES, DATA_REPO, DATA_REVISION, NemoIpaPhonemizer
|
|
29
|
+
|
|
30
|
+
DATA = Path(__file__).parent / "data"
|
|
31
|
+
GOLD = json.loads((DATA / "nemo_en_ids.json").read_text(encoding="utf-8"))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@pytest.fixture(scope="module")
|
|
35
|
+
def nemo():
|
|
36
|
+
return NemoIpaPhonemizer()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_the_gold_has_63_lines():
|
|
40
|
+
assert len(GOLD) == 63
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_every_gold_line_reads_as_nemo(nemo):
|
|
44
|
+
got = [(g["text"], nemo.phonemize_string(g["text"], "en-US")) for g in GOLD]
|
|
45
|
+
assert got == [(g["text"], "".join(g["tokens"])) for g in GOLD]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_the_vocabulary_is_that_of_the_tokenizer(nemo):
|
|
49
|
+
nemo_vocabulary = json.loads((DATA / "nemo_vocab.json").read_text(encoding="utf-8"))
|
|
50
|
+
assert nemo.vocabulary == set(nemo_vocabulary[:-2])
|
|
51
|
+
assert nemo_vocabulary[-2:] == ["<pad>", "<oov>"]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_the_output_holds_only_vocabulary_symbols(nemo):
|
|
55
|
+
text = "Zoë's naïve ½ cup of Zorblax-ish 日本 café ≠ tea; 100% sure…"
|
|
56
|
+
assert set(nemo.phonemize_string(text, "en-US")) <= nemo.vocabulary
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_a_text_of_spaces_gives_nothing_and_inner_spaces_stay(nemo):
|
|
60
|
+
assert nemo.phonemize_string(" ", "en-US") == ""
|
|
61
|
+
assert nemo.phonemize_string(" cat dog ", "en-US") == " " + nemo.phonemize_string("cat dog", "en-US")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# Words that the dictionary lacks and whose stem it holds, so that a suffix rule runs.
|
|
65
|
+
# The expected strings are the output of NeMo 3.0.0 (commit fd6a877).
|
|
66
|
+
@pytest.mark.parametrize("text, expected", [
|
|
67
|
+
("dessert's parrot's jacket's", "dɪˈzɝts ˈpɛɹəts ˈdʒækəts"),
|
|
68
|
+
("kiss's cactus's bus's", "ˈkɪsɪz ˈkæktəsɪz ˈbʌsɪz"),
|
|
69
|
+
("laptop's", "ˈlæpˌtɑpz"),
|
|
70
|
+
("podcasts", "ˈpɔdˌkæsts"),
|
|
71
|
+
("jousts ocelots", "ˈdʒaʊsts ˈɑsəˌlɑts"),
|
|
72
|
+
("antelopes abattoirs", "ˈæntəˌloʊpz ˌæbətˈwɑɹz"),
|
|
73
|
+
])
|
|
74
|
+
def test_a_word_that_the_dictionary_lacks_takes_the_ending_of_its_stem(nemo, text, expected):
|
|
75
|
+
for word in text.split():
|
|
76
|
+
assert word.upper() not in nemo.pronunciations
|
|
77
|
+
assert nemo.phonemize_string(text, "en-US") == expected
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_a_hyphen_splits_a_word_that_the_dictionary_lacks(nemo):
|
|
81
|
+
assert nemo.phonemize_string("cat-zzqx", "en-US") == nemo.phonemize_string("cat", "en-US") + "-ZZQX"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_there_is_no_probability_parameter():
|
|
85
|
+
assert "phoneme_probability" not in inspect.signature(NemoIpaPhonemizer.__init__).parameters
|
|
86
|
+
assert not hasattr(NemoIpaPhonemizer, "phoneme_probability")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def test_a_local_dictionary_and_heteronyms_replace_the_downloads(tmp_path):
|
|
90
|
+
dictionary = tmp_path / "dictionary.txt"
|
|
91
|
+
dictionary.write_text(";;; comment\nCAT ˈkæt\nREAD ˈɹɛd\nREAD(1) ˈɹid\nDOG ˈdɔɡ\n", encoding="utf-8")
|
|
92
|
+
heteronyms = tmp_path / "heteronyms"
|
|
93
|
+
heteronyms.write_text("dog\n", encoding="utf-8")
|
|
94
|
+
local = NemoIpaPhonemizer(dictionary=dictionary, heteronyms=heteronyms)
|
|
95
|
+
assert local.phonemize_string("cat read dog", "en-US") == "ˈkæt ˈɹɛd DOG"
|
|
96
|
+
assert local.vocabulary >= set("CATREDOG")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_a_local_file_changes_the_revision(tmp_path, nemo):
|
|
100
|
+
dictionary = tmp_path / "dictionary.txt"
|
|
101
|
+
dictionary.write_text("CAT ˈkæt\n", encoding="utf-8")
|
|
102
|
+
heteronyms = tmp_path / "heteronyms"
|
|
103
|
+
heteronyms.write_text("dog\n", encoding="utf-8")
|
|
104
|
+
default = nemo.identity("en-US")
|
|
105
|
+
local = NemoIpaPhonemizer(dictionary=dictionary, heteronyms=heteronyms).identity("en-US")
|
|
106
|
+
other_heteronyms = tmp_path / "heteronyms-2"
|
|
107
|
+
other_heteronyms.write_text("cat\n", encoding="utf-8")
|
|
108
|
+
other = NemoIpaPhonemizer(dictionary=dictionary, heteronyms=other_heteronyms).identity("en-US")
|
|
109
|
+
assert (default.backend, default.distribution, default.lang) == ("nemo_ipa", "scriptconv", "en-US")
|
|
110
|
+
assert len({default.revision, local.revision, other.revision}) == 3
|
|
111
|
+
assert default.revision.startswith("sc2:")
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def test_the_registry_resolves_the_backend():
|
|
115
|
+
assert Phonemizer.NEMO_IPA.value == "nemo_ipa"
|
|
116
|
+
assert get_phonemizer_class(Phonemizer.NEMO_IPA) is NemoIpaPhonemizer
|
|
117
|
+
assert isinstance(get_phonemizer(Phonemizer.NEMO_IPA), NemoIpaPhonemizer)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@pytest.mark.parametrize("lang, tag", [("en-US", "en-US"), ("en-Latn-US", "en-US"), ("en-US-x-nyc", "en-US-x-nyc")])
|
|
121
|
+
def test_american_english_is_read(lang, tag):
|
|
122
|
+
assert NemoIpaPhonemizer.get_lang(lang) == tag
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@pytest.mark.parametrize("lang", ["en", "en-GB", "en-AU", "pt"])
|
|
126
|
+
def test_other_english_and_other_languages_are_refused(lang):
|
|
127
|
+
with pytest.raises(UnsupportedLanguageError, match="en-US only"):
|
|
128
|
+
NemoIpaPhonemizer.get_lang(lang)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def test_no_stage_is_owned():
|
|
132
|
+
assert NemoIpaPhonemizer.owned_stages == frozenset()
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def test_the_pins_name_the_data_files():
|
|
136
|
+
assert DATA_REPO == "Phoonnx/magpietts-multi-357m-unicode"
|
|
137
|
+
assert DATA_REVISION == "a0e169ad4a160578974af51181a126d52dab6ab6"
|
|
138
|
+
assert [sha for _, sha in DATA_FILES.values()] == [
|
|
139
|
+
"7ea5c4c2c59cc780748b24d4ab60bd689779c4ac4ea7e27c0a8c3e20f300c0fa",
|
|
140
|
+
"b701909aedf753172eff223950f8859cd4b9b4c80199cf0a6e9ac4a307c8f8ec"]
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def test_a_missing_hub_package_names_the_extra():
|
|
144
|
+
with patch.dict(sys.modules, {"huggingface_hub": None}):
|
|
145
|
+
with pytest.raises(ImportError, match=r"scriptconv\[en-phonemizers\]"):
|
|
146
|
+
NemoIpaPhonemizer()
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def test_offline_with_no_cache_raises_model_unavailable(tmp_path):
|
|
150
|
+
code = ("from scriptconv.phonemizers import ModelUnavailableError\n"
|
|
151
|
+
"from scriptconv.phonemizers.nemo_ipa import NemoIpaPhonemizer\n"
|
|
152
|
+
"try:\n"
|
|
153
|
+
" NemoIpaPhonemizer()\n"
|
|
154
|
+
"except ModelUnavailableError as e:\n"
|
|
155
|
+
" print('ModelUnavailableError', e)\n")
|
|
156
|
+
env = {"PATH": "", "HOME": str(tmp_path), "HF_HOME": str(tmp_path / "hf"), "HF_HUB_OFFLINE": "1"}
|
|
157
|
+
result = subprocess.run([sys.executable, "-c", code], env=env, capture_output=True, text=True)
|
|
158
|
+
assert result.stdout.startswith("ModelUnavailableError"), result.stderr
|
|
159
|
+
assert DATA_REPO in result.stdout
|
|
160
|
+
assert issubclass(ModelUnavailableError, ValueError)
|