Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
bab0b07
delete code not using
wannaphong Jan 4, 2017
4f8ab03
Merge remote-tracking branch 'refs/remotes/origin/master' into develop
wannaphong Jan 5, 2017
4c7fbc1
add osx
wannaphong Jan 5, 2017
b89edc7
delete osx
wannaphong Jan 5, 2017
f72cb88
add alphabet
wannaphong Jan 6, 2017
8d47872
edit travis
wannaphong Jan 6, 2017
fb02b2a
edit travis
wannaphong Jan 6, 2017
6a74bd0
edit travis
wannaphong Jan 6, 2017
98b3376
fix travis
wannaphong Jan 6, 2017
cf74036
fix python 2
wannaphong Jan 6, 2017
08147e9
fix setup.py
wannaphong Jan 6, 2017
cce6ab6
fix encoding file
wannaphong Jan 6, 2017
99e3913
fix setup.py
wannaphong Jan 6, 2017
e700851
fix python2
wannaphong Jan 6, 2017
547e140
fix setup.py python2
wannaphong Jan 6, 2017
eeb1764
fix python2
wannaphong Jan 6, 2017
59dba35
fix setup.py
wannaphong Jan 6, 2017
c1a198f
fix setup.py
wannaphong Jan 6, 2017
512b7dc
fix bug
wannaphong Jan 6, 2017
070a593
fix setup.py
wannaphong Jan 6, 2017
b32a385
fix python 2
wannaphong Jan 6, 2017
d8c487d
fix travis
wannaphong Jan 6, 2017
0750e99
fix test
wannaphong Jan 6, 2017
c4e0424
fix test2
wannaphong Jan 6, 2017
c719c21
fix setup.py
wannaphong Jan 6, 2017
7053bf9
fix test3
wannaphong Jan 6, 2017
7e114f1
goodbye python 2
wannaphong Jan 6, 2017
ff922a9
add tone
wannaphong Jan 7, 2017
ab50691
add time now
wannaphong Jan 7, 2017
71d537e
fix import
wannaphong Jan 7, 2017
8b6856b
fix import
wannaphong Jan 7, 2017
3d2e382
fix import
wannaphong Jan 7, 2017
5518979
fix test
wannaphong Jan 7, 2017
26d0672
add test pythainlp.segment.dict
wannaphong Jan 7, 2017
a7e39fb
remove test
wannaphong Jan 7, 2017
922f8ea
add country
wannaphong Jan 8, 2017
5474034
fix country
wannaphong Jan 8, 2017
c6dcda4
Merge remote-tracking branch 'refs/remotes/origin/master' into develop
wannaphong Jan 9, 2017
2c206ba
add mac os
wannaphong Jan 9, 2017
9a95f38
Revert "add mac os"
wannaphong Jan 9, 2017
225ff56
add mac os
wannaphong Jan 9, 2017
c0cba51
แยก pyicu ออกมา
wannaphong Jan 9, 2017
0c3fa15
ดึงไฟล์ royin.py กลับมาพัฒนาต่อ
wannaphong Jan 9, 2017
7b32c8b
update royin.py
wannaphong Jan 9, 2017
a33c496
ทดลอง 1
wannaphong Jan 9, 2017
3f02a64
add คำมูล
wannaphong Jan 23, 2017
d81875d
add data
wannaphong Jan 23, 2017
334b693
add word
wannaphong Jan 23, 2017
56f7e3a
add word
wannaphong Jan 23, 2017
27ee173
add english
wannaphong Jan 29, 2017
1284521
add homepage
wannaphong Feb 2, 2017
ffe764e
new api like nltk
wannaphong Feb 2, 2017
4909a83
add thai wordnet
wannaphong Feb 5, 2017
ce6e83d
add data
wannaphong Feb 5, 2017
4ee728d
chang code
wannaphong Feb 5, 2017
7f10b07
add wordnet test
wannaphong Feb 5, 2017
72aed4d
add data
wannaphong Feb 5, 2017
6abcdf1
add data
wannaphong Feb 5, 2017
5fd5340
add data
wannaphong Feb 5, 2017
452be04
fix bug
wannaphong Feb 5, 2017
bf6ea78
fix bug in github
wannaphong Feb 5, 2017
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
15 changes: 6 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
# This file will be regenerated if you run travis_pypi_setup.py

language: python
python: 3.5

env:
- TOXENV=py36
- TOXENV=py35
- TOXENV=py34
- TOXENV=py33
- TOXENV=py27
- TOXENV=pypy
python:
- "3.4"
- "3.5"
- "3.6"
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install: pip install -U tox

os:
- linux
# command to run tests, e.g. python setup.py test
script: python setup.py test

Expand Down
99 changes: 89 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,93 @@
[![pypi](https://img.shields.io/pypi/v/pythainlp.svg)](https://pypi.python.org/pypi/pythainlp)
[![Build Status](https://travis-ci.org/wannaphongcom/pythainlp.svg?branch=develop)](https://travis-ci.org/wannaphongcom/pythainlp)

Homepages :[https://sites.google.com/view/pythainlp/home](https://sites.google.com/view/pythainlp/home)

# English

Thai NLP in python package.

Thai Natural language processing in Python language.

Supports Python 3.4 +

- Document : [https://pythonhosted.org/pythainlp/](https://pythonhosted.org/pythainlp/)
- GitHub Home : [https://github.com/wannaphongcom/pythainlp](https://github.com/wannaphongcom/pythainlp)

### Project status

Developing

### Version
1.1

### Capabilities
- Thai Segment
- Thai to Latin
- Thai Postaggers
- Read a number to text in Thai language
- Sort the words of a sentence
- Fix the printer forgot to change the language
- Check the wrong words in Thai languag
- And more.

# Install

Supports Python 3.4 +

Stable version

```sh
$ pip install pythainlp
```


# Document

Sample usage

```python
# Thai Segment
from pythainlp.segment import segment
a = 'ฉันรักภาษาไทยเพราะฉันเป็นคนไทย'
b = segment(a)
print(b) # ['ฉัน', 'รัก', 'ภาษาไทย', 'เพราะ', 'ฉัน', 'เป็น', 'คนไทย']
# Thai Postaggers
from pythainlp.postaggers import tag
print(tag('คุณกำลังประชุม')) # [('คุณ', 'PPRS'), ('กำลัง', 'XVBM'), ('ประชุม', 'VACT')]
# Find the number word of the most
from pythainlp.rank import rank
aa = rank(b)
print(aa) # Counter({'ฉัน': 2, 'ไทย': 2, 'เป็น': 1, 'รัก': 1, 'ภาษา': 1, 'เพราะ': 1, 'คน': 1})
# Thai to Latin
from pythainlp.romanization import romanization
b=romanization("แมว")
print(b) # mæw
# Fix the printer forgot to change the language
from pythainlp.change import *
a="l;ylfu8iy["
a=texttothai(a)
b="นามรสนอำันี"
b=texttoeng(b)
print(a) # สวัสดีครับ
print(b) # ok,iloveyou
# Read a number to text in Thai language
from pythainlp.number import numtowords
print("5611116.50")
print(numtowords(5611116.50)) # ห้าล้านหกแสนหนึ่งหมื่นหนึ่งพันหนึ่งร้อยสิบหกบาทห้าสิบสตางค์
```

### License

Apache Software License 2.0

# Thai

Thai NLP in python package.

Natural language processing หรือ การประมวลภาษาธรรมชาติ โมดูล PyThaiNLP เป็นโมดูลที่ถูกพัฒนาขึ้นเพื่องานวิจัยและพัฒนาการประมวลภาษาธรรมชาติภาษาไทยในภาษา Python

รองรับทั้ง Python 2.7 และ Python 3
รองรับ Python 3.4 ขึ้นไป

- เอกสารการใช้งาน : [https://pythonhosted.org/pythainlp/](https://pythonhosted.org/pythainlp/)
- หน้าหลัก GitHub : [https://github.com/wannaphongcom/pythainlp](https://github.com/wannaphongcom/pythainlp)
Expand All @@ -17,7 +99,7 @@ Natural language processing หรือ การประมวลภาษา
กำลังพัฒนา

### Version
1.0.0
1.1

### ความสามารถ
- ตัดคำภาษาไทย
Expand All @@ -31,22 +113,18 @@ Natural language processing หรือ การประมวลภาษา

# ติดตั้ง

รองรับทั้ง Python 2.7 และ Python 3
รองรับ Python 3.4 ขึ้นไป

รุ่นเสถียร

```sh
$ pip install pythainlp
```
รุ่นกำลังพัฒนา
```sh
$ git clone https://github.com/wannaphongcom/pythainlp.git
$ cd pythainlp
$ python setup.py install
```

# เอกสารการใช้งานเบื้องต้น

ตัวอย่างการใช้งาน

```python
# ตัดคำ
from pythainlp.segment import segment
Expand Down Expand Up @@ -82,8 +160,9 @@ print(numtowords(5611116.50)) # ห้าล้านหกแสนหนึ่

Apache Software License 2.0


พัฒนาโดย นาย วรรณพงษ์ ภัททิยไพบูลย์

### สนับสนุน

คุณสามารถร่วมพัฒนาโครงการนี้ได้ โดยการ Fork และส่ง pull requests กลับมา
คุณสามารถร่วมพัฒนาโครงการนี้ได้ โดยการ Fork และส่ง pull requests กลับมา
83 changes: 5 additions & 78 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,103 +6,30 @@ PyThaiNLP

Thai NLP in python package.

Natural language processing หรือ การประมวลภาษาธรรมชาติ โมดูล PyThaiNLP
เป็นโมดูลที่ถูกพัฒนาขึ้นเพื่องานวิจัยและพัฒนาการประมวลภาษาธรรมชาติภาษาไทยในภาษา
Python
- Homepage : https://pythonhosted.org/pythainlp/
- GitHub : https://github.com/wannaphongcom/pythainlp

รองรับทั้ง Python 2.7 และ Python 3

- เอกสารการใช้งาน : https://pythonhosted.org/pythainlp/
- หน้าหลัก GitHub : https://github.com/wannaphongcom/pythainlp

สถานะโครงการ
~~~~~~~~~~~~

กำลังพัฒนา

Version
~~~~~~~

1.0.0

ความสามารถ
~~~~~~~~~~
1.1

- ตัดคำภาษาไทย
- ถอดเสียงภาษาไทยเป็น Latin
- Postaggers ภาษาไทย
- อ่านตัวเลขเป็นข้อความภาษาไทย
- เรียงจำนวนคำของประโยค
- แก้ไขปัญหาการพิมพ์ลืมเปลี่ยนภาษา
- เช็คคำผิดในภาษาไทย
- และอื่น ๆ

ติดตั้ง
Install
=======

รองรับทั้ง Python 2.7 และ Python 3

รุ่นเสถียร
Python 3.4 + only

.. code:: sh

$ pip3 install pythainlp

รุ่นกำลังพัฒนา

.. code:: sh

$ git clone https://github.com/wannaphongcom/pythainlp.git
$ cd pythainlp
$ python setup.py install

เอกสารการใช้งานเบื้องต้น
========================

ตัวอย่างการใช้งาน

.. code:: python

# ตัดคำ
from pythainlp.segment import segment
a = 'ฉันรักภาษาไทยเพราะฉันเป็นคนไทย'
b = segment(a)
print(b) # ['ฉัน', 'รัก', 'ภาษาไทย', 'เพราะ', 'ฉัน', 'เป็น', 'คนไทย']
# Postaggers ภาษาไทย
from pythainlp.postaggers import tag
print(tag('คุณกำลังประชุม')) # [('คุณ', 'PPRS'), ('กำลัง', 'XVBM'), ('ประชุม', 'VACT')]
# หาคำที่มีจำนวนการใช้งานมากที่สุด
from pythainlp.rank import rank
aa = rank(b)
print(aa) # Counter({'ฉัน': 2, 'ไทย': 2, 'เป็น': 1, 'รัก': 1, 'ภาษา': 1, 'เพราะ': 1, 'คน': 1})
# ถอดเสียงภาษาไทยเป็น Latin
from pythainlp.romanization import romanization
b=romanization("แมว")
print(b) # mæw
# แก้ไขปัญหาการพิมพ์ลืมเปลี่ยนภาษา
from pythainlp.change import *
a="l;ylfu8iy["
a=texttothai(a)
b="นามรสนอำันี"
b=texttoeng(b)
print(a) # สวัสดีครับ
print(b) # ok,iloveyou
# เปลี่ยนตัวเลขเป็นตัวอักษรภาษาไทย (เงินบาท)
from pythainlp.number import numtowords
print("5611116.50")
print(numtowords(5611116.50)) # ห้าล้านหกแสนหนึ่งหมื่นหนึ่งพันหนึ่งร้อยสิบหกบาทห้าสิบสตางค์

License
~~~~~~~

Apache Software License 2.0

พัฒนาโดย นาย วรรณพงษ์ ภัททิยไพบูลย์

สนับสนุน
~~~~~~~~

คุณสามารถร่วมพัฒนาโครงการนี้ได้ โดยการ Fork และส่ง pull requests กลับมา

.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/pythainlp.png
.. |pypi| image:: https://img.shields.io/pypi/v/pythainlp.svg
Expand Down
1 change: 0 additions & 1 deletion build-readme.bat

This file was deleted.

1 change: 0 additions & 1 deletion build_docs.bat

This file was deleted.

2 changes: 2 additions & 0 deletions build_pypi.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python setup.py sdist
python setup.py bdist_wheel
20 changes: 9 additions & 11 deletions pythainlp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from future import standard_library
standard_library.install_aliases()
# -*- coding: utf-8 -*-
from __future__ import absolute_import,unicode_literals
__author__ = 'Wannaphong Phatthiyaphaibun'
__email__ = '[email protected]'
__version__ = '1.0.0'
__version__ = '1.1'
from pythainlp.romanization import *
from pythainlp.segment import *
from pythainlp.segment import * # เตรียมลบออก 1
from pythainlp.tokenize import * # แทนที่ 1
from pythainlp.rank import *
from pythainlp.change import *
from pythainlp.number import *
from pythainlp.date import *
from pythainlp.postaggers import *
from pythainlp.postaggers import * # เตรียมลบออก 2
from pythainlp.tag import * # แทนที่ 2
from pythainlp.collation import *
from pythainlp.spell import *
from pythainlp.spell import *
from pythainlp.test import *
7 changes: 1 addition & 6 deletions pythainlp/change/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import,print_function
from __future__ import unicode_literals
from __future__ import division
from future import standard_library
standard_library.install_aliases()
from nine import str,iteritems
from __future__ import absolute_import
dictdata={'Z':'(','z':'ผ','X':')','x':'ป','C':'ฉ','c':'แ','V':'ฮ','v':'อ','B':'ฺ','b':'ิ','N':'์','n':'ื','M':'?','m':'ท','<':'ฒ',',':'ม','>':'ฬ','.':'ใ','?':'ฦ','/':'ฝ',
'A':'ฤ','a':'ฟ','S':'ฆ','s':'ห','D':'ฏ','d':'ก','F':'โ','f':'ด','G':'ฌ','g':'เ','H':'็','h':'้','J':'๋','j':'j','K':'ษ','k':'า','L':'ศ','l':'ส',':':'ซ','"':'.',"'":"ง",':':'ซ',';':'ว',
'Q':'๐','q':'ๆ','W':'"','w':'ไ','E':'ฎ','e':'ำ','R':'ฑ','r':'พ','T':'ธ','t':'ะ','Y':'ํ','y':'ั','U':'๊','u':'ี','I':'ณ','i':'ร','O':'ฯ','o':'น','P':'ญ','p':'ย','{':'ฐ','[':'บ','}':',',']':'ล','|':'ฅ',']':'ฃ',
Expand Down
3 changes: 3 additions & 0 deletions pythainlp/chunk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
# TODO
6 changes: 1 addition & 5 deletions pythainlp/collation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import,print_function
from __future__ import unicode_literals
from __future__ import division
from future import standard_library
standard_library.install_aliases()
from __future__ import absolute_import
import icu
collator1 = icu.Collator.createInstance(icu.Locale('th_TH'))
# เรียงลำดับข้อมูล list ภาษาไทย
Expand Down
35 changes: 35 additions & 0 deletions pythainlp/corpus/LICENSE_THA_WN
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Copyright: 2011 NICT

Thai WordNet

This software and database is being provided to you, the LICENSEE, by
the National Institute of Information and Communications Technology
under the following license. By obtaining, using and/or copying this
software and database, you agree that you have read, understood, and
will comply with these terms and conditions:

Permission to use, copy, modify and distribute this software and
database and its documentation for any purpose and without fee or
royalty is hereby granted, provided that you agree to comply with
the following copyright notice and statements, including the
disclaimer, and that the same appear on ALL copies of the software,
database and documentation, including modifications that you make
for internal use or for distribution.

Thai WordNet Copyright 2011 by the National Institute of
Information and Communications Technology (NICT). All rights
reserved.

THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND NICT MAKES NO
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE,
BUT NOT LIMITATION, NICT MAKES NO REPRESENTATIONS OR WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE
OF THE LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE
ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

The name of the National Institute of Information and Communications
Technology may not be used in advertising or publicity pertaining to
distribution of the software and/or database. Title to copyright in
this software, database and any associated documentation shall at all
times remain with National Institute of Information and Communications
Technology and LICENSEE agrees to preserve same.
13 changes: 6 additions & 7 deletions pythainlp/corpus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import,print_function
from __future__ import unicode_literals
from __future__ import division
from future import standard_library
standard_library.install_aliases()
__all__ = ["thaipos", "thaiword"]
from __future__ import absolute_import
__all__ = ["thaipos", "thaiword","alphabet","tone","country","wordnet"]
from .thaipos import get_data
from .thaiword import get_data
from .thaiword import get_data
from .alphabet import get_data
from .tone import get_data
from .country import get_data
Loading