Skip to content

Commit 28246c0

Browse files
committed
Add example
1 parent c3156ad commit 28246c0

File tree

10 files changed

+28
-2
lines changed

10 files changed

+28
-2
lines changed

docs/pythainlp-1-5-eng.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ credit Korakot Chaovavanich (from https://gist.github.com/korakot/0b772e09340cac
260260
**Example**
261261

262262
```python
263-
>>> from pythainlp.soundex import LK82
263+
>>> from pythainlp.soundex import LK82,Udom83
264264
>>> print(LK82('รถ'))
265265
3000
266266
>>> print(LK82('รด'))

docs/pythainlp-1-5-thai.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ from pythainlp.change import *
359359
**การใช้งาน**
360360

361361
```python
362-
>>> from pythainlp.soundex import LK82
362+
>>> from pythainlp.soundex import LK82,Udom83
363363
>>> print(LK82('รถ'))
364364
3000
365365
>>> print(LK82('รด'))

example/collation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
from pythainlp.collation import collation
3+
print(collation(['ไก่','ไข่','ก','ฮา'])) # ['ก', 'ไก่', 'ไข่', 'ฮา']

example/etcc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
from pythainlp.tokenize import etcc
3+
print(etcc.etcc('คืนความสุข')) # /คืน/ความสุข

example/normalize.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
from pythainlp.util import normalize
3+
print(normalize("เเปลก")=="แปลก") # เ เ ป ล ก กับ แปลก

example/romanization.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
from pythainlp.romanization import romanization
3+
print(romanization("แมว"))

example/soundex.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# -*- coding: utf-8 -*-
2+
from pythainlp.soundex import LK82,Udom83
3+
print(LK82('รถ')==LK82('รด'))
4+
print(Udom83('วรร')==Udom83('วัน'))

example/spell.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# -*- coding: utf-8 -*-
2+
from pythainlp.spell import *
3+
a=spell("สี่เหลียม")
4+
print(a) # ['สี่เหลี่ยม']

example/tcc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
from pythainlp.tokenize import tcc
3+
print(tcc.tcc('ประเทศไทย')) # ป/ระ/เท/ศ/ไท/ย

example/whitespaceTokenizer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
from pythainlp.tokenize import WhitespaceTokenizer
3+
print(WhitespaceTokenizer("ทดสอบ ตัดคำช่องว่าง"))

0 commit comments

Comments
 (0)