pythainlp
Thai Natural Language Processing library
What it is and what it does
PyThaiNLP is a Python library for Thai natural language processing, providing standard linguistic analysis tools tailored to Thai language characteristics. It includes sentence, word, and subword segmentation; part-of-speech tagging; transliteration and IPA conversion; spelling correction; and utilities like soundex, collation, and Thai-specific formatting functions. The library ships with built-in Thai character sets, word lists, and stop words, plus a command-line interface.
The package depends on importlib-resources and tzdata at runtime and is designed to work with Python 3.9 and later. It downloads linguistic data and models on demand to a local directory (configurable via environment variables), with options for offline and read-only modes. Installation is straightforward with optional extras for machine translation and WordNet support, though the base install covers core tokenization and tagging tasks.
Use it for:
- Tokenize Thai text into sentences, words, or subwords for downstream NLP pipelines.
- Perform part-of-speech tagging on Thai documents for grammatical analysis.
- Correct Thai spelling errors and generate spelling suggestions for user input.
- Transliterate Thai text to romanized or IPA form for linguistic study or accessibility.
- Build Thai language applications with built-in stop words, character sets, and collation utilities.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyThaiNLP provides Thai-language natural language processing tools including tokenization, part-of-speech tagging, transliteration, spelling correction, and linguistic utilities, designed as a Thai counterpart to NLTK.
Yes. PyThaiNLP is actively maintained, has no known vulnerabilities, carries a permissive Apache-2.0 license, and installs with minimal friction. It is the standard choice for Thai NLP in Python and covers essential tasks like tokenization, tagging, and correction. Install it if you need to process Thai text; the base package is lightweight and the optional extras allow you to add machine translation or WordNet support as needed.
Install
pythainlp on PyPI
pip
pip install pythainlpuv
uv add pythainlppoetry
poetry add pythainlpInstalling pythainlp
Before you install
Low install friction with only two runtime dependencies (importlib-resources and tzdata). The package is actively maintained with a recent release and no known vulnerabilities.
License in practice
Licensed under Apache-2.0 (permissive), with data and models covered by CC0-1.0 and CC-BY-4.0. This permits commercial use and modification with minimal restrictions.
Quickstart
pip install pythainlp
import pythainlp
from pythainlp.tokenize import word_tokenize
text = "สวัสดีชาวโลก"
tokens = word_tokenize(text)
Requires Python 3.9 or later. By default, PyThaiNLP downloads linguistic data to ~/pythainlp-data on first use; set PYTHAINLP_OFFLINE=1 or PYTHAINLP_DATA to control this behavior.
Verify before relying
- Whether optional extras (translate, wordnet, full) introduce significant additional dependencies or compatibility concerns.
- Performance characteristics and memory footprint when processing large Thai text corpora.
- Availability and quality of pre-trained models for tasks beyond basic tokenization and tagging.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — importlib-resources, tzdata |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,425,870/month — #3,915 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pythainlp-5.3.7-py3-none-any.whl
Keywords: NLP, Thai NLP, Thai language, ThaiNLP, computational linguistics, linguistics, localization, natural language processing, pythainlp, text processing, tokenization
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
nltkNLTK is a Python library for natural language…
permissive · top 1,000 on PyPI
urduhackUrduhack provides NLP preprocessing,…
permissive · top 15,000 on PyPI
konlpyKoNLPy provides Korean natural language…
copyleft · top 15,000 on PyPI
textblobTextBlob provides a simple API for common…
permissive · top 5,000 on PyPI
indic-nlp-libraryIndic NLP Library provides text processing and…
permissive · top 15,000 on PyPI
symspellpysymspellpy is a Python port of SymSpell v6.7.2…
permissive · top 15,000 on PyPI
sea-g2pConverts text to phonemes for Vietnamese, Thai,…
permissive · top 15,000 on PyPI
englishEnglish is a utility library providing English…
permissive · top 15,000 on PyPI
jieba3kPerforms Chinese word segmentation, breaking…
unclear · top 15,000 on PyPI
pyenchantPyEnchant provides Python bindings to the…
copyleft · top 5,000 on PyPI