scriptconv-copyleft 0.1.1a1__tar.gz → 0.1.2a1__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 (39) hide show
  1. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/PKG-INFO +1 -1
  2. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/mul.py +13 -0
  3. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/version.py +1 -1
  4. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft.egg-info/PKG-INFO +1 -1
  5. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_espeak_acute_stress.py +21 -0
  6. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/LICENSE +0 -0
  7. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/README.md +0 -0
  8. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/pyproject.toml +0 -0
  9. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/__init__.py +0 -0
  10. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/__init__.py +0 -0
  11. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/_vendored/__init__.py +0 -0
  12. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/_vendored/kog2p/COPYING +0 -0
  13. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/_vendored/kog2p/LICENSE.md +0 -0
  14. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/_vendored/kog2p/__init__.py +0 -0
  15. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/_vendored/kog2p/rulebook.txt +0 -0
  16. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/eu.py +0 -0
  17. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/fa.py +0 -0
  18. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/gl.py +0 -0
  19. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/ja.py +0 -0
  20. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/phonemizers/ko.py +0 -0
  21. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft/readings.py +0 -0
  22. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft.egg-info/SOURCES.txt +0 -0
  23. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft.egg-info/dependency_links.txt +0 -0
  24. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft.egg-info/requires.txt +0 -0
  25. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/scriptconv_copyleft.egg-info/top_level.txt +0 -0
  26. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/setup.cfg +0 -0
  27. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_espeak_french_english_switch.py +0 -0
  28. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_espeak_get_lang_case.py +0 -0
  29. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_lang_default_region.py +0 -0
  30. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_match_lang_direction.py +0 -0
  31. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_match_lang_preferred_value.py +0 -0
  32. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_phonemizers_base.py +0 -0
  33. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_phonemizers_cjk_ar.py +0 -0
  34. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_phonemizers_friendly_import_errors.py +0 -0
  35. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_phonemizers_identity.py +0 -0
  36. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_phonemizers_misaki_british.py +0 -0
  37. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_phonemizers_punctuation.py +0 -0
  38. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_readings.py +0 -0
  39. {scriptconv_copyleft-0.1.1a1 → scriptconv_copyleft-0.1.2a1}/tests/test_transphone_extra_declares_auto_installs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptconv-copyleft
3
- Version: 0.1.1a1
3
+ Version: 0.1.2a1
4
4
  Summary: scriptconv phonemizer backends whose code or dependencies are copyleft (GPL, LGPL, AGPL)
5
5
  Author-email: TigreGotico <contact@tigregotico.com>
6
6
  License-Expression: Apache-2.0 AND GPL-3.0-only
@@ -188,6 +188,9 @@ class EspeakPhonemizer(BasePhonemizer):
188
188
  """
189
189
 
190
190
  engine_distribution = "espeak-ng"
191
+ # The acute after a vowel becomes an espeak-ng stress position only in these
192
+ # languages, and only on the binary path (see reads_stress_mark).
193
+ stress_mark_langs = _ACUTE_STRESS_LANGS
191
194
  ESPEAK_LANGS = ['es-419', 'ca', 'qya', 'ga', 'et', 'ky', 'io', 'fa-latn', 'en-gb', 'fo', 'haw', 'kl',
192
195
  'ta', 'ml', 'gd', 'sd', 'es', 'hy', 'ur', 'ro', 'hi', 'or', 'ti', 'ca-va', 'om', 'tr', 'pa',
193
196
  'smj', 'mk', 'bg', 'cv', "fr", 'fi', 'en-gb-x-rp', 'ru', 'mt', 'an', 'mr', 'pap', 'vi', 'id',
@@ -232,6 +235,16 @@ class EspeakPhonemizer(BasePhonemizer):
232
235
  banner = self._run_espeak_command(["--version"])
233
236
  return self.engine_distribution, banner.split(":")[1].split()[0]
234
237
 
238
+ def reads_stress_mark(self, lang: str) -> bool:
239
+ """True when the espeak-ng binary reads the text and *lang* is one of :attr:`stress_mark_langs`.
240
+
241
+ Only the binary path turns the acute into a stress position. espyak gets the
242
+ text unchanged, and there the mark moves the stress off the marked vowel.
243
+ """
244
+ if self.prefer_espyak or not self._has_binary():
245
+ return False
246
+ return self._match_lang(lang, sorted(self.stress_mark_langs))[1] <= 10
247
+
235
248
  @classmethod
236
249
  def _has_binary(cls) -> bool:
237
250
  if cls._binary_available is None:
@@ -1,7 +1,7 @@
1
1
  # START_VERSION_BLOCK
2
2
  VERSION_MAJOR = 0
3
3
  VERSION_MINOR = 1
4
- VERSION_BUILD = 1
4
+ VERSION_BUILD = 2
5
5
  VERSION_ALPHA = 1
6
6
  # END_VERSION_BLOCK
7
7
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptconv-copyleft
3
- Version: 0.1.1a1
3
+ Version: 0.1.2a1
4
4
  Summary: scriptconv phonemizer backends whose code or dependencies are copyleft (GPL, LGPL, AGPL)
5
5
  Author-email: TigreGotico <contact@tigregotico.com>
6
6
  License-Expression: Apache-2.0 AND GPL-3.0-only
@@ -167,3 +167,24 @@ def test_a_stressed_monosyllable_keeps_its_stress_in_a_sentence(lang, text, word
167
167
  ])
168
168
  def test_other_text_reaches_espeak_unchanged(lang, voice, text):
169
169
  assert EspeakPhonemizer().phonemize_string(text, lang) == espeak(text, voice)
170
+
171
+
172
+ @pytest.mark.parametrize("lang", ["ru", "ru-RU", "rus", "uk", "uk-UA"])
173
+ def test_the_binary_path_reads_the_mark_in_russian_and_ukrainian(monkeypatch, lang):
174
+ monkeypatch.setattr(EspeakPhonemizer, "_binary_available", True)
175
+ assert EspeakPhonemizer().reads_stress_mark(lang)
176
+
177
+
178
+ @pytest.mark.parametrize("lang", ["be", "bg", "kk", "uz", "pt-PT"])
179
+ def test_the_binary_path_does_not_read_the_mark_in_other_languages(monkeypatch, lang):
180
+ monkeypatch.setattr(EspeakPhonemizer, "_binary_available", True)
181
+ assert not EspeakPhonemizer().reads_stress_mark(lang)
182
+
183
+
184
+ @pytest.mark.parametrize("lang", ["ru", "uk"])
185
+ def test_espyak_does_not_read_the_mark(monkeypatch, lang):
186
+ # espyak gets the text unchanged, and the mark moves the stress: Но́вая -> nʌvˈɑja
187
+ monkeypatch.setattr(EspeakPhonemizer, "_binary_available", True)
188
+ assert not EspeakPhonemizer(prefer_espyak=True).reads_stress_mark(lang)
189
+ monkeypatch.setattr(EspeakPhonemizer, "_binary_available", False)
190
+ assert not EspeakPhonemizer().reads_stress_mark(lang)