Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .editorconfig

This file was deleted.

This file was deleted.

4 changes: 3 additions & 1 deletion examples/collation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

from pythainlp.collation import collation
print(collation(['ไก่','ไข่','ก','ฮา'])) # ['ก', 'ไก่', 'ไข่', 'ฮา']

print(collation(["ไก่", "ไข่", "ก", "ฮา"])) # ['ก', 'ไก่', 'ไข่', 'ฮา']
4 changes: 3 additions & 1 deletion examples/etcc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

from pythainlp.tokenize import etcc
print(etcc.etcc('คืนความสุข')) # /คืน/ความสุข

print(etcc.etcc("คืนความสุข")) # /คืน/ความสุข
4 changes: 3 additions & 1 deletion examples/normalize.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

from pythainlp.util import normalize
print(normalize("เเปลก")=="แปลก") # เ เ ป ล ก กับ แปลก

print(normalize("เเปลก") == "แปลก") # เ เ ป ล ก กับ แปลก
4 changes: 3 additions & 1 deletion examples/romanization.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

from pythainlp.romanization import romanization
print(romanization("แมว"))

print(romanization("แมว"))
5 changes: 0 additions & 5 deletions examples/segment.py

This file was deleted.

9 changes: 6 additions & 3 deletions examples/soundex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
from pythainlp.soundex import LK82,Udom83
print(LK82('รถ')==LK82('รด'))
print(Udom83('วรร')==Udom83('วัน'))

from pythainlp.soundex import LK82, Udom83

print(LK82("รถ") == LK82("รด"))

print(Udom83("วรร") == Udom83("วัน"))
10 changes: 7 additions & 3 deletions examples/spell.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
from pythainlp.spell import *
a=spell("สี่เหลียม")
print(a) # ['สี่เหลี่ยม']

from pythainlp.spell import spell

a = spell("สี่เหลียม")
print(a) # ['สี่เหลี่ยม']

# a = spell("สี่เหลียม", engine="hunspell") # available in some Linux systems
9 changes: 8 additions & 1 deletion examples/tcc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# -*- coding: utf-8 -*-

from pythainlp.tokenize import tcc
print(tcc.tcc('ประเทศไทย')) # ป/ระ/เท/ศ/ไท/ย

print(tcc.tcc("ประเทศไทย")) # ป/ระ/เท/ศ/ไท/ย

print(tcc.tcc_pos("ประเทศไทย")) # {1, 3, 5, 6, 8, 9}

for ch in tcc.tcc_gen("ประเทศไทย"): # ป-ระ-เท-ศ-ไท-ย-
print(ch, end='-')
24 changes: 24 additions & 0 deletions examples/tokenize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-

from pythainlp.tokenize import sent_tokenize, word_tokenize

text = "ฉันรักภาษาไทย เพราะฉันใช้ภาษาไทย "
print(text)

print(sent_tokenize(text))
# ['ฉันรักภาษาไทย', 'เพราะฉันใช้ภาษาไทย', '']

print(word_tokenize(text))
# ['ฉัน', 'รัก', 'ภาษาไทย', ' ', 'เพราะ', 'ฉัน', 'ใช้', 'ภาษาไทย', ' ']

print(word_tokenize(text, whitespaces=False))
# ['ฉัน', 'รัก', 'ภาษาไทย', 'เพราะ', 'ฉัน', 'ใช้', 'ภาษาไทย']

text2 = "กฎหมายแรงงาน"
print(text2)

print(word_tokenize(text2))
# ['กฎหมายแรงงาน']

print(word_tokenize(text2, engine="longest-matching"))
# ['กฎหมาย', 'แรงงาน']
3 changes: 0 additions & 3 deletions examples/whitespaceTokenizer.py

This file was deleted.

78 changes: 0 additions & 78 deletions pythainlp/corpus/.ipynb_checkpoints/__init__-checkpoint.py

This file was deleted.

40 changes: 0 additions & 40 deletions pythainlp/sentiment/.ipynb_checkpoints/__init__-checkpoint.py

This file was deleted.

This file was deleted.

89 changes: 0 additions & 89 deletions pythainlp/sentiment/.ipynb_checkpoints/ulmfit_sent-checkpoint.py

This file was deleted.

Loading