Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
46a569b
Merge pull request #26 from PyThaiNLP/dev
bact Apr 8, 2019
bac4516
Merge pull request #27 from PyThaiNLP/dev
bact Apr 12, 2019
0eac189
- etcc and tcc small refactor + use common segment() function name (s…
bact Apr 12, 2019
af3e59f
TTC will now use local copy of tcc_freq.txt
bact Apr 12, 2019
03fbe53
Merge pull request #193 from bact/dev
bact Apr 12, 2019
34ee765
update README
bact Apr 14, 2019
efc515f
Merge pull request #195 from bact/dev
bact Apr 14, 2019
bb4b334
update README-pypi.md
bact Apr 15, 2019
dd88325
Merge pull request #197 from bact/dev
bact Apr 15, 2019
797caef
deepcut & dict_word_tokenize
wannaphong Apr 15, 2019
6e38de0
update dict trie from Trie to (Trie,List)
wannaphong Apr 15, 2019
1a3338b
fix bug test
wannaphong Apr 15, 2019
0b1817f
Trie to list for deepcut
wannaphong Apr 15, 2019
1b5109e
update docs
wannaphong Apr 15, 2019
3ab9dc4
del ๒,๕๔๐ รายการ from words_th.txt
wannaphong Apr 15, 2019
529f4c0
Merge pull request #198 from PyThaiNLP/deepcut
wannaphong Apr 15, 2019
b6f529c
Merge pull request #28 from PyThaiNLP/dev
bact Apr 15, 2019
2b2ef0b
Makes custom dictionary arguments more consistent across different en…
bact Apr 15, 2019
e848221
More test cases for dict_word_tokenize and deepcut
bact Apr 15, 2019
a5525c3
if input is empty, subword_tokenize() should return empty list.
bact Apr 15, 2019
968537b
Merge pull request #199 from bact/dev
bact Apr 17, 2019
a9ebcc4
- royin.romanize can romanize untokenized text now
bact Apr 17, 2019
37a8e94
Info about RTGS romanization system
bact Apr 17, 2019
00ec9a7
fix bug transliterate : ain (ไหน) -> nai (ไหน)
wannaphong Apr 17, 2019
d85e17f
add info about IPA and ICU library in comments
bact Apr 19, 2019
2ca00e3
Merge pull request #201 from PyThaiNLP/transliterate
bact Apr 19, 2019
2516c0f
Merge branch 'dev' into dev
bact Apr 19, 2019
47cd40a
Add more test for royin (RTGS) romanize() (lots of them failed now)
bact Apr 19, 2019
1954736
Merge pull request #200 from bact/dev
bact Apr 19, 2019
5f0eb4f
Update README.md
bact Apr 19, 2019
94dd259
Update README.md
bact Apr 19, 2019
61f787f
merge and refactor word_tokenize and dict_word_tokenize
bact Apr 20, 2019
e6d3fb0
update test for dict_word_tokenize
bact Apr 20, 2019
e811b59
Merge pull request #29 from PyThaiNLP/dev
bact Apr 20, 2019
efcbdae
`word_tokenize()' argument `whitespaces` is now `keep_whitespace`
bact Apr 20, 2019
02909db
Merge branch 'dev' of https://github.com/bact/pythainlp into dev
bact Apr 20, 2019
18d0b80
fix word_tokenize() call in FrequencySummarizer
bact Apr 20, 2019
3161c38
more test cases for word_tokenize with custom_dict
bact Apr 20, 2019
90d1ac6
- more test cases for "longest" tokenizer
bact Apr 20, 2019
56ed575
- fix test case of "mm" tokenize engine
bact Apr 20, 2019
eaedee2
Put version number in sphinx doc
bact Apr 20, 2019
7671f0e
Update version number to 2.0.4
bact Apr 20, 2019
7e9b82e
Merge pull request #203 from bact/dev
bact Apr 20, 2019
92da9e0
update readme
bact Apr 20, 2019
5fb581f
Merge pull request #204 from bact/dev
bact Apr 20, 2019
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
40 changes: 16 additions & 24 deletions README-pypi.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
![PyThaiNLP Logo](https://avatars0.githubusercontent.com/u/32934255?s=200&v=4)

# PyThaiNLP 2.0.2

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/cb946260c87a4cc5905ca608704406f7)](https://www.codacy.com/app/pythainlp/pythainlp_2?utm_source=github.com&utm_medium=referral&utm_content=PyThaiNLP/pythainlp&utm_campaign=Badge_Grade)[![pypi](https://img.shields.io/pypi/v/pythainlp.svg)](https://pypi.python.org/pypi/pythainlp)
[![Build Status](https://travis-ci.org/PyThaiNLP/pythainlp.svg?branch=develop)](https://travis-ci.org/PyThaiNLP/pythainlp)
[![Build status](https://ci.appveyor.com/api/projects/status/9g3mfcwchi8em40x?svg=true)](https://ci.appveyor.com/project/wannaphongcom/pythainlp-9y1ch)
[![Coverage Status](https://coveralls.io/repos/github/PyThaiNLP/pythainlp/badge.svg?branch=dev)](https://coveralls.io/github/PyThaiNLP/pythainlp?branch=dev)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
# PyThaiNLP

PyThaiNLP is a Python library for natural language processing (NLP) of Thai language.

PyThaiNLP includes Thai word tokenizers, transliterators, soundex converters, part-of-speech taggers, and spell checkers.

📖 [Upgrading from PyThaiNLP 1.7 to 2.0](https://thainlp.org/pythainlp/docs/2.0/notes/pythainlp-1_7-2_0.html)

📖 [Upgrade ThaiNER from PyThaiNLP 1.7 to 2.0](https://github.com/PyThaiNLP/pythainlp/wiki/Upgrade-ThaiNER-from-PyThaiNLP-1.7-to-PyThaiNLP-2.0)

📫 follow us on Facebook [Pythainlp](https://www.facebook.com/pythainlp/)
📫 follow us on Facebook [PyThaiNLP](https://www.facebook.com/pythainlp/)

## What's new in version 2.0 ?
## What's new in 2.0 ?

- New NorvigSpellChecker spell checker class, which can be initialized with custom dictionary.
- Terminate Python 2 support. Remove all Python 2 compatibility code.
- Remove old, obsolated, deprecated, and experimental code.
- Thai2fit (Upgrade ULMFiT-related codes to fastai 1.0)
- ThaiNER 1.0
- Remove sentiment analysis
- Improved word_tokenize (newmm, mm) and dict_word_tokenize
- Improved POS-tagging
- More and improved examples
- see [PyThaiNLP 2.0 change log](https://github.com/PyThaiNLP/pythainlp/issues/118)
- Improved `word_tokenize` ("newmm" and "mm" engine), a `custom_dict` dictionary can be provided
- Improved `pos_tag` Part-Of-Speech tagging
- New `NorvigSpellChecker` spell checker class, which can be initialized with custom dictionary.
- New `thai2fit` (replacing `thai2vec`, upgrade ULMFiT-related code to fastai 1.0)
- Updated ThaiNER to 1.0
- You may need to [update your existing ThaiNER models from PyThaiNLP 1.7](https://github.com/PyThaiNLP/pythainlp/wiki/Upgrade-ThaiNER-from-PyThaiNLP-1.7-to-PyThaiNLP-2.0)
- Remove old, obsolated, deprecated, duplicated, and experimental code.
- Sentiment analysis is no longer part of the library, but rather [a text classification example](https://github.com/PyThaiNLP/pythainlp/blob/dev/notebooks/sentiment_analysis.ipynb).
- See more examples in [Get Started notebook](https://github.com/PyThaiNLP/pythainlp/blob/dev/notebooks/pythainlp-get-started.ipynb)
- [Full change log](https://github.com/PyThaiNLP/pythainlp/issues/118)
- [Upgrading from 1.7](https://thainlp.org/pythainlp/docs/2.0/notes/pythainlp-1_7-2_0.html)

## Install

Expand Down Expand Up @@ -62,8 +54,8 @@ Install it with pip, for example: `pip install marisa_trie‑0.7.5‑cp36‑cp36

## Links

- User guide : [English](https://colab.research.google.com/drive/1MQ10D1mJC5r1vQAHcj4ShoRS14vz8ZF-) , [ภาษาไทย](https://colab.research.google.com/drive/1rEkB2Dcr1UAKPqz4bCghZV7pXx2qxf89)
- User guide: [English](https://github.com/PyThaiNLP/pythainlp/blob/dev/notebooks/pythainlp-get-started.ipynb), [ภาษาไทย](https://colab.research.google.com/drive/1rEkB2Dcr1UAKPqz4bCghZV7pXx2qxf89)
- Docs: https://thainlp.org/pythainlp/docs/2.0/
- GitHub: https://github.com/PyThaiNLP/pythainlp
- Issues: https://github.com/PyThaiNLP/pythainlp/issues
- Facebook : [Pythainlp](https://www.facebook.com/pythainlp/)
- Facebook: [PyThaiNLP](https://www.facebook.com/pythainlp/)
102 changes: 52 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,27 @@ Thai Natural Language Processing in Python.

PyThaiNLP is a Python package for text processing and linguistic analysis, similar to `nltk` but with focus on Thai language.

- [Current PyThaiNLP stable release is 2.0](https://github.com/PyThaiNLP/pythainlp/tree/master)
- PyThaiNLP 2.0 supports Python 3.6+. Some functions may work with older version of Python 3, but it is not well-tested and will not be supported. See [PyThaiNLP 2.0 change log](https://github.com/PyThaiNLP/pythainlp/issues/118).
- Python 2.7+ users can use PyThaiNLP 1.6.
**This is a document for development branch (post 2.0). Things will break.**

**This is a document for development branch (post 2.0). Things will break. For a stable branch document, see [master](https://github.com/PyThaiNLP/pythainlp/tree/master).**
- The latest stable release is [2.0.4](https://github.com/PyThaiNLP/pythainlp/tree/master)
- PyThaiNLP 2 supports Python 3.6+. Some functions may work with older version of Python 3, but it is not well-tested and will not be supported. See [change log](https://github.com/PyThaiNLP/pythainlp/issues/118).
- [Upgrading from 1.7](https://thainlp.org/pythainlp/docs/2.0/notes/pythainlp-1_7-2_0.html)
- [Upgrade ThaiNER from 1.7](https://github.com/PyThaiNLP/pythainlp/wiki/Upgrade-ThaiNER-from-PyThaiNLP-1.7-to-PyThaiNLP-2.0)
- Python 2.7+ users can use PyThaiNLP 1.6.

📫 follow us on Facebook [PyThaiNLP](https://www.facebook.com/pythainlp/)

## Capabilities

- Convenient character and word classes, like Thai consonants (```pythainlp.thai_consonants```), vowels (```pythainlp.thai_vowels```), digits (```pythainlp.thai_digits```), and stop words (```pythainlp.corpus.thai_stopwords```) -- comparable to constants like ```string.letters```, ```string.digits```, and ```string.punctuation```
- Thai word segmentation (```word_tokenize```), including subword segmentation based on Thai Character Cluster (```tcc```) and ETCC (```etcc```)
- Thai romanization and transliteration (```romanize```, ```transliterate```)
- Thai part-of-speech taggers (```pos_tag```)
- Read out number to Thai words (```bahttext```, ```num_to_thaiword```)
- Thai collation (sort by dictionoary order) (```collate```)
- Thai-English keyboard misswitched fix (```eng_to_thai```, ```thai_to_eng```)
- Thai misspellings detection and spelling correction (```spell```)
- Thai soundex (```lk82```, ```udom83```, ```metasound```)
- Convenient character and word classes, like Thai consonants (`pythainlp.thai_consonants`), vowels (`pythainlp.thai_vowels`), digits (`pythainlp.thai_digits`), and stop words (`pythainlp.corpus.thai_stopwords`) -- comparable to constants like `string.letters`, `string.digits`, and `string.punctuation`
- Thai word segmentation (`word_tokenize`), including subword segmentation based on Thai Character Cluster (`subword_tokenize`)
- Thai transliteration (`transliterate`)
- Thai part-of-speech taggers (`pos_tag`)
- Read out number to Thai words (`bahttext`, `num_to_thaiword`)
- Thai collation (sort by dictionoary order) (`collate`)
- Thai-English keyboard misswitched fix (`eng_to_thai`, `thai_to_eng`)
- Thai spelling suggestion and correction (`spell` and `correct`)
- Thai soundex (`soundex`) with three engines (`lk82`, `udom83`, `metasound`)
- Thai WordNet wrapper
- and much more - see examples in [PyThaiNLP Get Started notebook](https://github.com/PyThaiNLP/pythainlp/blob/dev/notebooks/pythainlp-get-started.ipynb).

Expand Down Expand Up @@ -60,20 +62,20 @@ For some advanced functionalities, like word vector, extra packages may be neede
$ pip install pythainlp[extra1,extra2,...]
```

where ```extras``` can be
- ```artagger``` (to support artagger part-of-speech tagger)*
- ```deepcut``` (to support deepcut machine-learnt tokenizer)
- ```icu``` (for ICU support in transliteration and tokenization)
- ```ipa``` (for International Phonetic Alphabet support in transliteration)
- ```ml``` (to support fastai 1.0.22 ULMFiT models)
- ```ner``` (for named-entity recognizer)
- ```thai2fit``` (for Thai word vector)
- ```thai2rom``` (for machine-learnt romanization)
- ```full``` (install everything)
where `extras` can be
- `artagger` (to support artagger part-of-speech tagger)*
- `deepcut` (to support deepcut machine-learnt tokenizer)
- `icu` (for ICU, International Components for Unicode, support in transliteration and tokenization)
- `ipa` (for IPA, International Phonetic Alphabet, support in transliteration)
- `ml` (to support fastai 1.0.22 ULMFiT models)
- `ner` (for named-entity recognizer)
- `thai2fit` (for Thai word vector)
- `thai2rom` (for machine-learnt romanization)
- `full` (install everything)

* Note: standard ```artagger``` package from PyPI will not work on Windows, please ```pip install https://github.com/wannaphongcom/artagger/tarball/master#egg=artagger``` instead.
* Note: standard `artagger` package from PyPI will not work on Windows, please ```pip install https://github.com/wannaphongcom/artagger/tarball/master#egg=artagger``` instead.

** see ```extras``` and ```extras_require``` in [```setup.py```](https://github.com/PyThaiNLP/pythainlp/blob/dev/setup.py) for package details.
** see `extras` and `extras_require` in [`setup.py`](https://github.com/PyThaiNLP/pythainlp/blob/dev/setup.py) for package details.

## Documentation

Expand Down Expand Up @@ -102,25 +104,25 @@ PyThaiNLP เป็นไลบารีภาษาไพทอนเพื่

> เพราะโลกขับเคลื่อนต่อไปด้วยการแบ่งปัน

- PyThaiNLP 2.0 รองรับ Python 3.6 ขึ้นไป
- ผู้ใช้ Python 2.7+ ยังสามารถใช้ PyThaiNLP 1.6 ได้
**เอกสารนี้สำหรับรุ่นพัฒนา อาจมีการเปลี่ยนแปลงได้ตลอด**

**เอกสารนี้สำหรับรุ่นพัฒนา (หลัง 2.0) อาจมีการเปลี่ยนแปลงได้ตลอด สำหรับเอกสารรุ่นเสถียร ดูที่ [master](https://github.com/PyThaiNLP/pythainlp/tree/master).**
- รุ่นเสถียรล่าสุดคือรุ่น [2.0.4](https://github.com/PyThaiNLP/pythainlp/tree/master)
- PyThaiNLP 2 รองรับ Python 3.6 ขึ้นไป
- ผู้ใช้ Python 2.7+ ยังสามารถใช้ PyThaiNLP 1.6 ได้

📫 ติดตามข่าวสารได้ที่ Facebook [Pythainlp](https://www.facebook.com/pythainlp/)

## ความสามารถ

- ชุดค่าคงที่ตัวอักษระและคำไทยที่เรียกใช้ได้สะดวก เช่น พยัญชนะ (```pythainlp.thai_consonants```), สระ (```pythainlp.thai_vowels```), ตัวเลขไทย (```pythainlp.thai_digits```), และ stop word (```pythainlp.corpus.thai_stopwords```) -- เหมือนกับค่าคงที่อย่าง ```string.letters```, ```string.digits```, และ ```string.punctuation```
- Thai word segmentation (```word_tokenize```), including subword segmentation based on Thai Character Cluster (```tcc```) and ETCC (```etcc```)
- ตัดคำภาษาไทย (```word_tokenize```) และรองรับ Thai Character Clusters (```tcc```) และ ETCC (```etcc```)
- ถอดเสียงภาษาไทยเป็นอักษรละตินและสัทอักษร (```romanize```, ```transliterate```)
- ระบุชนิดคำ (part-of-speech) ภาษาไทย (```pos_tag```)
- อ่านตัวเลขเป็นข้อความภาษาไทย (```bahttext```, ```num_to_thaiword```)
- เรียงลำดับคำตามพจนานุกรมไทย (```collate```)
- แก้ไขปัญหาการพิมพ์ลืมเปลี่ยนภาษา (```eng_to_thai```, ```thai_to_eng```)
- ตรวจคำสะกดผิดในภาษาไทย (```spell```)
- soundex ภาษาไทย (```lk82```, ```udom83```, ```metasound```)
- ชุดค่าคงที่ตัวอักษระและคำไทยที่เรียกใช้ได้สะดวก เช่น พยัญชนะ (`pythainlp.thai_consonants`), สระ (`pythainlp.thai_vowels`), ตัวเลขไทย (`pythainlp.thai_digits`), และ stop word (`pythainlp.corpus.thai_stopwords`) -- เหมือนกับค่าคงที่อย่าง `string.letters`, `string.digits`, และ `string.punctuation`
- ตัดคำภาษาไทย (`word_tokenize`) และรองรับการตัดระดับต่ำกว่าคำโดยใช้ Thai Character Clusters (`subword_tokenize`)
- ถอดเสียงภาษาไทยเป็นอักษรละตินและสัทอักษร (`transliterate`)
- ระบุชนิดคำ (part-of-speech) ภาษาไทย (`pos_tag`)
- อ่านตัวเลขเป็นข้อความภาษาไทย (`bahttext`, `num_to_thaiword`)
- เรียงลำดับคำตามพจนานุกรมไทย (`collate`)
- แก้ไขปัญหาการพิมพ์ลืมเปลี่ยนภาษา (`eng_to_thai`, `thai_to_eng`)
- ตรวจคำสะกดผิดในภาษาไทย (`spell`, `correct`)
- soundex ภาษาไทย (`soundex`) 3 วิธีการ (`lk82`, `udom83`, `metasound`)
- Thai WordNet wrapper
- และอื่น ๆ ดูตัวอย่างได้ใน [PyThaiNLP Get Started notebook](https://github.com/PyThaiNLP/pythainlp/blob/dev/notebooks/pythainlp-get-started.ipynb)

Expand All @@ -144,20 +146,20 @@ $ pip install https://github.com/PyThaiNLP/pythainlp/archive/dev.zip
$ pip install pythainlp[extra1,extra2,...]
```

โดยที่ ```extras``` คือ
- ```artagger``` (สำหรับตัวติดป้ายกำกับชนิดคำ artagger)*
- ```deepcut``` (สำหรับตัวตัดคำ deepcut)
- ```icu``` (สำหรับการถอดตัวสะกดเป็นสัทอักษรและการตัดคำด้วย ICU)
- ```ipa``` (สำหรับการถอดตัวสะกดเป็นสัทอักษรสากล (IPA))
- ```ml``` (สำหรับการรองรับโมเดล ULMFiT)
- ```ner``` (สำหรับการติดป้ายชื่อเฉพาะ (named-entity))
- ```thai2fit``` (สำหรับ word vector)
- ```thai2rom``` (สำหรับการถอดตัวสะกดเป็นอักษรละติน)
- ```full``` (ติดตั้งทุกอย่าง)
โดยที่ `extras` คือ
- `artagger` (สำหรับตัวติดป้ายกำกับชนิดคำ artagger)*
- `deepcut` (สำหรับตัวตัดคำ deepcut)
- `icu` (สำหรับการถอดตัวสะกดเป็นสัทอักษรและการตัดคำด้วย ICU)
- `ipa` (สำหรับการถอดตัวสะกดเป็นสัทอักษรสากล (IPA))
- `ml` (สำหรับการรองรับโมเดล ULMFiT)
- `ner` (สำหรับการติดป้ายชื่อเฉพาะ (named-entity))
- `thai2fit` (สำหรับ word vector)
- `thai2rom` (สำหรับการถอดตัวสะกดเป็นอักษรละติน)
- `full` (ติดตั้งทุกอย่าง)

* หมายเหตุ: แพคเกจ ```artagger``` มาตรฐานจาก PyPI อาจมีปัญหาการถอดรหัสข้อความบน Windows กรุณาติดตั้ง artagger รุ่นแก้ไขด้วยคำสั่ง ```pip install https://github.com/wannaphongcom/artagger/tarball/master#egg=artagger``` แทน ก่อนจะติดตั้ง PyThaiNLP
* หมายเหตุ: แพคเกจ `artagger` มาตรฐานจาก PyPI อาจมีปัญหาการถอดรหัสข้อความบน Windows กรุณาติดตั้ง artagger รุ่นแก้ไขด้วยคำสั่ง ```pip install https://github.com/wannaphongcom/artagger/tarball/master#egg=artagger``` แทน ก่อนจะติดตั้ง PyThaiNLP

** นักพัฒนาสามารถดู ```extras``` และ ```extras_require``` ใน [```setup.py```](https://github.com/PyThaiNLP/pythainlp/blob/dev/setup.py) สำหรับรายละเอียดแพคเกจของเสริม
** สามารถดู `extras` และ `extras_require` ใน [`setup.py`](https://github.com/PyThaiNLP/pythainlp/blob/dev/setup.py) สำหรับรายละเอียดแพคเกจของเสริม

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

Expand Down
Loading