scriptconv-copyleft 0.3.0a1__tar.gz → 0.3.1a1__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 (56) hide show
  1. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/PKG-INFO +1 -1
  2. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/mul.py +6 -1
  3. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/version.py +1 -1
  4. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft.egg-info/PKG-INFO +1 -1
  5. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft.egg-info/SOURCES.txt +1 -0
  6. scriptconv_copyleft-0.3.1a1/tests/test_espeak_long_line.py +46 -0
  7. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/LICENSE +0 -0
  8. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/README.md +0 -0
  9. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/pyproject.toml +0 -0
  10. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/__init__.py +0 -0
  11. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/__init__.py +0 -0
  12. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/__init__.py +0 -0
  13. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/kog2p/COPYING +0 -0
  14. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/kog2p/LICENSE.md +0 -0
  15. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/kog2p/__init__.py +0 -0
  16. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/kog2p/rulebook.txt +0 -0
  17. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/reginute/COPYING +0 -0
  18. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/reginute/LICENSE +0 -0
  19. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/reginute/SOURCE +0 -0
  20. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/reginute/lt_kirciai.tsv +0 -0
  21. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/reginute/lt_kreipiniai.tsv +0 -0
  22. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/_vendored/reginute/lt_raides.tsv +0 -0
  23. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/eu.py +0 -0
  24. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/fa.py +0 -0
  25. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/gl.py +0 -0
  26. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/he.py +0 -0
  27. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/ja.py +0 -0
  28. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/ja_prosody.py +0 -0
  29. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/ko.py +0 -0
  30. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/lt.py +0 -0
  31. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/phonemizers/th.py +0 -0
  32. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft/readings.py +0 -0
  33. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft.egg-info/dependency_links.txt +0 -0
  34. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft.egg-info/requires.txt +0 -0
  35. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/scriptconv_copyleft.egg-info/top_level.txt +0 -0
  36. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/setup.cfg +0 -0
  37. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_espeak_acute_stress.py +0 -0
  38. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_espeak_french_english_switch.py +0 -0
  39. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_espeak_get_lang_case.py +0 -0
  40. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_espeak_lt_accent.py +0 -0
  41. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_hebrew_ipa.py +0 -0
  42. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_lang_default_region.py +0 -0
  43. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_match_lang_direction.py +0 -0
  44. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_match_lang_preferred_value.py +0 -0
  45. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_misaki_ja_reader.py +0 -0
  46. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_misaki_zh_zero.py +0 -0
  47. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_openjtalk_prosody.py +0 -0
  48. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_phonemizers_base.py +0 -0
  49. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_phonemizers_cjk_ar.py +0 -0
  50. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_phonemizers_friendly_import_errors.py +0 -0
  51. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_phonemizers_identity.py +0 -0
  52. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_phonemizers_misaki_british.py +0 -0
  53. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_phonemizers_punctuation.py +0 -0
  54. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_readings.py +0 -0
  55. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/tests/test_tltk.py +0 -0
  56. {scriptconv_copyleft-0.3.0a1 → scriptconv_copyleft-0.3.1a1}/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.3.0a1
3
+ Version: 0.3.1a1
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 AND GPL-3.0-or-later AND CC-BY-4.0
@@ -312,7 +312,12 @@ class EspeakPhonemizer(BasePhonemizer):
312
312
  EspeakError: If espeak-ng command is not found, or if the subprocess call fails.
313
313
  """
314
314
  command: List[str] = ['espeak-ng'] + args
315
-
315
+ if input_text is not None:
316
+ # Without --stdin, espeak-ng reads stdin in 1,000-byte pieces and cuts a
317
+ # longer line mid-word. With it, espeak-ng drops the last byte of the input.
318
+ command.append('--stdin')
319
+ input_text += "\n"
320
+
316
321
  # Standard arguments for subprocess.run
317
322
  subprocess_args = {
318
323
  'input': input_text,
@@ -1,7 +1,7 @@
1
1
  # START_VERSION_BLOCK
2
2
  VERSION_MAJOR = 0
3
3
  VERSION_MINOR = 3
4
- VERSION_BUILD = 0
4
+ VERSION_BUILD = 1
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.3.0a1
3
+ Version: 0.3.1a1
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 AND GPL-3.0-or-later AND CC-BY-4.0
@@ -34,6 +34,7 @@ scriptconv_copyleft/phonemizers/_vendored/reginute/lt_raides.tsv
34
34
  tests/test_espeak_acute_stress.py
35
35
  tests/test_espeak_french_english_switch.py
36
36
  tests/test_espeak_get_lang_case.py
37
+ tests/test_espeak_long_line.py
37
38
  tests/test_espeak_lt_accent.py
38
39
  tests/test_hebrew_ipa.py
39
40
  tests/test_lang_default_region.py
@@ -0,0 +1,46 @@
1
+ """espeak-ng reads a text longer than 999 bytes whole, to the last letter.
2
+
3
+ The text goes to espeak-ng on stdin. Without ``--stdin``, espeak-ng 1.52.0 reads
4
+ stdin with ``fgets`` into a 1,000-byte buffer (``src/espeak-ng.c``), so it cut a
5
+ longer line mid-word, and in UTF-8 text mid-character. With ``--stdin``, it
6
+ overwrites the last byte of the input, so the text needs a final newline.
7
+
8
+ The reference is espeak-ng's reading of the same text as one command-line
9
+ argument, which it synthesises in one call, and the reading of one sentence
10
+ alone, once per copy.
11
+ """
12
+ import subprocess
13
+
14
+ import pytest
15
+
16
+ from scriptconv_copyleft.phonemizers.mul import EspeakPhonemizer
17
+
18
+ AR_SENTENCE = "ذهب الولد إلى المدرسة صباحا وقرأ كتابا جديدا عن تاريخ المدينة القديمة."
19
+ EN_SENTENCE = "The quick brown fox jumps over the lazy dog near the riverbank."
20
+
21
+
22
+ def argv_reading(text: str, voice: str) -> str:
23
+ return subprocess.run(["espeak-ng", "-q", "-x", "--ipa", "-v", voice, "--", text],
24
+ capture_output=True, text=True, encoding="utf-8", check=True).stdout.strip()
25
+
26
+
27
+ @pytest.mark.parametrize("sentence, lang, voice", [(AR_SENTENCE, "ar", "ar"), (EN_SENTENCE, "en-US", "en-us")],
28
+ ids=["ar", "en"])
29
+ def test_a_line_longer_than_999_bytes_reads_every_word(sentence, lang, voice):
30
+ copies = 2500 // len(sentence.encode("utf-8")) + 1
31
+ text = " ".join([sentence] * copies)
32
+ assert len(text.encode("utf-8")) > 2500
33
+ phonemes = EspeakPhonemizer().phonemize_string(text, lang)
34
+ assert phonemes == argv_reading(text, voice)
35
+ assert phonemes.split() == argv_reading(sentence, voice).split() * copies
36
+
37
+
38
+ @pytest.mark.parametrize("text, lang, voice", [
39
+ ("expected", "en-US", "en-us"),
40
+ ("I expected it", "en-US", "en-us"),
41
+ ("a", "en-US", "en-us"),
42
+ ("مرحبا", "ar", "ar"),
43
+ ("ع", "ar", "ar"),
44
+ ])
45
+ def test_the_last_word_reads_whole(text, lang, voice):
46
+ assert EspeakPhonemizer().phonemize_string(text, lang) == argv_reading(text, voice)