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
Reformatted documentation for better readability:
1. complete_soundex section:
- Split long paragraph into multiple sentences
- Added bullet list for 7-character block structure
- Improved organization of technical details
2. complete_soundex_similarity section:
- Separated formula into its own indented block
- Better formatting for mathematical formula
- Clearer explanation of return values
Changes improve documentation readability while maintaining all technical information.
Co-authored-by: wannaphong <8536487+wannaphong@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/api/soundex.rst
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,13 +41,31 @@ complete_soundex
41
41
~~~~~~~~~~~~~~~~
42
42
.. autofunction:: complete_soundex
43
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 using a 7-character block structure (Initial Consonant, Vowel, Final Consonant, Tone, Cluster Symbol). 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.
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.
45
55
46
56
complete_soundex_similarity
47
57
~~~~~~~~~~~~~~~~~~~~~~~~~~~
48
58
.. autofunction:: complete_soundex_similarity
49
59
50
-
The `complete_soundex_similarity` function calculates the similarity between two Complete Soundex codes using character-wise comparison. The similarity is computed using the formula S(X,Y) = Σ(sim(c_xi, c_yi)) / max(len(X), len(Y)), where sim = 1 if characters match at position i, else 0. 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.
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.
0 commit comments