scriptconv 0.0.4a149__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.
Files changed (211) hide show
  1. {scriptconv-0.0.4a149/scriptconv.egg-info → scriptconv-0.0.4a151}/PKG-INFO +9 -4
  2. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/README.md +7 -3
  3. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/pyproject.toml +3 -1
  4. scriptconv-0.0.4a151/scriptconv/phonemizers/_thirdparty/nemo/NOTICE +34 -0
  5. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/espeak.py +9 -2
  6. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/enums.py +1 -0
  7. scriptconv-0.0.4a151/scriptconv/phonemizers/nemo_ipa.py +245 -0
  8. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/registry.py +1 -0
  9. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/version.py +1 -1
  10. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151/scriptconv.egg-info}/PKG-INFO +9 -4
  11. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv.egg-info/SOURCES.txt +3 -0
  12. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_base.py +2 -1
  13. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_identity.py +1 -1
  14. scriptconv-0.0.4a151/tests/test_phonemizers_nemo_ipa.py +160 -0
  15. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_shami_digit_runs.py +49 -4
  16. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_wheel_licences.py +2 -0
  17. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/LICENSE +0 -0
  18. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/__init__.py +0 -0
  19. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/__main__.py +0 -0
  20. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/cangjie.py +0 -0
  21. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/conventions.py +0 -0
  22. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/data/LICENSE.cangjie5 +0 -0
  23. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/data/__init__.py +0 -0
  24. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/data/cangjie5_tc.tsv.gz +0 -0
  25. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/diacritics.py +0 -0
  26. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/frontend.py +0 -0
  27. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/graph.py +0 -0
  28. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/notation.py +0 -0
  29. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/__init__.py +0 -0
  30. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_identity_cache.py +0 -0
  31. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_moved.py +0 -0
  32. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_revision.py +0 -0
  33. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/LICENSE.f5tts +0 -0
  34. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/LICENSE.hangul_to_ipa +0 -0
  35. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/__init__.py +0 -0
  36. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/bw2ipa.py +0 -0
  37. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/LICENSE +0 -0
  38. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/UPSTREAM.md +0 -0
  39. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/__init__.py +0 -0
  40. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/__main__.py +0 -0
  41. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/align.py +0 -0
  42. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.cmudict +0 -0
  43. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/LICENSE.homograph-data +0 -0
  44. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/align.json +0 -0
  45. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/g2p.json +0 -0
  46. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/g2p.npz +0 -0
  47. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/homographs.json +0 -0
  48. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/lexicon.json +0 -0
  49. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/lexicon.tsv +0 -0
  50. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/built/sources.json +0 -0
  51. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/convert.py +0 -0
  52. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/abbreviations.txt +0 -0
  53. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/chat.txt +0 -0
  54. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/endings.txt +0 -0
  55. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/exceptions.txt +0 -0
  56. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/function_words.txt +0 -0
  57. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/homograph_fixes.txt +0 -0
  58. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/homograph_rules.txt +0 -0
  59. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/letters.txt +0 -0
  60. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/phrases.txt +0 -0
  61. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/data/units.txt +0 -0
  62. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/engine.py +0 -0
  63. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/g2p.py +0 -0
  64. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/homographs.py +0 -0
  65. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/morphology.py +0 -0
  66. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/normalize.py +0 -0
  67. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/sentence.py +0 -0
  68. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/symbols.py +0 -0
  69. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/dizione/tables.py +0 -0
  70. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/f5tts.py +0 -0
  71. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/g2pw/LICENSE +0 -0
  72. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/g2pw/__init__.py +0 -0
  73. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/g2pw/bert-base-chinese_s2t_dict.txt +0 -0
  74. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/g2pw/bopomofo_to_pinyin_wo_tune_dict.json +0 -0
  75. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/g2pw/char_bopomofo_dict.json +0 -0
  76. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/hangul2ipa.py +0 -0
  77. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/aspiration.csv +0 -0
  78. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/assimilation.csv +0 -0
  79. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/double_coda.csv +0 -0
  80. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/hanja.tsv +0 -0
  81. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/ipa.csv +0 -0
  82. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/neutralization.csv +0 -0
  83. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/tensification.csv +0 -0
  84. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/ko_tables/yale.csv +0 -0
  85. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/leokani/LICENSE +0 -0
  86. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/leokani/LICENSE-CC-BY-4.0.txt +0 -0
  87. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/leokani/NOTICE +0 -0
  88. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/leokani/__init__.py +0 -0
  89. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/leokani/leokani_g2p.py +0 -0
  90. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/nakdimon/LICENSE +0 -0
  91. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/nakdimon/__init__.py +0 -0
  92. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/__init__.py +0 -0
  93. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/codeswitch.py +0 -0
  94. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/diacritize.py +0 -0
  95. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/dialectal.py +0 -0
  96. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/english_g2p.py +0 -0
  97. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/frontend.py +0 -0
  98. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/levantine_g2p.py +0 -0
  99. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/normalize.py +0 -0
  100. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/shami/phoneme_inventory.py +0 -0
  101. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/vosk_g2p.py +0 -0
  102. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_thirdparty/zh_num.py +0 -0
  103. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_vendored/__init__.py +0 -0
  104. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_vendored/matoub_kab/LICENSE.md +0 -0
  105. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/_vendored/matoub_kab/__init__.py +0 -0
  106. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/africa.py +0 -0
  107. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ar.py +0 -0
  108. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/base.py +0 -0
  109. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ber.py +0 -0
  110. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/dizione.py +0 -0
  111. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/en.py +0 -0
  112. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/eu.py +0 -0
  113. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/f5tts.py +0 -0
  114. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/fa.py +0 -0
  115. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/g2pw.py +0 -0
  116. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ghana.py +0 -0
  117. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/gl.py +0 -0
  118. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/he.py +0 -0
  119. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ja.py +0 -0
  120. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ko.py +0 -0
  121. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/leokani.py +0 -0
  122. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/lir.py +0 -0
  123. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/mul.py +0 -0
  124. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/mwl.py +0 -0
  125. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/o2ipa.py +0 -0
  126. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/openjtalk_engine.py +0 -0
  127. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/pt.py +0 -0
  128. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/ru.py +0 -0
  129. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/shami.py +0 -0
  130. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/vi.py +0 -0
  131. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/phonemizers/zh.py +0 -0
  132. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/py.typed +0 -0
  133. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/readings.py +0 -0
  134. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/scripts.py +0 -0
  135. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/testing/__init__.py +0 -0
  136. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/testing/compare.py +0 -0
  137. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv/translit.py +0 -0
  138. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv.egg-info/dependency_links.txt +0 -0
  139. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv.egg-info/requires.txt +0 -0
  140. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/scriptconv.egg-info/top_level.txt +0 -0
  141. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/setup.cfg +0 -0
  142. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_arabic_diacritics_routing.py +0 -0
  143. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_arpa_stress.py +0 -0
  144. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_backend_table.py +0 -0
  145. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_byt5_lang_prefix.py +0 -0
  146. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_cangjie.py +0 -0
  147. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_charsiu_match_tags.py +0 -0
  148. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_cli.py +0 -0
  149. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_conventions.py +0 -0
  150. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_core_imports.py +0 -0
  151. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_diacritics.py +0 -0
  152. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_diacritics_graph.py +0 -0
  153. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_diacritics_nakdimon.py +0 -0
  154. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_diacritics_nfd_letters.py +0 -0
  155. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_doc_pages.py +0 -0
  156. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_errors_policy.py +0 -0
  157. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_examples.py +0 -0
  158. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_frontend.py +0 -0
  159. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_frontend_chunks.py +0 -0
  160. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_frontend_join.py +0 -0
  161. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_frontend_order.py +0 -0
  162. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_frontend_phonemizer_lang.py +0 -0
  163. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_frontend_say_as.py +0 -0
  164. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_frontend_stage_edges.py +0 -0
  165. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_graph.py +0 -0
  166. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_graph_lossless.py +0 -0
  167. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_gruut_lexicon_cache.py +0 -0
  168. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_he_extra_declares_phonikud.py +0 -0
  169. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_identity_cache.py +0 -0
  170. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_lang_default_region.py +0 -0
  171. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_match_lang_direction.py +0 -0
  172. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_match_lang_preferred_value.py +0 -0
  173. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_notation.py +0 -0
  174. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_notation_sources.py +0 -0
  175. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_notation_strict.py +0 -0
  176. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_openjtalk_engine.py +0 -0
  177. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_cjk_ar.py +0 -0
  178. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_copyleft_he_ja_th.py +0 -0
  179. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_dizione.py +0 -0
  180. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_dizione_long_tokens.py +0 -0
  181. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_epitran_english.py +0 -0
  182. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_epitran_japanese.py +0 -0
  183. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_epitran_korean.py +0 -0
  184. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_espeak_lt_accent.py +0 -0
  185. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_eu_euskaphone.py +0 -0
  186. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_f5tts.py +0 -0
  187. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_friendly_import_errors.py +0 -0
  188. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_g2pw.py +0 -0
  189. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_goruut_marks.py +0 -0
  190. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_goruut_server.py +0 -0
  191. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_grapheme_arguments.py +0 -0
  192. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_kolokwa.py +0 -0
  193. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_leokani.py +0 -0
  194. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_marks.py +0 -0
  195. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_matoub_kab.py +0 -0
  196. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_mwl_barranquenho.py +0 -0
  197. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_o2i_lexicons.py +0 -0
  198. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_phonetisaurus.py +0 -0
  199. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_phonetisaurus_engine.py +0 -0
  200. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_pt_tugaphone.py +0 -0
  201. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_punctuation.py +0 -0
  202. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_ru.py +0 -0
  203. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_phonemizers_shami_inventory.py +0 -0
  204. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_readings_zh.py +0 -0
  205. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_scripts.py +0 -0
  206. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_scripts_stressonnx_compat.py +0 -0
  207. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_sister_packages.py +0 -0
  208. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_stress_marks.py +0 -0
  209. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_testing_compare.py +0 -0
  210. {scriptconv-0.0.4a149 → scriptconv-0.0.4a151}/tests/test_translit.py +0 -0
  211. {scriptconv-0.0.4a149 → 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.4a149
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, a named DeepPhonemizer checkpoint and the NLTK data of
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, a named DeepPhonemizer checkpoint and the NLTK data of
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 = []
@@ -99,5 +100,6 @@ scriptconv = ["py.typed"]
99
100
 
100
101
  [tool.pytest.ini_options]
101
102
  testpaths = ["tests"]
102
- # A test that hangs fails after this many seconds. The slowest test took 31.8 s at load average 45 to 67.
103
+ # A test that hangs fails after this many seconds. The slowest test, 40,000 digits through espeak-ng,
104
+ # took 49.7 s at load average 31 to 35.
103
105
  timeout = 150
@@ -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.
@@ -17,6 +17,12 @@ _ESPEAK = shutil.which("espeak-ng") or shutil.which("espeak")
17
17
  _PAREN = re.compile(r"\([^)]*\)")
18
18
  _ZW = dict.fromkeys(map(ord, "‍‌​"), None)
19
19
 
20
+ # espeak-ng time grows with the text: about 150 microseconds per UTF-8 byte at
21
+ # load 35 on an 8-core laptop. The allowance is four times that rate, for a box
22
+ # at load 50 and above. The base bounds a binary that hangs on a short text.
23
+ _TIMEOUT_BASE = 30
24
+ _TIMEOUT_PER_BYTE = 4 * 150e-6
25
+
20
26
 
21
27
  def available() -> bool:
22
28
  return _ESPEAK is not None
@@ -35,14 +41,15 @@ def phonemize(text: str, voice: str = "en-us") -> str:
35
41
  return ""
36
42
  # The text goes on stdin, because Linux refuses one argument longer than
37
43
  # 128 KiB. Without the final newline, espeak-ng drops the end of the last word.
44
+ data = text + "\n"
38
45
  proc = subprocess.run(
39
46
  [_ESPEAK, "-v", voice, "--ipa=1", "-q", "--stdin"],
40
- input=text + "\n",
47
+ input=data,
41
48
  capture_output=True,
42
49
  text=True,
43
50
  encoding="utf-8",
44
51
  errors="replace",
45
- timeout=30,
52
+ timeout=_TIMEOUT_BASE + _TIMEOUT_PER_BYTE * len(data.encode("utf-8", "replace")),
46
53
  )
47
54
  raw = proc.stdout or ""
48
55
  raw = _PAREN.sub(" ", raw).translate(_ZW)
@@ -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"),
@@ -2,7 +2,7 @@
2
2
  VERSION_MAJOR = 0
3
3
  VERSION_MINOR = 0
4
4
  VERSION_BUILD = 4
5
- VERSION_ALPHA = 149
5
+ VERSION_ALPHA = 151
6
6
  # END_VERSION_BLOCK
7
7
 
8
8
  VERSION_STR = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_BUILD}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptconv
3
- Version: 0.0.4a149
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, a named DeepPhonemizer checkpoint and the NLTK data of
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)), 58) # +HALABI, +IQRA, +GHANA_G2P, +PHONETISAURUS, +MATOUB_KAB, +DIZIONE, +G2PW, +F5TTS_CHAR, +F5TTS_PINYIN, +LEOKANI, +KOLOKWA, +ESPEAK_LT_ACCENT, +HEBREW_IPA, +OPENJTALK_PROSODY, +TLTK
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.