scriptconv 0.0.1__tar.gz → 0.0.1a5__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 (23) hide show
  1. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/PKG-INFO +3 -6
  2. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/README.md +2 -5
  3. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv/__init__.py +0 -2
  4. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv/notation.py +0 -54
  5. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv/version.py +1 -1
  6. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv.egg-info/PKG-INFO +3 -6
  7. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/tests/test_notation.py +0 -30
  8. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/LICENSE +0 -0
  9. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/pyproject.toml +0 -0
  10. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/requirements.txt +0 -0
  11. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv/__main__.py +0 -0
  12. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv/py.typed +0 -0
  13. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv/scripts.py +0 -0
  14. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv/translit.py +0 -0
  15. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv.egg-info/SOURCES.txt +0 -0
  16. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv.egg-info/dependency_links.txt +0 -0
  17. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv.egg-info/requires.txt +0 -0
  18. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/scriptconv.egg-info/top_level.txt +0 -0
  19. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/setup.cfg +0 -0
  20. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/tests/test_cli.py +0 -0
  21. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/tests/test_examples.py +0 -0
  22. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/tests/test_scripts.py +0 -0
  23. {scriptconv-0.0.1 → scriptconv-0.0.1a5}/tests/test_translit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptconv
3
- Version: 0.0.1
3
+ Version: 0.0.1a5
4
4
  Summary: Shared script-conversion core — ISO-15924 detection, IPA↔ARPA/X-SAMPA/Lexique, Buckwalter, Hangul→jamo
5
5
  License: Apache-2.0
6
6
  Project-URL: Homepage, https://github.com/TigreGotico/scriptconv
@@ -75,7 +75,7 @@ from scriptconv import (
75
75
  xsampa_to_ipa, ipa_to_xsampa,
76
76
  buckwalter_to_arabic, arabic_to_buckwalter,
77
77
  lexique_to_ipa, ipa_to_lexique,
78
- kirshenbaum_to_ipa, ipa_to_kirshenbaum, looks_like_ipa,
78
+ kirshenbaum_to_ipa, ipa_to_kirshenbaum,
79
79
  decompose_hangul, hira_to_kana, kana_to_hira,
80
80
  convert, can_convert, convert_batch, Notation, NOTATION_INFO,
81
81
  )
@@ -107,9 +107,6 @@ ipa_to_lexique("vɛ̃") # "v5" (vin)
107
107
  kirshenbaum_to_ipa("S") # "ʃ" (espeak-ng ASCII-IPA)
108
108
  ipa_to_kirshenbaum("ŋ") # "N"
109
109
 
110
- looks_like_ipa("pʰɑtʃ") # True (heuristic: has IPA-distinctive symbols)
111
- looks_like_ipa("hello") # False
112
-
113
110
  decompose_hangul("국민") # "ㄱㅜㄱㅁㅣㄴ" (orthographic jamo, no assimilation)
114
111
  hira_to_kana("ひらがな") # "ヒラガナ"
115
112
  kana_to_hira("カタカナ") # "かたかな"
@@ -139,7 +136,7 @@ python -m scriptconv lang ko
139
136
  | Module | Contents |
140
137
  |--------|----------|
141
138
  | `scriptconv.scripts` | `Script` dataclass (with `script_type`), `SCRIPT_REGISTRY` (34 scripts), `detect_script`, `char_script`, `script_distribution`, `script_runs`, `base_direction`, `lang_to_script`, `script_to_langs`, `normalize_script_tag` |
142
- | `scriptconv.notation` | `Notation` enum, `NotationInfo`/`NOTATION_INFO` fidelity registry, `convert` facade, `can_convert` predicate, `convert_batch` generator, pair-wise converters (ARPABET ↔ IPA, X-SAMPA ↔ IPA, Buckwalter ↔ Arabic, Lexique ↔ IPA, Kirshenbaum ↔ IPA), `looks_like_ipa` detector |
139
+ | `scriptconv.notation` | `Notation` enum, `NotationInfo`/`NOTATION_INFO` fidelity registry, `convert` facade, `can_convert` predicate, `convert_batch` generator, pair-wise converters (ARPABET ↔ IPA, X-SAMPA ↔ IPA, Buckwalter ↔ Arabic, Lexique ↔ IPA, Kirshenbaum ↔ IPA) |
143
140
  | `scriptconv.translit` | `decompose_hangul` (Hangul blocks → jamo, compatibility or conjoining), `hira_to_kana`/`kana_to_hira` — all orthographic only |
144
141
 
145
142
  ## Documentation
@@ -48,7 +48,7 @@ from scriptconv import (
48
48
  xsampa_to_ipa, ipa_to_xsampa,
49
49
  buckwalter_to_arabic, arabic_to_buckwalter,
50
50
  lexique_to_ipa, ipa_to_lexique,
51
- kirshenbaum_to_ipa, ipa_to_kirshenbaum, looks_like_ipa,
51
+ kirshenbaum_to_ipa, ipa_to_kirshenbaum,
52
52
  decompose_hangul, hira_to_kana, kana_to_hira,
53
53
  convert, can_convert, convert_batch, Notation, NOTATION_INFO,
54
54
  )
@@ -80,9 +80,6 @@ ipa_to_lexique("vɛ̃") # "v5" (vin)
80
80
  kirshenbaum_to_ipa("S") # "ʃ" (espeak-ng ASCII-IPA)
81
81
  ipa_to_kirshenbaum("ŋ") # "N"
82
82
 
83
- looks_like_ipa("pʰɑtʃ") # True (heuristic: has IPA-distinctive symbols)
84
- looks_like_ipa("hello") # False
85
-
86
83
  decompose_hangul("국민") # "ㄱㅜㄱㅁㅣㄴ" (orthographic jamo, no assimilation)
87
84
  hira_to_kana("ひらがな") # "ヒラガナ"
88
85
  kana_to_hira("カタカナ") # "かたかな"
@@ -112,7 +109,7 @@ python -m scriptconv lang ko
112
109
  | Module | Contents |
113
110
  |--------|----------|
114
111
  | `scriptconv.scripts` | `Script` dataclass (with `script_type`), `SCRIPT_REGISTRY` (34 scripts), `detect_script`, `char_script`, `script_distribution`, `script_runs`, `base_direction`, `lang_to_script`, `script_to_langs`, `normalize_script_tag` |
115
- | `scriptconv.notation` | `Notation` enum, `NotationInfo`/`NOTATION_INFO` fidelity registry, `convert` facade, `can_convert` predicate, `convert_batch` generator, pair-wise converters (ARPABET ↔ IPA, X-SAMPA ↔ IPA, Buckwalter ↔ Arabic, Lexique ↔ IPA, Kirshenbaum ↔ IPA), `looks_like_ipa` detector |
112
+ | `scriptconv.notation` | `Notation` enum, `NotationInfo`/`NOTATION_INFO` fidelity registry, `convert` facade, `can_convert` predicate, `convert_batch` generator, pair-wise converters (ARPABET ↔ IPA, X-SAMPA ↔ IPA, Buckwalter ↔ Arabic, Lexique ↔ IPA, Kirshenbaum ↔ IPA) |
116
113
  | `scriptconv.translit` | `decompose_hangul` (Hangul blocks → jamo, compatibility or conjoining), `hira_to_kana`/`kana_to_hira` — all orthographic only |
117
114
 
118
115
  ## Documentation
@@ -50,7 +50,6 @@ from scriptconv.notation import (
50
50
  ipa_to_lexique,
51
51
  kirshenbaum_to_ipa,
52
52
  ipa_to_kirshenbaum,
53
- looks_like_ipa,
54
53
  )
55
54
  from scriptconv.translit import (
56
55
  decompose_hangul,
@@ -87,7 +86,6 @@ __all__ = [
87
86
  "ipa_to_lexique",
88
87
  "kirshenbaum_to_ipa",
89
88
  "ipa_to_kirshenbaum",
90
- "looks_like_ipa",
91
89
  # translit
92
90
  "decompose_hangul",
93
91
  "hira_to_kana",
@@ -37,7 +37,6 @@ __all__ = [
37
37
  "ipa_to_lexique",
38
38
  "kirshenbaum_to_ipa",
39
39
  "ipa_to_kirshenbaum",
40
- "looks_like_ipa",
41
40
  ]
42
41
 
43
42
 
@@ -895,56 +894,3 @@ def convert_batch(
895
894
  yield stripped
896
895
  else:
897
896
  yield convert(stripped, _src, _dst)
898
-
899
-
900
- # ---------------------------------------------------------------------------
901
- # looks_like_ipa — heuristic notation detection
902
- # ---------------------------------------------------------------------------
903
-
904
- # Unicode blocks/characters that are distinctive to IPA transcription. Basic
905
- # Latin letters (p, a, t, …) and the Greek letters IPA borrows (β, θ, χ) are
906
- # deliberately excluded: they are indistinguishable from ordinary Latin/Greek
907
- # text, so they carry no signal.
908
- _IPA_DISTINCTIVE_RANGES = (
909
- (0x0250, 0x02AF), # IPA Extensions
910
- (0x02B0, 0x02FF), # Spacing Modifier Letters (ˈ ˌ ː ˑ ʰ ʲ …)
911
- (0x0363, 0x036F), # Combining diacritics used in IPA
912
- (0x1D00, 0x1D7F), # Phonetic Extensions
913
- (0x1D80, 0x1DBF), # Phonetic Extensions Supplement
914
- )
915
- # Individual combining marks common in IPA (nasalisation, syllabicity, etc.).
916
- _IPA_DISTINCTIVE_CHARS = frozenset("̩̪̥̃̊͜͡")
917
-
918
-
919
- def _is_ipa_distinctive(ch: str) -> bool:
920
- cp = ord(ch)
921
- if ch in _IPA_DISTINCTIVE_CHARS:
922
- return True
923
- return any(lo <= cp <= hi for lo, hi in _IPA_DISTINCTIVE_RANGES)
924
-
925
-
926
- def looks_like_ipa(text: str) -> bool:
927
- """Heuristically decide whether *text* is an IPA transcription.
928
-
929
- Returns ``True`` when *text* contains at least one character that is
930
- distinctive to IPA — from the IPA Extensions, Spacing Modifier Letters,
931
- or Phonetic Extensions blocks, or an IPA combining diacritic (e.g.
932
- ``ɑ``, ``ʃ``, ``ː``, ``ˈ``, nasalisation).
933
-
934
- This is a positive-signal heuristic, not a classifier: a transcription
935
- written only with characters IPA shares with the Latin alphabet
936
- (``"pat"``, ``"bad"``) has no distinctive marker and returns ``False``.
937
- It cannot be otherwise — those characters are the same codepoints as
938
- ordinary text. Use it to *guard* against feeding IPA where orthography
939
- is expected, not to prove a string is not IPA.
940
-
941
- Examples
942
- --------
943
- >>> looks_like_ipa("pʰɑtʃ")
944
- True
945
- >>> looks_like_ipa("ˈhɛloʊ")
946
- True
947
- >>> looks_like_ipa("hello")
948
- False
949
- """
950
- return any(_is_ipa_distinctive(ch) for ch in text)
@@ -2,7 +2,7 @@
2
2
  VERSION_MAJOR = 0
3
3
  VERSION_MINOR = 0
4
4
  VERSION_BUILD = 1
5
- VERSION_ALPHA = 0
5
+ VERSION_ALPHA = 5
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.1
3
+ Version: 0.0.1a5
4
4
  Summary: Shared script-conversion core — ISO-15924 detection, IPA↔ARPA/X-SAMPA/Lexique, Buckwalter, Hangul→jamo
5
5
  License: Apache-2.0
6
6
  Project-URL: Homepage, https://github.com/TigreGotico/scriptconv
@@ -75,7 +75,7 @@ from scriptconv import (
75
75
  xsampa_to_ipa, ipa_to_xsampa,
76
76
  buckwalter_to_arabic, arabic_to_buckwalter,
77
77
  lexique_to_ipa, ipa_to_lexique,
78
- kirshenbaum_to_ipa, ipa_to_kirshenbaum, looks_like_ipa,
78
+ kirshenbaum_to_ipa, ipa_to_kirshenbaum,
79
79
  decompose_hangul, hira_to_kana, kana_to_hira,
80
80
  convert, can_convert, convert_batch, Notation, NOTATION_INFO,
81
81
  )
@@ -107,9 +107,6 @@ ipa_to_lexique("vɛ̃") # "v5" (vin)
107
107
  kirshenbaum_to_ipa("S") # "ʃ" (espeak-ng ASCII-IPA)
108
108
  ipa_to_kirshenbaum("ŋ") # "N"
109
109
 
110
- looks_like_ipa("pʰɑtʃ") # True (heuristic: has IPA-distinctive symbols)
111
- looks_like_ipa("hello") # False
112
-
113
110
  decompose_hangul("국민") # "ㄱㅜㄱㅁㅣㄴ" (orthographic jamo, no assimilation)
114
111
  hira_to_kana("ひらがな") # "ヒラガナ"
115
112
  kana_to_hira("カタカナ") # "かたかな"
@@ -139,7 +136,7 @@ python -m scriptconv lang ko
139
136
  | Module | Contents |
140
137
  |--------|----------|
141
138
  | `scriptconv.scripts` | `Script` dataclass (with `script_type`), `SCRIPT_REGISTRY` (34 scripts), `detect_script`, `char_script`, `script_distribution`, `script_runs`, `base_direction`, `lang_to_script`, `script_to_langs`, `normalize_script_tag` |
142
- | `scriptconv.notation` | `Notation` enum, `NotationInfo`/`NOTATION_INFO` fidelity registry, `convert` facade, `can_convert` predicate, `convert_batch` generator, pair-wise converters (ARPABET ↔ IPA, X-SAMPA ↔ IPA, Buckwalter ↔ Arabic, Lexique ↔ IPA, Kirshenbaum ↔ IPA), `looks_like_ipa` detector |
139
+ | `scriptconv.notation` | `Notation` enum, `NotationInfo`/`NOTATION_INFO` fidelity registry, `convert` facade, `can_convert` predicate, `convert_batch` generator, pair-wise converters (ARPABET ↔ IPA, X-SAMPA ↔ IPA, Buckwalter ↔ Arabic, Lexique ↔ IPA, Kirshenbaum ↔ IPA) |
143
140
  | `scriptconv.translit` | `decompose_hangul` (Hangul blocks → jamo, compatibility or conjoining), `hira_to_kana`/`kana_to_hira` — all orthographic only |
144
141
 
145
142
  ## Documentation
@@ -1027,33 +1027,3 @@ def test_lossless_to_ipa_flag_backed_by_round_trip():
1027
1027
  if info.lossless_to_ipa and notation in samples:
1028
1028
  for ch in samples[notation]:
1029
1029
  assert from_ipa[notation](to_ipa[notation](ch)) == ch, notation
1030
-
1031
-
1032
- # ---------------------------------------------------------------------------
1033
- # looks_like_ipa — heuristic notation detection
1034
- # ---------------------------------------------------------------------------
1035
-
1036
- from scriptconv.notation import looks_like_ipa # noqa: E402
1037
-
1038
-
1039
- @pytest.mark.parametrize("text", [
1040
- "pʰɑtʃ", # IPA Extensions + modifier
1041
- "ˈhɛloʊ", # stress mark + IPA Extensions
1042
- "ɑ", # single IPA Extensions char
1043
- "næ̃", # combining nasalisation
1044
- "kat̪", # combining dental diacritic
1045
- ])
1046
- def test_looks_like_ipa_true(text):
1047
- assert looks_like_ipa(text) is True
1048
-
1049
-
1050
- @pytest.mark.parametrize("text", [
1051
- "", # empty
1052
- "hello", # plain Latin — ambiguous, no distinctive marker
1053
- "att", # overlaps Latin
1054
- "café", # accented Latin is not IPA-distinctive
1055
- "θaβ", # bare Greek letters carry no IPA signal
1056
- "مرحبا", # Arabic
1057
- ])
1058
- def test_looks_like_ipa_false(text):
1059
- assert looks_like_ipa(text) is False
File without changes
File without changes
File without changes