File tree Expand file tree Collapse file tree 5 files changed +611
-116
lines changed Expand file tree Collapse file tree 5 files changed +611
-116
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ Natural language processing หรือ การประมวลภาษา
29
29
30
30
- รองรับ Thai Character Clusters (TCC) และ ETCC
31
31
- Thai WordNet ตัวใหม่
32
+ - เพิ่มหลักเกณฑ์การถอดอักษรไทยเป็นอักษรโรมัน ฉบับราชบัณฑิตยสถาน
32
33
33
34
### ความสามารถ
34
35
- ตัดคำภาษาไทย
Original file line number Diff line number Diff line change @@ -83,8 +83,19 @@ engine คือ ชุดเครื่องมือในการ postagge
83
83
84
84
``` python
85
85
from pythainlp.romanization import romanization
86
- romanization(str )
86
+ romanization(str , engine = ' pyicu ' )
87
87
```
88
+ มี 2 engine ดังนี้
89
+
90
+ - pyicu ส่งค่า Latin
91
+ - royin ใช้หลักเกณฑ์การถอดอักษรไทยเป็นอักษรโรมัน ฉบับราชบัณฑิตยสถาน
92
+
93
+ data :
94
+
95
+ รับค่า ''str'' ข้อความ
96
+
97
+ คืนค่าเป็น ''str'' ข้อความ
98
+
88
99
** ตัวอย่าง**
89
100
90
101
``` python
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
from __future__ import absolute_import ,unicode_literals
3
- import icu
4
3
# ถอดเสียงภาษาไทยเป็น Latin
5
- def romanization (data ):
6
- """เป็นคำสั่ง ถอดเสียงภาษาไทยเป็น Latin รับค่า ''str'' ข้อความ คืนค่าเป็น ''str'' ข้อความ Latin"""
7
- thai2latin = icu .Transliterator .createInstance ('Thai-Latin' )
8
- return thai2latin .transliterate (data )
4
+ def romanization (data ,engine = 'pyicu' ):
5
+ """เป็นคำสั่ง ถอดเสียงภาษาไทยเป็นอังกฤษ
6
+ romanization(data,engine='pyicu')
7
+ มี 2 engine ดังนี้
8
+ - pyicu ส่งค่า Latin
9
+ - royin ใช้หลักเกณฑ์การถอดอักษรไทยเป็นอักษรโรมัน ฉบับราชบัณฑิตยสถาน
10
+ data :
11
+ รับค่า ''str'' ข้อความ
12
+ คืนค่าเป็น ''str'' ข้อความ"""
13
+ if engine == 'royin' :
14
+ from .royin import romanization
15
+ elif engine == 'pyicu' :
16
+ from .pyicu import romanization
17
+ return romanization (data )
You can’t perform that action at this time.
0 commit comments