File tree Expand file tree Collapse file tree 2 files changed +27
-20
lines changed Expand file tree Collapse file tree 2 files changed +27
-20
lines changed Original file line number Diff line number Diff line change @@ -48,20 +48,21 @@ def isthai(text: str, ignore_chars: str = ".") -> bool:
48
48
:rtype: bool
49
49
50
50
:Example:
51
+ ::
51
52
52
- from pythainlp.util import isthai
53
+ from pythainlp.util import isthai
53
54
54
- isthai("กาลเวลา")
55
- # output: True
55
+ isthai("กาลเวลา")
56
+ # output: True
56
57
57
- isthai("กาลเวลา.")
58
- # output: True
58
+ isthai("กาลเวลา.")
59
+ # output: True
59
60
60
- isthai("กาล-เวลา")
61
- # output: False
61
+ isthai("กาล-เวลา")
62
+ # output: False
62
63
63
- isthai("กาล-เวลา +66", ignore_chars="01234567890+-.,")
64
- # output: True
64
+ isthai("กาล-เวลา +66", ignore_chars="01234567890+-.,")
65
+ # output: True
65
66
66
67
"""
67
68
if not ignore_chars :
@@ -85,20 +86,21 @@ def countthai(text: str, ignore_chars: str = _DEFAULT_IGNORE_CHARS) -> float:
85
86
:rtype: float
86
87
87
88
:Example:
89
+ ::
88
90
89
- from pythainlp.util import countthai
91
+ from pythainlp.util import countthai
90
92
91
- countthai("ไทยเอ็นแอลพี 2.3")
92
- # output: 100.0
93
+ countthai("ไทยเอ็นแอลพี 2.3")
94
+ # output: 100.0
93
95
94
- countthai("PyThaiNLP 2.3")
95
- # output: 0.0
96
+ countthai("PyThaiNLP 2.3")
97
+ # output: 0.0
96
98
97
- countthai("ใช้งาน PyThaiNLP 2.3")
98
- # output: 40.0
99
+ countthai("ใช้งาน PyThaiNLP 2.3")
100
+ # output: 40.0
99
101
100
- countthai("ใช้งาน PyThaiNLP 2.3", ignore_chars="")
101
- # output: 30.0
102
+ countthai("ใช้งาน PyThaiNLP 2.3", ignore_chars="")
103
+ # output: 30.0
102
104
"""
103
105
if not text or not isinstance (text , str ):
104
106
return 0.0
@@ -133,9 +135,12 @@ def display_thai_char(ch: str) -> str:
133
135
:rtype: str
134
136
135
137
:Example:
138
+ ::
139
+
140
+ from pythainlp.util import display_thai_char
136
141
137
- display_thai_char("้")
138
- # output: "_้"
142
+ display_thai_char("้")
143
+ # output: "_้"
139
144
"""
140
145
141
146
if (
Original file line number Diff line number Diff line change @@ -172,6 +172,7 @@ def time_to_thaiword(
172
172
:rtype: str
173
173
174
174
:Example:
175
+ ::
175
176
176
177
time_to_thaiword("8:17")
177
178
# output:
@@ -255,6 +256,7 @@ def thaiword_to_time(text: str, padding: bool = True) -> str:
255
256
:rtype: str
256
257
257
258
:Example:
259
+ ::
258
260
259
261
thaiword_to_time"บ่ายโมงครึ่ง")
260
262
# output:
You can’t perform that action at this time.
0 commit comments