Skip to content

Commit 4a979d9

Browse files
committed
update docs & fix #64
1 parent 1105bd5 commit 4a979d9

File tree

5 files changed

+35
-13
lines changed

5 files changed

+35
-13
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
================
2-
PyThaiNLP 1.5.1
2+
PyThaiNLP 1.6.0
33
================
44

55
Thai natural language processing in Python.
@@ -30,4 +30,4 @@ Development Lead
3030

3131
**License**
3232

33-
Apache Software License 2.0
33+
Apache Software License 2.0

docs/pythainlp-1-6-thai.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,23 @@ engine คือ ระบบตัดคำไทย ปัจจุบัน
6060
2. icu - engine ตัวดั้งเดิมของ PyThaiNLP (ความแม่นยำต่ำ)
6161
3. dict - เป็นการตัดคำโดยใช้พจานุกรมจาก thaiword.txt ใน corpus (ความแม่นยำปานกลาง) **จะคืนค่า False หากข้อความนั้นไม่สามารถตัดคำได้**
6262
4. longest-matching ใช้ Longest matching ในการตัดคำ
63-
5. mm - ใช้ Maximum Matching algorithm ในการตัดคำภาษาไทย - API ชุดเก่า
64-
6. pylexto ใช้ LexTo ในการตัดคำ โดยเป็น Longest matching
63+
5. mm - ใช้ Maximum Matching algorithm ในการตัดคำภาษาไทย - API ชุดเก่า **อยู่ในหมวดบำรุงรักษาเท่านั้น**
64+
6. ****pylexto ใช้ LexTo ในการตัดคำ โดยเป็น Longest matching
6565
7. deepcut ใช้ deepcut จาก https://github.com/rkcosmos/deepcut ในการตัดคำภาษาไทย
6666
8. wordcutpy ใช้ wordcutpy (https://github.com/veer66/wordcutpy) ในการตัดคำ
6767

6868
คืนค่าเป็น ''list'' เช่น ['แมว','กิน']
6969

7070
**ตัวอย่าง**
7171

72+
```
73+
สำหรับผู้ใช้งาน Python 2.7 ให้ทำการ encode ให้เป็น UTF-8 ก่อนใช้งานโมดูล PyThaiNLP
74+
75+
เช่น text=u'ผมรักคุณนะครับโอเคบ่พวกเราเป็นคนไทยรักภาษาไทยภาษาบ้านเกิด'
76+
```
77+
78+
การใช้งาน
79+
7280
```python
7381
from pythainlp.tokenize import word_tokenize
7482
text='ผมรักคุณนะครับโอเคบ่พวกเราเป็นคนไทยรักภาษาไทยภาษาบ้านเกิด'
@@ -102,6 +110,12 @@ engine คือ เครื่องมือตัดคำ
102110

103111
ตัวอย่างการใช้งาน https://gist.github.com/wannaphongcom/1e862583051bf0464b6ef4ed592f739c
104112

113+
```
114+
สำหรับผู้ใช้งาน Python 2.7 ให้ทำการ encode ให้เป็น UTF-8 ก่อนใช้งานโมดูล PyThaiNLP
115+
116+
เช่น text=u'ผมรักคุณนะครับโอเคบ่พวกเราเป็นคนไทยรักภาษาไทยภาษาบ้านเกิด'
117+
```
118+
105119
#### sent_tokenize
106120

107121
ใช้ตัดประโยคภาษาไทย
@@ -129,6 +143,14 @@ engine คือ เครื่องมือสำหรับใช้ตั
129143
['ทดสอบ', 'ตัดคำช่องว่าง']
130144
```
131145

146+
```
147+
สำหรับผู้ใช้งาน Python 2.7 ให้ทำการ encode ให้เป็น UTF-8 ก่อนใช้งานโมดูล PyThaiNLP
148+
149+
เช่น WhitespaceTokenizer(u"ทดสอบ ตัดคำช่องว่าง")
150+
```
151+
152+
153+
132154
#### isthai
133155

134156
ใช้เช็คข้อความว่าเป็นภาษาไทยทั้งหมดกี่ %
@@ -217,12 +239,12 @@ engine คือ ชุดเครื่องมือในการ postagge
217239

218240
```python
219241
from pythainlp.romanization import romanization
220-
romanization(str,engine='pyicu')
242+
romanization(str,engine='royin')
221243
```
222244
มี 2 engine ดังนี้
223245

224246
- pyicu ส่งค่า Latin
225-
- royin ใช้หลักเกณฑ์การถอดอักษรไทยเป็นอักษรโรมัน ฉบับราชบัณฑิตยสถาน (**หากมีข้อผิดพลาด ให้ใช้คำอ่าน เนื่องจากตัว royin ไม่มีตัวแปลงคำเป็นคำอ่าน**)
247+
- royin ใช้หลักเกณฑ์การถอดอักษรไทยเป็นอักษรโรมัน ฉบับราชบัณฑิตยสถาน (**หากมีข้อผิดพลาด ให้ใช้คำอ่าน เนื่องจากตัว royin ไม่มีตัวแปลงคำเป็นคำอ่าน**)
226248

227249
data :
228250

@@ -234,7 +256,7 @@ data :
234256

235257
```python
236258
from pythainlp.romanization import romanization
237-
romanization("แมว") # 'mæw'
259+
romanization("แมว") # 'maew'
238260
```
239261

240262
### spell
@@ -568,7 +590,7 @@ text_list คือ ข้อความภาษาไทยที่อยู
568590

569591
#### ConceptNet
570592

571-
เครื่องมือสำหรับ ConceptNet.
593+
เครื่องมือสำหรับ ConceptNet
572594

573595
**ค้นหา edges**
574596

example/segment.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
# -*- coding: utf-8 -*-
12
from pythainlp.tokenize import word_tokenize
2-
a = 'ฉันรักภาษาไทยเพราะฉันเป็นคนไทยและฉันใช้ภาษาไทย'
3+
a =u'ฉันรักภาษาไทยเพราะฉันเป็นคนไทยและฉันใช้ภาษาไทย'
34
b = word_tokenize(a)
4-
print(b)
5+
print(b)

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ nltk>=3.2.2
22
future>=0.16.0
33
six
44
marisa_trie
5-
langdetect
65
dill
7-
pytz
6+
pytz

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py34, py35, flake8
2+
envlist = py27, py34, py35, flake8
33

44
[testenv:flake8]
55
basepython=python

0 commit comments

Comments
 (0)