Skip to content

Commit

Permalink
Merge pull request #12 from wannaphongcom/develop
Browse files Browse the repository at this point in the history
Update to PyThaiNLP 1.1
  • Loading branch information
wannaphong authored Feb 5, 2017
2 parents f50d526 + bf6ea78 commit 5578907
Show file tree
Hide file tree
Showing 42 changed files with 398 additions and 252 deletions.
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,18 +113,13 @@ 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
```

## ติดตั้งบน Mac

Expand All @@ -59,6 +136,7 @@ $ CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip i
# เอกสารการใช้งานเบื้องต้น

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

```python
# ตัดคำ
from pythainlp.segment import segment
Expand Down Expand Up @@ -94,8 +172,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.
Loading

0 comments on commit 5578907

Please sign in to comment.