|
1 | | -# -*- coding: utf-8 -*- |
2 | | -# SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project |
3 | | -# SPDX-FileType: SOURCE |
4 | | -# SPDX-License-Identifier: Apache-2.0 |
5 | | -__version__ = "5.2.0" |
6 | | - |
7 | | -thai_consonants = "กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรลวศษสหฬอฮ" # 44 chars |
8 | | - |
9 | | -thai_vowels = ( |
10 | | - "\u0e24\u0e26\u0e30\u0e31\u0e32\u0e33\u0e34\u0e35\u0e36\u0e37" |
11 | | - + "\u0e38\u0e39\u0e40\u0e41\u0e42\u0e43\u0e44\u0e45\u0e4d\u0e47" |
12 | | -) # 20 |
13 | | -thai_lead_vowels = "\u0e40\u0e41\u0e42\u0e43\u0e44" # 5 |
14 | | -thai_follow_vowels = "\u0e30\u0e32\u0e33\u0e45" # 4 |
15 | | -thai_above_vowels = "\u0e31\u0e34\u0e35\u0e36\u0e37\u0e4d\u0e47" # 7 |
16 | | -thai_below_vowels = "\u0e38\u0e39" # 2 |
17 | | - |
18 | | -thai_tonemarks = "\u0e48\u0e49\u0e4a\u0e4b" # 4 |
19 | | - |
20 | | -# Paiyannoi, Maiyamok, Phinthu, Thanthakhat, Nikhahit, Yamakkan: |
21 | | -# These signs can be part of a word |
22 | | -thai_signs = "\u0e2f\u0e3a\u0e46\u0e4c\u0e4d\u0e4e" # 6 chars |
23 | | - |
24 | | -# Any Thai character that can be part of a word |
25 | | -thai_letters = "".join( |
26 | | - [thai_consonants, thai_vowels, thai_tonemarks, thai_signs] |
27 | | -) # 74 |
28 | | - |
29 | | -# Fongman, Angkhankhu, Khomut: |
30 | | -# These characters are section markers |
31 | | -thai_punctuations = "\u0e4f\u0e5a\u0e5b" # 3 chars |
32 | | - |
33 | | -thai_digits = "๐๑๒๓๔๕๖๗๘๙" # 10 |
34 | | -thai_symbols = "\u0e3f" # Thai Bath ฿ |
35 | | - |
36 | | -# All Thai characters that are presented in Unicode |
37 | | -thai_characters = "".join( |
38 | | - [thai_letters, thai_punctuations, thai_digits, thai_symbols] |
39 | | -) |
40 | | -# Thai pangram by Sungsit Sawaiwan |
41 | | -# CC BY-SA License |
42 | | -# Source: https://fontuni.com/articles/2015-07-12-thai-poetgram.html |
43 | | -thai_pangram = """กีฬาบังลังก์ ฿๑,๒๓๔,๕๖๗,๘๙๐ |
44 | | -๏ จับฅอคนบั่นต้อง อาญา |
45 | | -ขุดฆ่าโคตรฃัตติยา ซ่านม้วย |
46 | | -ธรรมฤๅผ่อนรักษา ใจชั่ว โฉดแฮ |
47 | | -สืบอยู่เต็มศึกด้วย ฝุ่นฟ้ากีฬา กามฦๅ ฯ |
48 | | -๏ กตัญญูไป่พร้อม ปฐมฌาน |
49 | | -เกมส๎วัฒน์ปฏิภาณ ห่อนล้ำ |
50 | | -ทฤษฎีถ่อยๆ สังหาร เกณฑ์โทษ |
51 | | -โกรธจี๊ดจ๋อยจ่มถ้ำ อยู่เฝ้า “อตฺตา” ๚ะ๛ |
52 | | -๑๒ กรกฎาคม ๒๕๕๘""" |
53 | | - |
54 | | -from pythainlp.soundex import soundex |
55 | | -from pythainlp.spell import correct, spell |
56 | | -from pythainlp.tag import pos_tag |
57 | | -from pythainlp.tokenize import ( |
58 | | - Tokenizer, |
59 | | - sent_tokenize, |
60 | | - subword_tokenize, |
61 | | - word_tokenize, |
62 | | -) |
63 | | -from pythainlp.transliterate import romanize, transliterate |
64 | | -from pythainlp.util import collate, thai_strftime |
| 1 | +# SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project |
| 2 | +# SPDX-FileType: SOURCE |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | +__version__ = "5.2.0" |
| 5 | + |
| 6 | +thai_consonants = "กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรลวศษสหฬอฮ" # 44 chars |
| 7 | + |
| 8 | +thai_vowels = ( |
| 9 | + "\u0e24\u0e26\u0e30\u0e31\u0e32\u0e33\u0e34\u0e35\u0e36\u0e37" |
| 10 | + + "\u0e38\u0e39\u0e40\u0e41\u0e42\u0e43\u0e44\u0e45\u0e4d\u0e47" |
| 11 | +) # 20 |
| 12 | +thai_lead_vowels = "\u0e40\u0e41\u0e42\u0e43\u0e44" # 5 |
| 13 | +thai_follow_vowels = "\u0e30\u0e32\u0e33\u0e45" # 4 |
| 14 | +thai_above_vowels = "\u0e31\u0e34\u0e35\u0e36\u0e37\u0e4d\u0e47" # 7 |
| 15 | +thai_below_vowels = "\u0e38\u0e39" # 2 |
| 16 | + |
| 17 | +thai_tonemarks = "\u0e48\u0e49\u0e4a\u0e4b" # 4 |
| 18 | + |
| 19 | +# Paiyannoi, Maiyamok, Phinthu, Thanthakhat, Nikhahit, Yamakkan: |
| 20 | +# These signs can be part of a word |
| 21 | +thai_signs = "\u0e2f\u0e3a\u0e46\u0e4c\u0e4d\u0e4e" # 6 chars |
| 22 | + |
| 23 | +# Any Thai character that can be part of a word |
| 24 | +thai_letters = "".join( |
| 25 | + [thai_consonants, thai_vowels, thai_tonemarks, thai_signs] |
| 26 | +) # 74 |
| 27 | + |
| 28 | +# Fongman, Angkhankhu, Khomut: |
| 29 | +# These characters are section markers |
| 30 | +thai_punctuations = "\u0e4f\u0e5a\u0e5b" # 3 chars |
| 31 | + |
| 32 | +thai_digits = "๐๑๒๓๔๕๖๗๘๙" # 10 |
| 33 | +thai_symbols = "\u0e3f" # Thai Bath ฿ |
| 34 | + |
| 35 | +# All Thai characters that are presented in Unicode |
| 36 | +thai_characters = "".join( |
| 37 | + [thai_letters, thai_punctuations, thai_digits, thai_symbols] |
| 38 | +) |
| 39 | +# Thai pangram by Sungsit Sawaiwan |
| 40 | +# CC BY-SA License |
| 41 | +# Source: https://fontuni.com/articles/2015-07-12-thai-poetgram.html |
| 42 | +thai_pangram = """กีฬาบังลังก์ ฿๑,๒๓๔,๕๖๗,๘๙๐ |
| 43 | +๏ จับฅอคนบั่นต้อง อาญา |
| 44 | +ขุดฆ่าโคตรฃัตติยา ซ่านม้วย |
| 45 | +ธรรมฤๅผ่อนรักษา ใจชั่ว โฉดแฮ |
| 46 | +สืบอยู่เต็มศึกด้วย ฝุ่นฟ้ากีฬา กามฦๅ ฯ |
| 47 | +๏ กตัญญูไป่พร้อม ปฐมฌาน |
| 48 | +เกมส๎วัฒน์ปฏิภาณ ห่อนล้ำ |
| 49 | +ทฤษฎีถ่อยๆ สังหาร เกณฑ์โทษ |
| 50 | +โกรธจี๊ดจ๋อยจ่มถ้ำ อยู่เฝ้า “อตฺตา” ๚ะ๛ |
| 51 | +๑๒ กรกฎาคม ๒๕๕๘""" |
| 52 | + |
| 53 | +from pythainlp.soundex import soundex |
| 54 | +from pythainlp.spell import correct, spell |
| 55 | +from pythainlp.tag import pos_tag |
| 56 | +from pythainlp.tokenize import ( |
| 57 | + Tokenizer, |
| 58 | + sent_tokenize, |
| 59 | + subword_tokenize, |
| 60 | + word_tokenize, |
| 61 | +) |
| 62 | +from pythainlp.transliterate import romanize, transliterate |
| 63 | +from pythainlp.util import collate, thai_strftime |
0 commit comments