Skip to content

Commit b47d855

Browse files
committed
0.0.4 !
1 parent 1f89c26 commit b47d855

File tree

6 files changed

+70
-10
lines changed

6 files changed

+70
-10
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ Natural language processing หรือ การประมวลภาษา
99
รองรับเฉพาะ Python 3 เท่านั้น (Python 2 กำลังพัฒนา)
1010

1111
### Version
12-
0.0.3
12+
0.0.4
1313

1414
### มีอะไรใหม่
1515
แก้ไข bug import ใน python บางรุ่น
16+
ใช้ PyICU ตัดคำเป็นค่าเริ่มต้น
1617

1718
### ความสามารถ
1819
- ตัดคำภาษาไทย
20+
- Postaggers ภาษาไทย
1921
- อ่านตัวเลขเป็นข้อความภาษาไทย
2022
- เรียงจำนวนคำของประโยค
2123
- แก้ไขปัญหาการพิมพ์ลืมเปลี่ยนภาษา
@@ -40,11 +42,13 @@ from pythainlp.segment import segment
4042
a = 'ฉันรักภาษาไทยเพราะฉันเป็นคนไทย'
4143
b = segment(a)
4244
print(b) # ['ฉัน', 'รัก', 'ภาษาไทย', 'เพราะ', 'ฉัน', 'เป็น', 'คนไทย']
45+
# Postaggers ภาษาไทย
46+
from pythainlp.postaggers import tag
47+
print(tag('คุณกำลังประชุม')) #ค ุณ/PPRS กำลัง/XVBM ประชุม/VACT
4348
# หาคำที่มีจำนวนการใช้งานมากที่สุด
4449
from pythainlp.rank import rank
45-
aa = rank(a)
46-
print(aa) # Counter({'น': 4, 'ั': 3, 'า': 3, 'ร': 2, 'ท': 2, 'ย': 2, 'เ': 2, 'ฉ': 2, 'ไ': 2,
47-
#'ก': 1, 'พ': 1, 'ป': 1, '็': 1, 'ะ': 1, 'ษ': 1, 'ภ': 1, 'ค': 1})
50+
aa = rank(b)
51+
print(aa) # Counter({'ฉัน': 2, 'ไทย': 2, 'เป็น': 1, 'รัก': 1, 'ภาษา': 1, 'เพราะ': 1, 'คน': 1})
4852
# ทับศัพท์เสียงไทยในภาษาอังกฤษ (ยังไม่รองรับเสียงสระ)
4953
from pythainlp.romanization import romanization
5054
b=romanization("ต้นกก")

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Welcome to PyThai-NLP's documentation!
6+
Welcome to PyThaiNLP's documentation!
77
======================================
88

99
Contents:

docs/usage.rst

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,59 @@ Usage
55
To use PyThai-NLP in a project::
66

77
import pythainlp
8+
9+
# ตัดคำ
10+
11+
from pythainlp.segment import segment
12+
13+
a = 'ฉันรักภาษาไทยเพราะฉันเป็นคนไทย'
14+
15+
b = segment(a)
16+
17+
print(b) # ['ฉัน', 'รัก', 'ภาษาไทย', 'เพราะ', 'ฉัน', 'เป็น', 'คนไทย']
18+
19+
# Postaggers ภาษาไทย
20+
21+
from pythainlp.postaggers import tag
22+
23+
print(tag('คุณกำลังประชุม')) #ค ุณ/PPRS กำลัง/XVBM ประชุม/VACT
24+
25+
# หาคำที่มีจำนวนการใช้งานมากที่สุด
26+
27+
from pythainlp.rank import rank
28+
29+
aa = rank(b)
30+
31+
print(aa) # Counter({'ฉัน': 2, 'ไทย': 2, 'เป็น': 1, 'รัก': 1, 'ภาษา': 1, 'เพราะ': 1, 'คน': 1})
32+
33+
# ทับศัพท์เสียงไทยในภาษาอังกฤษ (ยังไม่รองรับเสียงสระ)
34+
35+
from pythainlp.romanization import romanization
36+
37+
b=romanization("ต้นกก")
38+
39+
print(b) # tonkok
40+
41+
# แก้ไขปัญหาการพิมพ์ลืมเปลี่ยนภาษา
42+
43+
from pythainlp.change import *
44+
45+
a="l;ylfu8iy["
46+
47+
a=texttothai(a)
48+
49+
b="นามรสนอำันี"
50+
51+
b=texttoeng(b)
52+
53+
print(a) # สวัสดีครับ
54+
55+
print(b) # ok,iloveyou
56+
57+
# เปลี่ยนตัวเลขเป็นตัวอักษรภาษาไทย (เงินบาท)
58+
59+
from pythainlp.number import numtowords
60+
61+
print("5611116.50")
62+
63+
print(numtowords(5611116.50)) # ห้าล้านหกแสนหนึ่งหมื่นหนึ่งพันหนึ่งร้อยสิบหกบาทห้าสิบสตางค์

pythainlp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import absolute_import
33
__author__ = 'Wannaphong Phatthiyaphaibun'
44
__email__ = '[email protected]'
5-
__version__ = '0.0.3'
5+
__version__ = '0.0.4'
66
from . import romanization
77
from . import segment
88
from . import rank

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
setup(
2323
name='pythainlp',
24-
version='0.0.3',
24+
version='0.0.4',
2525
description="Thai NLP in python package.",
2626
long_description=readme,# + '\n\n' + history,
2727
author="Wannaphong Phatthiyaphaibun",

test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
print(segment(a))
77
print(type(b))
88
from pythainlp.rank import rank
9-
aa = rank(a)
9+
aa = rank(b)
1010
print(aa)
1111
from pythainlp.romanization import romanization
1212
b=romanization("ต้นกก")
@@ -24,5 +24,5 @@
2424
print("5611116.50")
2525
print(numtowords(5611116.50))
2626

27-
from pythainlp.postaggers.text import pts
28-
print(pts('รัก'))
27+
from pythainlp.postaggers import tag
28+
print(tag('คุณกำลังประชุม'))

0 commit comments

Comments
 (0)