Skip to content

PyThaiNLP/pythainlp

Repository files navigation

PyThaiNLP Logo

PyThaiNLP

Codacy Badgepypi Build Status Build status Coverage Status License

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.

PyThaiNLP supports Python 3.4+. Since version 1.7, PyThaiNLP deprecates its support for Python 2. Python 2 users can still use PyThaiNLP 1.6.

Capabilities

  • Thai word segmentation (word_tokenize), including subword segmentation based on Thai Character Cluster (tcc) and ETCC (etcc)
  • Thai romanization (romanize)
  • 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)
  • Thai stop words (pythainlp.corpus.thai_stopwords)
  • Thai WordNet
  • and much more - see examples.

Installation

Using pip

Stable release

$ pip install pythainlp

Development release

$ pip install https://github.com/PyThaiNLP/pythainlp/archive/dev.zip

Note: PyTorch is required for ulmfit sentiment analyser. pip install torch is needed for the feature. gensim and keras packages may also needed for other modules that rely on these machine learning libraries.

Documentation

See https://thainlp.org/pythainlp/docs/1.7/

License

Contribute to PyThaiNLP

Please do fork and create a pull request :)

For style guide and other information, including references to algorithms we use, please refer to our contributing page.

ภาษาไทย

ประมวลภาษาไทยในภาษา Python

PyThaiNLP เป็นไลบารีภาษาไพทอนเพื่อการประมวลผลภาษาธรรมชาติ โดยเน้นการสนับสนุนภาษาไทย แจกจ่ายฟรี (ตลอดไป) เพื่อคนไทยและชาวโลกทุกคน!

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

รองรับ Python 3.4 ขึ้นไป

ความสามารถ

  • ตัดคำภาษาไทย (word_tokenize) และรองรับ Thai Character Clusters (tcc) และ ETCC (etcc)
  • ถอดเสียงภาษาไทยเป็นอักษรละติน (romanize)
  • ระบุชนิดคำ (part-of-speech) ภาษาไทย (pos_tag)
  • อ่านตัวเลขเป็นข้อความภาษาไทย (bahttext, num_to_thaiword)
  • เรียงลำดับคำตามพจนานุกรมไทย (collate)
  • แก้ไขปัญหาการพิมพ์ลืมเปลี่ยนภาษา (eng_to_thai, thai_to_eng)
  • ตรวจคำสะกดผิดในภาษาไทย (spell)
  • soundex ภาษาไทย (lk82, udom83, metasound)
  • stop word ภาษาไทย (pythainlp.corpus.thai_stopwords)
  • Thai WordNet
  • และอื่น ๆ ดูตัวอย่าง

ติดตั้ง

รุ่นเสถียร

$ pip install pythainlp

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

$ pip install https://github.com/PyThaiNLP/pythainlp/archive/dev.zip

หมายเหตุ: เนื่องจาก ulmfit sentiment analyser ต้องใช้ PyTorch จึงต้อง pip install torch เพื่อติดตั้ง PyTorhc ก่อน มอดูลที่อาศัยการเรียนรู้ของเครื่องอื่นๆ อาจจำเป็นต้องติดตั้ง gensim และ keras ก่อนเช่นกัน

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

อ่านที่ https://thainlp.org/pythainlp/docs/1.7/

สัญญาอนุญาต

  • โค้ด PyThaiNLP ใช้สัญญาอนุญาต Apache Software License 2.0
  • คลังคำและข้อมูลที่สร้างโดยโครงการ PyThaiNLP ใช้สัญญาอนุญาตครีเอทีฟคอมมอนส์แบบแสดงที่มา-อนุญาตแบบเดียวกัน 4.0 Creative Commons Attribution-ShareAlike 4.0 International License
  • คลังคำและข้อมูลอื่นๆ ที่อาจแจกจ่ายไปพร้อมกับแพคเกจ PyThaiNLP อาจใช้สัญญาอนุญาตอื่น โปรดดูเอกสาร Corpus License

ตราสัญลักษณ์

ออกแบบโดยคุณ วรุตม์ พสุธาดล จากการประกวดที่ https://www.facebook.com/groups/408004796247683/permalink/475864542795041/ และ https://www.facebook.com/groups/408004796247683/permalink/474262752955220/

สนับสนุนและร่วมพัฒนา

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