@@ -39,6 +39,14 @@ def word2audio(word: str) -> str:
3939 :param str word: Thai word
4040 :return: IPA that remove tone from the text
4141 :rtype: str
42+
43+ :Example:
44+ ::
45+
46+ from pythainlp.soundex.sound import word2audio
47+
48+ word2audio("น้ำ")
49+ # output : 'n aː m .'
4250 """
4351 _word = word_tokenize (word )
4452 _phone = [pronunciate (w , engine = "w2p" ) for w in _word ]
@@ -48,8 +56,20 @@ def word2audio(word: str) -> str:
4856def audio_vector (word :str ) -> List [List [int ]]:
4957 """
5058 Convert audio to vector list
59+
60+ :param str word: Thai word
61+ :return: List feature from panphon
62+ :rtype: List[List[int]]
63+
64+ :Example:
65+ ::
66+
67+ from pythainlp.soundex.sound import audio_vector
68+
69+ audio_vector("น้ำ")
70+ # output : [[-1, 1, 1, -1, -1, -1, ...]]
5171 """
52- return _ft .word_to_vector_list (word , numeric = True )
72+ return _ft .word_to_vector_list (word2audio ( word ) , numeric = True )
5373
5474def word_approximation (word :str , list_word :List [str ]):
5575 """
@@ -59,6 +79,14 @@ def word_approximation(word:str, list_word:List[str]):
5979 :param str list_word: Thai word
6080 :return: List of approximation of word (The smaller the value, the closer)
6181 :rtype: List[str]
82+
83+ :Example:
84+ ::
85+
86+ from pythainlp.soundex.sound import word_approximation
87+
88+ word_approximation("รถ", ["รด", "รส", "รม", "น้ำ"])
89+ # output : [0.0, 0.0, 3.875, 8.375]
6290 """
6391 _word = word2audio (word )
6492 _list_word = [word2audio (w ) for w in list_word ]
0 commit comments