phonematcher 0.0.0a2__py3-none-any.whl

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.
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: phonematcher
3
+ Version: 0.0.0a2
4
+ Summary: Distinctive-feature distances between IPA phones, and phonetic fuzzy search over IPA
5
+ Author-email: JarbasAi <jarbasai@mailfence.com>
6
+ License-Expression: MIT
7
+ Project-URL: Source, https://github.com/TigreGotico/phonematcher
8
+ Requires-Python: >=3.11
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Provides-Extra: test
12
+ Requires-Dist: pytest>=8; extra == "test"
13
+ Dynamic: license-file
14
+
15
+ # phonematcher
16
+
17
+ phonematcher measures how far apart two IPA sounds are, and finds terms that sound like a query. It works on IPA only. To get IPA from text, use a grapheme-to-IPA library such as [orthography2ipa](https://github.com/TigreGotico/orthography2ipa).
18
+
19
+ Every distance comes from distinctive features. The feature table starts from PanPhon (Mortensen et al. 2016), takes the vowels from the IPA chart, and lists every other change with its source. [docs/features.md](docs/features.md) explains the table.
20
+
21
+ ## Install
22
+
23
+ ```
24
+ uv pip install phonematcher
25
+ ```
26
+
27
+ phonematcher has no runtime dependencies.
28
+
29
+ ## Distance between sounds
30
+
31
+ ```python
32
+ from phonematcher import phonetic_distance, ipa_distance, segments
33
+
34
+ phonetic_distance("ʁ", "χ") # 0.013: uvular fricatives that differ only in voice
35
+ phonetic_distance("ʁ", "k") # 0.118: a different manner and place
36
+ segments("ˈt͡ʃɐ̃w̃") # ['t͡ʃ', 'ɐ̃', 'w̃']
37
+ ipa_distance("ˈpojʃ", "ˈpojs") # 0.039: one near substitution
38
+ ```
39
+
40
+ `phonetic_distance` compares two segments, from 0 to 1. `ipa_distance` compares two IPA strings: an edit distance where a substitution costs the feature distance and an insertion or deletion costs 1.
41
+
42
+ ## Search by sound
43
+
44
+ ```python
45
+ from orthography2ipa import transcribe
46
+ from phonematcher import PhoneticFuzzySearch
47
+
48
+ search = PhoneticFuzzySearch()
49
+ for word in ["pois", "retirada", "carro", "caro", "casa", "dia"]:
50
+ search.add_term(transcribe(word, "pt-PT"), word)
51
+
52
+ query = transcribe("carro", "pt-BR-x-rj") # 'ˈkaχu'
53
+ best = search.search(query)[0]
54
+ best.id, best.term, round(best.score, 3) # ('carro', ('ˈkaʁu',), 0.013)
55
+ ```
56
+
57
+ A term may have several readings: `search.add_term(["ˈpojʃ", "ˈpojs"], "pois")`.
58
+
59
+ ## Documentation
60
+
61
+ - [docs/quickstart.md](docs/quickstart.md): first steps.
62
+ - [docs/features.md](docs/features.md): the feature table, its sources and the distance.
63
+ - [docs/api.md](docs/api.md): every public name.
64
+
65
+ ## Licence
66
+
67
+ MIT. The feature table derives from PanPhon (MIT) and from Hayes (2009) through the CSV conversion by Kyle Gorman (Apache-2.0).
@@ -0,0 +1,14 @@
1
+ phonematcher/__init__.py,sha256=Xf-VZ-8hg7BFQsFfC56tPajoAQ-5XlXKzppBH2gHi4s,205
2
+ phonematcher/clustering.py,sha256=x3uSimkrZZO6KGSMC6sSRz-p3lRus7dUv8GwDiv0KlA,5956
3
+ phonematcher/distance.py,sha256=1tZpK0JsPPnasFlbDJFIViNdt1oXutDKpVi1Q2ms8Cs,3179
4
+ phonematcher/features.py,sha256=mB20grIW1tURl3utOgP8MCKo90hA2p2YD8RIeOMZduo,5649
5
+ phonematcher/phonex.py,sha256=-H0B2yC42CnD_JYZ8EQdfnkHao1j7Q9Fx2KxeKurnEE,519
6
+ phonematcher/scales.py,sha256=1tBY8u7YWvDhYDQYLc0QNA23q2TUCJ7p40w-zYAJcBA,2064
7
+ phonematcher/version.py,sha256=SEDNeWBTV__ZA5CSjXUHnJIyPunXG5SOkPmNEdQtuWE,237
8
+ phonematcher/data/features.json,sha256=kSVYGyx0EQmRSTP70kE_QFtSHWMxb4mwvW2engi0Xco,321419
9
+ phonematcher/data/overrides.json,sha256=eGHkR4y_PiEA8_MfkO8aWN_4ohWYDZNNFDNG_jkHNAw,16273
10
+ phonematcher-0.0.0a2.dist-info/licenses/LICENSE,sha256=Q9tNtL2UgvxJ2hK2OFVVb9LJHO_sHP9785e25qdm7nc,1127
11
+ phonematcher-0.0.0a2.dist-info/METADATA,sha256=x6CD0DphzViIETNfR_K17UlMvHZF48wty0jQWOe9E5g,2549
12
+ phonematcher-0.0.0a2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
13
+ phonematcher-0.0.0a2.dist-info/top_level.txt,sha256=zYZWcBwhqh4IA_xM54ihbQiHDVPXlzSvixJxf7L2FRI,13
14
+ phonematcher-0.0.0a2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) TigreGotico
4
+ Portions copyright 2017 Ling Zhang (pyphone, fast_fuzzy_search)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ phonematcher