scriptconv-nonfree 0.2.3a1__tar.gz → 0.2.3a3__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 (41) hide show
  1. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/PKG-INFO +11 -14
  2. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/README.md +10 -13
  3. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/africa.py +3 -3
  4. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/ghana.py +3 -3
  5. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/version.py +1 -1
  6. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree.egg-info/PKG-INFO +11 -14
  7. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/tests/test_phonemizers_africa.py +7 -5
  8. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/tests/test_phonemizers_ghana.py +9 -3
  9. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/LICENSE +0 -0
  10. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/LICENSE.africa-g2p-data.md +0 -0
  11. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/pyproject.toml +0 -0
  12. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/__init__.py +0 -0
  13. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/__init__.py +0 -0
  14. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/__init__.py +0 -0
  15. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/iqra_phonetiser/LICENSE.cc-by-nc-4.0 +0 -0
  16. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/iqra_phonetiser/LICENSE.md +0 -0
  17. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/iqra_phonetiser/__init__.py +0 -0
  18. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/iqra_phonetiser/phonetiser.py +0 -0
  19. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/mantoq/LICENSE.cc-by-nc-4.0 +0 -0
  20. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/mantoq/LICENSE.mantoq +0 -0
  21. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/mantoq/LICENSE.md +0 -0
  22. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/mantoq/__init__.py +0 -0
  23. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/mantoq/buck/__init__.py +0 -0
  24. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/mantoq/buck/phonetise_buckwalter.py +0 -0
  25. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/mantoq/buck/symbols.py +0 -0
  26. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/mantoq/buck/tokenization.py +0 -0
  27. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/mantoq/num2words.py +0 -0
  28. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/_vendored/mantoq/unicode_symbol2label.py +0 -0
  29. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/ar.py +0 -0
  30. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree/phonemizers/vi.py +0 -0
  31. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree.egg-info/SOURCES.txt +0 -0
  32. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree.egg-info/dependency_links.txt +0 -0
  33. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree.egg-info/requires.txt +0 -0
  34. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/scriptconv_nonfree.egg-info/top_level.txt +0 -0
  35. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/setup.cfg +0 -0
  36. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/tests/test_match_lang_direction.py +0 -0
  37. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/tests/test_phonemizers_cjk_ar.py +0 -0
  38. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/tests/test_phonemizers_friendly_import_errors.py +0 -0
  39. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/tests/test_phonemizers_halabi_iqra.py +0 -0
  40. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/tests/test_phonemizers_identity.py +0 -0
  41. {scriptconv_nonfree-0.2.3a1 → scriptconv_nonfree-0.2.3a3}/tests/test_phonemizers_mantoq_long_digits.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptconv-nonfree
3
- Version: 0.2.3a1
3
+ Version: 0.2.3a3
4
4
  Summary: scriptconv phonemizer backends whose code, data or dependencies are non-commercial or carry no licence grant
5
5
  Author-email: TigreGotico <contact@tigregotico.com>
6
6
  License-Expression: Apache-2.0 AND MIT AND CC-BY-NC-4.0 AND LicenseRef-AfricaG2P-Data
@@ -88,16 +88,9 @@ African backends and the draft rule tables.
88
88
 
89
89
  ## Backends
90
90
 
91
- | `Phonemizer` values | scriptconv extra | Restricted item |
92
- | --- | --- | --- |
93
- | `mantoq`, `halabi`, `iqra` | `ar-phonemizers` | the Arabic-Phonetiser of Nawar Halabi, CC-BY-NC-4.0 |
94
- | `viphoneme` | `vi` | viphoneme and vinorm, "Free for non-commercial use" |
95
- | `africa_g2p` | `africa` | the africa-g2p rule tables, with no licence grant |
96
- | `ghana_g2p` | `ghana` | the same rule tables, which ghana-g2p loads |
97
-
98
- scriptconv never picks one of these backends by default: the Arabic default
99
- is arbtok. The [backend reference](docs/backends.md) gives the languages,
100
- alphabets and parameters of each backend.
91
+ The backends are `mantoq`, `halabi` and `iqra` (extra `ar-phonemizers`),
92
+ `viphoneme` (`vi`), `africa_g2p` (`africa`) and `ghana_g2p` (`ghana`).
93
+ scriptconv never picks one of them by default.
101
94
 
102
95
  ## Licence
103
96
 
@@ -111,6 +104,10 @@ gives the restricted item of each backend and the licence of each file.
111
104
 
112
105
  ## Documentation
113
106
 
114
- The [documentation index](docs/index.md) lists every page in reading order.
115
- The [scriptconv documentation](https://github.com/TigreGotico/scriptconv/tree/dev/docs)
116
- explains the phonemizer contract and the other backends.
107
+ | Page | Read it for |
108
+ | --- | --- |
109
+ | [docs/getting-started.md](docs/getting-started.md) | install, the alphabets, the draft rule tables |
110
+ | [docs/how-it-works.md](docs/how-it-works.md) | how scriptconv finds and imports these backends |
111
+ | [docs/backends.md](docs/backends.md) | the languages, alphabets and parameters of each backend |
112
+ | [docs/licences.md](docs/licences.md) | the restricted item of each backend, the licence of each file |
113
+ | [docs/index.md](docs/index.md) | every page in reading order |
@@ -34,16 +34,9 @@ African backends and the draft rule tables.
34
34
 
35
35
  ## Backends
36
36
 
37
- | `Phonemizer` values | scriptconv extra | Restricted item |
38
- | --- | --- | --- |
39
- | `mantoq`, `halabi`, `iqra` | `ar-phonemizers` | the Arabic-Phonetiser of Nawar Halabi, CC-BY-NC-4.0 |
40
- | `viphoneme` | `vi` | viphoneme and vinorm, "Free for non-commercial use" |
41
- | `africa_g2p` | `africa` | the africa-g2p rule tables, with no licence grant |
42
- | `ghana_g2p` | `ghana` | the same rule tables, which ghana-g2p loads |
43
-
44
- scriptconv never picks one of these backends by default: the Arabic default
45
- is arbtok. The [backend reference](docs/backends.md) gives the languages,
46
- alphabets and parameters of each backend.
37
+ The backends are `mantoq`, `halabi` and `iqra` (extra `ar-phonemizers`),
38
+ `viphoneme` (`vi`), `africa_g2p` (`africa`) and `ghana_g2p` (`ghana`).
39
+ scriptconv never picks one of them by default.
47
40
 
48
41
  ## Licence
49
42
 
@@ -57,6 +50,10 @@ gives the restricted item of each backend and the licence of each file.
57
50
 
58
51
  ## Documentation
59
52
 
60
- The [documentation index](docs/index.md) lists every page in reading order.
61
- The [scriptconv documentation](https://github.com/TigreGotico/scriptconv/tree/dev/docs)
62
- explains the phonemizer contract and the other backends.
53
+ | Page | Read it for |
54
+ | --- | --- |
55
+ | [docs/getting-started.md](docs/getting-started.md) | install, the alphabets, the draft rule tables |
56
+ | [docs/how-it-works.md](docs/how-it-works.md) | how scriptconv finds and imports these backends |
57
+ | [docs/backends.md](docs/backends.md) | the languages, alphabets and parameters of each backend |
58
+ | [docs/licences.md](docs/licences.md) | the restricted item of each backend, the licence of each file |
59
+ | [docs/index.md](docs/index.md) | every page in reading order |
@@ -109,12 +109,12 @@ class AfricaG2PPhonemizer(BasePhonemizer):
109
109
  self.allow_draft_rules = allow_draft_rules
110
110
  self._cache: dict[str, object] = {}
111
111
 
112
- def _engine(self, resolved_lang: str):
112
+ def _engine(self, resolved_lang: str, target_lang: str):
113
113
  """Return, lazily creating and caching, the pipeline for *resolved_lang*. A draft table is refused unless
114
114
  the instance was built with ``allow_draft_rules=True``."""
115
115
  if resolved_lang not in self._cache:
116
116
  if not self.allow_draft_rules:
117
- refuse_draft(resolved_lang, resolved_lang, "africa-g2p")
117
+ refuse_draft(resolved_lang, target_lang, "africa-g2p")
118
118
  output = "ipa" if self.alphabet == Alphabet.IPA else "grapheme"
119
119
  self._cache[resolved_lang] = _africa_g2p().AfricaPipeline(
120
120
  lang=resolved_lang, output=output)
@@ -166,4 +166,4 @@ class AfricaG2PPhonemizer(BasePhonemizer):
166
166
  raise UnsupportedLanguageError(f"africa-g2p: unsupported language {target_lang!r}")
167
167
 
168
168
  def phonemize_string(self, text: str, lang: str) -> str:
169
- return self._engine(self.get_lang(lang)).run(text, sep=" ")
169
+ return self._engine(self.get_lang(lang), lang).run(text, sep=" ")
@@ -69,12 +69,12 @@ class GhanaG2PPhonemizer(BasePhonemizer):
69
69
  self.allow_draft_rules = allow_draft_rules
70
70
  self._cache: dict[str, object] = {}
71
71
 
72
- def _engine(self, resolved_lang: str):
72
+ def _engine(self, resolved_lang: str, target_lang: str):
73
73
  """Return, lazily creating and caching, the engine for *resolved_lang*. A language on a draft africa-g2p
74
74
  table is refused unless the instance was built with ``allow_draft_rules=True``."""
75
75
  if resolved_lang not in self._cache:
76
76
  if not self.allow_draft_rules:
77
- refuse_draft(_rule_tables()[resolved_lang], resolved_lang, "ghana-g2p")
77
+ refuse_draft(_rule_tables()[resolved_lang], target_lang, "ghana-g2p")
78
78
  self._cache[resolved_lang] = _ghana_g2p().GhanaG2P(resolved_lang)
79
79
  return self._cache[resolved_lang]
80
80
 
@@ -103,7 +103,7 @@ class GhanaG2PPhonemizer(BasePhonemizer):
103
103
  return key
104
104
 
105
105
  def phonemize_string(self, text: str, lang: str) -> str:
106
- engine = self._engine(self.get_lang(lang))
106
+ engine = self._engine(self.get_lang(lang), lang)
107
107
  if self.alphabet == Alphabet.IPA:
108
108
  return engine.ipa(text, sep=" ")
109
109
  return engine.grapheme(text, sep=" ")
@@ -2,7 +2,7 @@
2
2
  VERSION_MAJOR = 0
3
3
  VERSION_MINOR = 2
4
4
  VERSION_BUILD = 3
5
- VERSION_ALPHA = 1
5
+ VERSION_ALPHA = 3
6
6
  # END_VERSION_BLOCK
7
7
 
8
8
  __version__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_BUILD}" + (f"a{VERSION_ALPHA}" if VERSION_ALPHA else "")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptconv-nonfree
3
- Version: 0.2.3a1
3
+ Version: 0.2.3a3
4
4
  Summary: scriptconv phonemizer backends whose code, data or dependencies are non-commercial or carry no licence grant
5
5
  Author-email: TigreGotico <contact@tigregotico.com>
6
6
  License-Expression: Apache-2.0 AND MIT AND CC-BY-NC-4.0 AND LicenseRef-AfricaG2P-Data
@@ -88,16 +88,9 @@ African backends and the draft rule tables.
88
88
 
89
89
  ## Backends
90
90
 
91
- | `Phonemizer` values | scriptconv extra | Restricted item |
92
- | --- | --- | --- |
93
- | `mantoq`, `halabi`, `iqra` | `ar-phonemizers` | the Arabic-Phonetiser of Nawar Halabi, CC-BY-NC-4.0 |
94
- | `viphoneme` | `vi` | viphoneme and vinorm, "Free for non-commercial use" |
95
- | `africa_g2p` | `africa` | the africa-g2p rule tables, with no licence grant |
96
- | `ghana_g2p` | `ghana` | the same rule tables, which ghana-g2p loads |
97
-
98
- scriptconv never picks one of these backends by default: the Arabic default
99
- is arbtok. The [backend reference](docs/backends.md) gives the languages,
100
- alphabets and parameters of each backend.
91
+ The backends are `mantoq`, `halabi` and `iqra` (extra `ar-phonemizers`),
92
+ `viphoneme` (`vi`), `africa_g2p` (`africa`) and `ghana_g2p` (`ghana`).
93
+ scriptconv never picks one of them by default.
101
94
 
102
95
  ## Licence
103
96
 
@@ -111,6 +104,10 @@ gives the restricted item of each backend and the licence of each file.
111
104
 
112
105
  ## Documentation
113
106
 
114
- The [documentation index](docs/index.md) lists every page in reading order.
115
- The [scriptconv documentation](https://github.com/TigreGotico/scriptconv/tree/dev/docs)
116
- explains the phonemizer contract and the other backends.
107
+ | Page | Read it for |
108
+ | --- | --- |
109
+ | [docs/getting-started.md](docs/getting-started.md) | install, the alphabets, the draft rule tables |
110
+ | [docs/how-it-works.md](docs/how-it-works.md) | how scriptconv finds and imports these backends |
111
+ | [docs/backends.md](docs/backends.md) | the languages, alphabets and parameters of each backend |
112
+ | [docs/licences.md](docs/licences.md) | the restricted item of each backend, the licence of each file |
113
+ | [docs/index.md](docs/index.md) | every page in reading order |
@@ -68,11 +68,11 @@ class TestAfricaG2PPhonemizer(unittest.TestCase):
68
68
 
69
69
  def test_engine_is_cached_per_language(self):
70
70
  p = AfricaG2PPhonemizer()
71
- first = p._engine("yor")
72
- self.assertIs(p._engine("yor"), first)
71
+ first = p._engine("yor", "yor")
72
+ self.assertIs(p._engine("yor", "yor"), first)
73
73
 
74
74
  def test_the_engine_is_the_installed_africa_g2p(self):
75
- engine = AfricaG2PPhonemizer()._engine("yor")
75
+ engine = AfricaG2PPhonemizer()._engine("yor", "yor")
76
76
  self.assertIs(type(engine.g2p), africa_g2p.G2P)
77
77
 
78
78
  def test_identity_names_the_africa_g2p_release(self):
@@ -119,8 +119,10 @@ class TestDraftTables(unittest.TestCase):
119
119
  self.assertEqual(AfricaG2PPhonemizer.get_lang("aab"), "aab")
120
120
  with self.assertRaisesRegex(UnsupportedLanguageError, "'aab'.*'llm-draft'.*allow_draft_rules"):
121
121
  p.phonemize_string("aba", "aab")
122
- with self.assertRaisesRegex(UnsupportedLanguageError, "llm-draft"):
123
- p.phonemize_string("aba", "aab")
122
+
123
+ def test_a_draft_refusal_names_the_caller_tag(self):
124
+ with self.assertRaisesRegex(UnsupportedLanguageError, "table 'aab' for 'aab-NG'"):
125
+ AfricaG2PPhonemizer().phonemize_string("aba", "aab-NG")
124
126
 
125
127
  def test_a_draft_only_language_runs_with_the_flag(self):
126
128
  p = AfricaG2PPhonemizer(allow_draft_rules=True)
@@ -66,8 +66,8 @@ class TestGhanaG2PPhonemizer(unittest.TestCase):
66
66
 
67
67
  def test_engine_is_cached_per_language(self):
68
68
  p = GhanaG2PPhonemizer()
69
- first = p._engine("twi")
70
- self.assertIs(p._engine("twi"), first)
69
+ first = p._engine("twi", "twi")
70
+ self.assertIs(p._engine("twi", "twi"), first)
71
71
 
72
72
  def test_rejects_unsupported_alphabet(self):
73
73
  with self.assertRaises(ValueError):
@@ -81,7 +81,7 @@ class TestOneAfricaG2P(unittest.TestCase):
81
81
  def test_both_backends_read_one_africa_g2p(self):
82
82
  # ghana-g2p imports africa_g2p.G2P; the africa backend must run the
83
83
  # same class from the same installed distribution.
84
- engine = AfricaG2PPhonemizer()._engine("yor")
84
+ engine = AfricaG2PPhonemizer()._engine("yor", "yor")
85
85
  self.assertIs(type(engine.g2p), ghana_g2p.core.G2P)
86
86
  loaded_by_ghana = sys.modules[ghana_g2p.core.G2P.__module__.partition(".")[0]]
87
87
  self.assertEqual(AfricaG2PPhonemizer().identity("yor").version,
@@ -107,6 +107,12 @@ class TestDraftTables(unittest.TestCase):
107
107
  # Adangme borrows the Ga table.
108
108
  GhanaG2PPhonemizer().phonemize_string("a", "ada")
109
109
 
110
+ def test_a_draft_refusal_names_the_caller_tag(self):
111
+ with mock.patch.object(africa_g2p.loader, "load_rules",
112
+ return_value={"confidence": "llm-draft"}), \
113
+ self.assertRaisesRegex(UnsupportedLanguageError, "table 'gaa' for 'ada-GH'"):
114
+ GhanaG2PPhonemizer().phonemize_string("a", "ada-GH")
115
+
110
116
  def test_get_lang_answers_on_the_class(self):
111
117
  self.assertEqual(GhanaG2PPhonemizer.get_lang("twi-GH"), "twi")
112
118