scriptconv 0.0.4a151__tar.gz → 0.0.4a153__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.
Files changed (211) hide show
  1. {scriptconv-0.0.4a151/scriptconv.egg-info → scriptconv-0.0.4a153}/PKG-INFO +1 -1
  2. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/__init__.py +0 -3
  3. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/__main__.py +12 -12
  4. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/conventions.py +36 -69
  5. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/notation.py +65 -188
  6. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/__init__.py +4 -9
  7. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/base.py +128 -356
  8. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/registry.py +31 -64
  9. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/readings.py +12 -24
  10. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/scripts.py +27 -104
  11. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/version.py +1 -1
  12. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153/scriptconv.egg-info}/PKG-INFO +1 -1
  13. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/LICENSE +0 -0
  14. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/README.md +0 -0
  15. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/pyproject.toml +0 -0
  16. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/cangjie.py +0 -0
  17. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/data/LICENSE.cangjie5 +0 -0
  18. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/data/__init__.py +0 -0
  19. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/data/cangjie5_tc.tsv.gz +0 -0
  20. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/diacritics.py +0 -0
  21. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/frontend.py +0 -0
  22. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/graph.py +0 -0
  23. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_identity_cache.py +0 -0
  24. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_moved.py +0 -0
  25. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_revision.py +0 -0
  26. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/LICENSE.f5tts +0 -0
  27. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/LICENSE.hangul_to_ipa +0 -0
  28. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/__init__.py +0 -0
  29. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/bw2ipa.py +0 -0
  30. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/LICENSE +0 -0
  31. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/UPSTREAM.md +0 -0
  32. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/__init__.py +0 -0
  33. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/__main__.py +0 -0
  34. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/align.py +0 -0
  35. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.cmudict +0 -0
  36. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.homograph-data +0 -0
  37. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/built/align.json +0 -0
  38. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/built/g2p.json +0 -0
  39. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/built/g2p.npz +0 -0
  40. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/built/homographs.json +0 -0
  41. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/built/lexicon.json +0 -0
  42. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/built/lexicon.tsv +0 -0
  43. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/built/sources.json +0 -0
  44. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/convert.py +0 -0
  45. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/data/abbreviations.txt +0 -0
  46. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/data/chat.txt +0 -0
  47. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/data/endings.txt +0 -0
  48. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/data/exceptions.txt +0 -0
  49. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/data/function_words.txt +0 -0
  50. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/data/homograph_fixes.txt +0 -0
  51. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/data/homograph_rules.txt +0 -0
  52. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/data/letters.txt +0 -0
  53. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/data/phrases.txt +0 -0
  54. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/data/units.txt +0 -0
  55. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/engine.py +0 -0
  56. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/g2p.py +0 -0
  57. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/homographs.py +0 -0
  58. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/morphology.py +0 -0
  59. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/normalize.py +0 -0
  60. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/sentence.py +0 -0
  61. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/symbols.py +0 -0
  62. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/dizione/tables.py +0 -0
  63. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/f5tts.py +0 -0
  64. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/g2pw/LICENSE +0 -0
  65. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/g2pw/__init__.py +0 -0
  66. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/g2pw/bert-base-chinese_s2t_dict.txt +0 -0
  67. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/g2pw/bopomofo_to_pinyin_wo_tune_dict.json +0 -0
  68. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/g2pw/char_bopomofo_dict.json +0 -0
  69. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/hangul2ipa.py +0 -0
  70. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/ko_tables/aspiration.csv +0 -0
  71. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/ko_tables/assimilation.csv +0 -0
  72. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/ko_tables/double_coda.csv +0 -0
  73. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/ko_tables/hanja.tsv +0 -0
  74. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/ko_tables/ipa.csv +0 -0
  75. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/ko_tables/neutralization.csv +0 -0
  76. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/ko_tables/tensification.csv +0 -0
  77. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/ko_tables/yale.csv +0 -0
  78. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/leokani/LICENSE +0 -0
  79. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/leokani/LICENSE-CC-BY-4.0.txt +0 -0
  80. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/leokani/NOTICE +0 -0
  81. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/leokani/__init__.py +0 -0
  82. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/leokani/leokani_g2p.py +0 -0
  83. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/nakdimon/LICENSE +0 -0
  84. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/nakdimon/__init__.py +0 -0
  85. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/nemo/NOTICE +0 -0
  86. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/shami/__init__.py +0 -0
  87. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/shami/codeswitch.py +0 -0
  88. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/shami/diacritize.py +0 -0
  89. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/shami/dialectal.py +0 -0
  90. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/shami/english_g2p.py +0 -0
  91. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/shami/espeak.py +0 -0
  92. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/shami/frontend.py +0 -0
  93. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/shami/levantine_g2p.py +0 -0
  94. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/shami/normalize.py +0 -0
  95. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/shami/phoneme_inventory.py +0 -0
  96. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/vosk_g2p.py +0 -0
  97. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_thirdparty/zh_num.py +0 -0
  98. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_vendored/__init__.py +0 -0
  99. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_vendored/matoub_kab/LICENSE.md +0 -0
  100. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/_vendored/matoub_kab/__init__.py +0 -0
  101. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/africa.py +0 -0
  102. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/ar.py +0 -0
  103. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/ber.py +0 -0
  104. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/dizione.py +0 -0
  105. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/en.py +0 -0
  106. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/enums.py +0 -0
  107. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/eu.py +0 -0
  108. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/f5tts.py +0 -0
  109. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/fa.py +0 -0
  110. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/g2pw.py +0 -0
  111. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/ghana.py +0 -0
  112. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/gl.py +0 -0
  113. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/he.py +0 -0
  114. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/ja.py +0 -0
  115. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/ko.py +0 -0
  116. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/leokani.py +0 -0
  117. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/lir.py +0 -0
  118. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/mul.py +0 -0
  119. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/mwl.py +0 -0
  120. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/nemo_ipa.py +0 -0
  121. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/o2ipa.py +0 -0
  122. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/openjtalk_engine.py +0 -0
  123. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/pt.py +0 -0
  124. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/ru.py +0 -0
  125. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/shami.py +0 -0
  126. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/vi.py +0 -0
  127. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/phonemizers/zh.py +0 -0
  128. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/py.typed +0 -0
  129. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/testing/__init__.py +0 -0
  130. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/testing/compare.py +0 -0
  131. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv/translit.py +0 -0
  132. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv.egg-info/SOURCES.txt +0 -0
  133. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv.egg-info/dependency_links.txt +0 -0
  134. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv.egg-info/requires.txt +0 -0
  135. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/scriptconv.egg-info/top_level.txt +0 -0
  136. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/setup.cfg +0 -0
  137. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_arabic_diacritics_routing.py +0 -0
  138. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_arpa_stress.py +0 -0
  139. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_backend_table.py +0 -0
  140. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_byt5_lang_prefix.py +0 -0
  141. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_cangjie.py +0 -0
  142. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_charsiu_match_tags.py +0 -0
  143. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_cli.py +0 -0
  144. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_conventions.py +0 -0
  145. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_core_imports.py +0 -0
  146. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_diacritics.py +0 -0
  147. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_diacritics_graph.py +0 -0
  148. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_diacritics_nakdimon.py +0 -0
  149. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_diacritics_nfd_letters.py +0 -0
  150. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_doc_pages.py +0 -0
  151. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_errors_policy.py +0 -0
  152. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_examples.py +0 -0
  153. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_frontend.py +0 -0
  154. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_frontend_chunks.py +0 -0
  155. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_frontend_join.py +0 -0
  156. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_frontend_order.py +0 -0
  157. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_frontend_phonemizer_lang.py +0 -0
  158. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_frontend_say_as.py +0 -0
  159. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_frontend_stage_edges.py +0 -0
  160. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_graph.py +0 -0
  161. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_graph_lossless.py +0 -0
  162. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_gruut_lexicon_cache.py +0 -0
  163. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_he_extra_declares_phonikud.py +0 -0
  164. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_identity_cache.py +0 -0
  165. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_lang_default_region.py +0 -0
  166. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_match_lang_direction.py +0 -0
  167. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_match_lang_preferred_value.py +0 -0
  168. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_notation.py +0 -0
  169. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_notation_sources.py +0 -0
  170. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_notation_strict.py +0 -0
  171. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_openjtalk_engine.py +0 -0
  172. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_base.py +0 -0
  173. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_cjk_ar.py +0 -0
  174. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_copyleft_he_ja_th.py +0 -0
  175. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_dizione.py +0 -0
  176. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_dizione_long_tokens.py +0 -0
  177. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_epitran_english.py +0 -0
  178. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_epitran_japanese.py +0 -0
  179. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_epitran_korean.py +0 -0
  180. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_espeak_lt_accent.py +0 -0
  181. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_eu_euskaphone.py +0 -0
  182. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_f5tts.py +0 -0
  183. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_friendly_import_errors.py +0 -0
  184. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_g2pw.py +0 -0
  185. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_goruut_marks.py +0 -0
  186. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_goruut_server.py +0 -0
  187. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_grapheme_arguments.py +0 -0
  188. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_identity.py +0 -0
  189. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_kolokwa.py +0 -0
  190. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_leokani.py +0 -0
  191. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_marks.py +0 -0
  192. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_matoub_kab.py +0 -0
  193. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_mwl_barranquenho.py +0 -0
  194. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_nemo_ipa.py +0 -0
  195. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_o2i_lexicons.py +0 -0
  196. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_phonetisaurus.py +0 -0
  197. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_phonetisaurus_engine.py +0 -0
  198. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_pt_tugaphone.py +0 -0
  199. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_punctuation.py +0 -0
  200. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_ru.py +0 -0
  201. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_shami_digit_runs.py +0 -0
  202. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_phonemizers_shami_inventory.py +0 -0
  203. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_readings_zh.py +0 -0
  204. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_scripts.py +0 -0
  205. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_scripts_stressonnx_compat.py +0 -0
  206. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_sister_packages.py +0 -0
  207. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_stress_marks.py +0 -0
  208. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_testing_compare.py +0 -0
  209. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_translit.py +0 -0
  210. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/tests/test_tugaphone_identity_no_revision.py +0 -0
  211. {scriptconv-0.0.4a151 → scriptconv-0.0.4a153}/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.4a151
3
+ Version: 0.0.4a153
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": lambda: _do_convert(args),
87
- "detect": lambda: _do_detect(args),
88
- "distribution": lambda: _do_distribution(args),
89
- "direction": lambda: _do_direction(args),
90
- "decompose": lambda: _do_decompose(args),
91
- "lang": lambda: _do_lang(args),
92
- "strip": lambda: _do_strip(args),
93
- "restyle": lambda: _do_restyle(args),
94
- "conventions": lambda: _do_conventions(args),
95
- "route": lambda: _do_route(args),
96
- "phonemize": lambda: _do_phonemize(args),
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
- Scripts are text *identity*: character-evident, ISO-15924-coded, the nodes of
4
- scriptconv's conversion space (:mod:`scriptconv.scripts`). Conventions are
5
- *decorations* a script's orthography can carry or omit — optional vocalization
6
- (Arabic tashkeel, Hebrew niqqud), justification (kashida), spacing modes
7
- (Japanese wakachigaki), or mutually-exclusive spellings of the same
8
- information (pinyin tone marks vs digits). A convention never participates in
9
- script detection or conversion routing; it is always a parameter, never a
10
- node.
11
-
12
- Each convention declares its *styles* — the mutually exclusive states its text
13
- can be in. Binary decorations have styles ``("marked", "none")``; variant
14
- conventions name their spellings (``("mark", "number", "none")``). The one
15
- real operation is :func:`restyle`, a partial transition matrix between styles;
16
- :func:`strip` and :func:`apply` are sugar for transitions to and from
17
- ``"none"``.
18
-
19
- Which transitions exist follows the same boundary the rest of scriptconv
20
- draws:
21
-
22
- * stripping and deterministic re-spelling are pure orthography — always
23
- available, zero-dependency;
24
- * transitions that need a *dictionary lookup* (wakachigaki application =
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 _in_ranges(cp: int, ranges: Tuple[Tuple[int, int], ...]) -> bool:
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 "".join(c for c in text if not _in_ranges(ord(c), ranges))
161
+ return pattern.sub("", text)
185
162
  return _strip
186
163
 
187
164
 
188
- def _range_detector(ranges: Tuple[Tuple[int, int], ...]) -> Callable[[str], Optional[str]]:
165
+ def _range_detector(pattern: re.Pattern) -> Callable[[str], Optional[str]]:
189
166
  def _detect(text: str) -> Optional[str]:
190
- return "marked" if any(_in_ranges(ord(c), ranges) for c in text) else "none"
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
- out = []
216
- i = 0
217
- while i < len(text):
218
- m = _WAKACHI_SPACE.match(text, i)
219
- if m:
220
- before = out[-1] if out else ""
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
- marked = unicodedata.normalize(
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(ranges)),),
455
- detector=_range_detector(ranges))
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). The default
253
- ``stress=False`` keeps the historical behavior of stripping the digits.
254
- ``errors`` selects the unknown-token policy: ``"pass"`` (default) keeps
255
- the token, ``"replace"`` substitutes ``?``, ``"ignore"`` drops it,
256
- ``"strict"`` raises :class:`UnknownSymbolError`.
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``, IPA stress
286
- marks (``ˈ``/``ˌ``) preceding a vowel-class symbol are emitted as that
287
- vowel's stress digit (``1``/``2``) and unmarked vowels receive ``0`` —
288
- the reverse of :func:`arpa_to_ipa`'s ``stress=True`` convention.
289
- A stress mark stands before the stressed syllable, so with
290
- ``stress=True`` its digit goes to the next vowel, after any onset.
291
- ``errors`` selects the unknown-symbol policy (default ``"replace"``,
292
- preserving the historical behavior of substituting *unknown*, ``"?"``);
293
- ``unknown=""`` still drops silently. Under the other policies, combining
294
- marks and modifier letters qualify the preceding phoneme and are dropped
295
- rather than treated as unknowns. ``"strict"`` drops no mark: it raises
296
- on a mark with no ARPABET value, on a stress mark that no vowel
297
- follows, and on a stress mark whose syllable has a syllabic consonant
298
- (``EL``, ``EM``, ``EN``, ``ENG``) and no vowel. With ``stress=False`` a stress mark is dropped under every
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
- result = []
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
- result = []
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
- result = []
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
- result = []
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
- result = []
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 == "_sil_":
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
- Supported pairs (direct):
1414
- - ``arpa`` ↔ ``ipa``
1415
- - ``x-sampa`` ↔ ``ipa``
1416
- - ``lexique`` ↔ ``ipa``
1417
- - ``buckwalter`` ↔ ``arabic``
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
- Parameters
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
- # only notation-to-notation reachability counts here; guard against paths
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, yielding results.
1556
+ """Convert each line from *src* to *dst* notation.
1645
1557
 
1646
- Blank lines are yielded unchanged (no conversion attempted).
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
- # Unicode blocks/characters that are distinctive to IPA transcription. Basic
1682
- # Latin letters (p, a, t, …) and the Greek letters IPA borrows (β, θ, χ) are
1683
- # deliberately excluded: they are indistinguishable from ordinary Latin/Greek
1684
- # text, so they carry no signal.
1685
- _IPA_DISTINCTIVE_RANGES = (
1686
- (0x0250, 0x02AF), # IPA Extensions
1687
- (0x02B0, 0x02FF), # Spacing Modifier Letters (ˈ ˌ ː ˑ ʰ ʲ …)
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
- """Heuristically decide whether *text* is an IPA transcription.
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
- This is a positive-signal heuristic, not a classifier: a transcription
1712
- written only with characters IPA shares with the Latin alphabet
1713
- (``"pat"``, ``"bad"``) has no distinctive marker and returns ``False``.
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 any(_is_ipa_distinctive(ch) for ch in text)
1604
+ return _IPA_DISTINCTIVE.search(text) is not None
@@ -1,13 +1,8 @@
1
- """Phonemizer wrappers — see :mod:`scriptconv.phonemizers.base` for the thesis.
1
+ """Phonemizer wrappers: the :class:`BasePhonemizer` contract, the enums and the lazy registry.
2
2
 
3
- Public surface: the :class:`BasePhonemizer` contract, the ``Alphabet``/
4
- ``Phonemizer`` enums, the lazy registry (``get_phonemizer``,
5
- ``phonemizer_for_lang``), and the per-language wrapper modules. Backing
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 (