skillfed

pythainlp

Thai Natural Language Processing library

pythainlp v5.3.7 1.4M downloads/30d#3,915 on PyPI1,148
Permissive license Apache-2.0 Active released

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 pythainlp

uv

uv add pythainlp

poetry

poetry add pythainlp

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: ThaiProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Software Development :: LocalizationTopic :: Text ProcessingTopic :: Text Processing :: GeneralTopic :: Text Processing :: Linguistic

Tags

thai language processingthai tokenizationthai nlp librarythai text analysisthai pos taggingthai word segmentationthai spelling correction
thai-languagenlptokenization

More Artificial Intelligence packages