You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/soundex.rst
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,36 @@ prayut_and_somchaip
37
37
38
38
The `prayut_and_somchaip` module is designed for Thai-English cross-language transliterated word retrieval using the Soundex technique. It is particularly useful for matching transliterated words in both languages.
39
39
40
+
complete_soundex
41
+
~~~~~~~~~~~~~~~~
42
+
.. autofunction:: complete_soundex
43
+
44
+
The `complete_soundex` function implements the Complete Soundex algorithm for Thai word phonetic encoding based on Tapsai et al. (2020). Unlike traditional Soundex methods, it generates variable-length codes representing every syllable in a word.
45
+
46
+
Each syllable is encoded using a 7-character block structure:
47
+
48
+
* Initial Consonant (2 chars) - Phonetic grouping
49
+
* Vowel (2 chars) - Including length markers
50
+
* Final Consonant (1 char) - Sonorant clustering
51
+
* Tone (1 char) - Tone mark encoding
52
+
* Cluster Symbol (1 char) - Second consonant in clusters
53
+
54
+
The algorithm handles complex Thai phonetic patterns including ทร transformation, รร special rules, cluster detection, and implicit vowels. Multi-syllable words are automatically tokenized and encoded. This soundex is particularly effective for handling misspelled words, character variations, and similar pronunciations.
55
+
56
+
complete_soundex_similarity
57
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
58
+
.. autofunction:: complete_soundex_similarity
59
+
60
+
The `complete_soundex_similarity` function calculates the similarity between two Complete Soundex codes using character-wise comparison.
61
+
62
+
The similarity is computed using the formula:
63
+
64
+
S(X,Y) = Σ(sim(c_xi, c_yi)) / max(len(X), len(Y))
65
+
66
+
where sim = 1 if characters match at position i, else 0.
67
+
68
+
The result is normalized by the maximum length of the two codes, returning a float between 0.0 (no match) and 1.0 (perfect match). This function is useful for finding phonetically similar Thai words and handling spelling variations.
.. [#prayut_and_somchaip] Prayut Suwanvisat, Somchai Prasitjutrakul. Thai-English Cross-Language Transliterated Word Retrieval using Soundex Technique. In 1998 [cited 2022 Sep 8]. Available from: https://www.cp.eng.chula.ac.th/~somchai/spj/papers/ThaiText/ncsec98-clir.pdf.
68
98
99
+
.. [#complete_soundex] Chalermpol Tapsai, Phayung Meesad, and Choochart Haruechaiyasak. 2020. `Complete Soundex for Thai Words Similarity Analysis <https://ph01.tci-thaijo.org/index.php/IT_Journal/article/view/241562/164358>`_. Information Technology Journal KMUTNB. 2020 June 30;16(1):46–59.
100
+
69
101
.. This enhanced documentation provides clear descriptions of all the modules within the `pythainlp.soundex` module, including their purposes and functionalities. Users can now better understand how to leverage these soundex algorithms for various phonetic matching tasks in the Thai language.
0 commit comments