Skip to main content

Thai localization package

Project description

num-thai-cnv

num-thai-cnv is python library, primarily focused on converting number into Thai text and vice versa.

Installation

pip install num-thai-cnv

Features

Convert number to Thai text and vice versa, convert Arabic to Thai number.

Initialize the object

from num_thai_cnv import ThaiNumberConverter
thainum = ThaiNumberConverter()

ThaiNumberConverter Methods

Method name Description Command Result
ToText Convert Arabic number to Thai text thainum.ToText(123) or thainum.ToText('123') 'หนึ่งร้อยยี่สิบสาม'
ToNum Convert Thai text to Arabic number thainum.ToNum('หนึ่งร้อยยี่สิบสาม') '123'
ToThaiNumber Convert Arabic number to Thai number thainum(123) or thainum('123') '๑๒๓'

ThaiNumberConverter Notes

  • ToText and ToThaiNumber method can support unlimited digit.

  • ToNum method does whitelist the following words, violation will lead to error 'Check if text contains excluded word'.

    Words Words Words
    เอ็ด หก ร้อย
    หนึ่ง เจ็ด พัน
    สอง แปด หมื่น
    สาม เก้า แสน
    สี่ สิบ ล้าน
    ห้า ยี่

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

num_thai_cnv-1.0.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

num_thai_cnv-1.0.1-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page