Skip to content

Commit c5de73c

Browse files
authored
Merge pull request #998 from PyThaiNLP/add-thai-lunar-date
2 parents 0beba80 + 99df362 commit c5de73c

File tree

4 files changed

+996
-2
lines changed

4 files changed

+996
-2
lines changed

docs/api/util.rst

+10
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,16 @@ Modules
268268

269269
The `pythainlp.util.spell_words.spell_word` function is designed for spelling individual words in Thai text, facilitating phonetic analysis and pronunciation guides.
270270

271+
.. autofunction:: to_lunar_date
272+
:noindex:
273+
274+
The `to_lunar_date` function focuses on converts the solar date to Thai Lunar Date.
275+
276+
.. autofunction:: th_zodiac
277+
:noindex:
278+
279+
The `th_zodiac` function is converts a Gregorian year to its corresponding Thai Zodiac name.
280+
271281
.. autoclass:: Trie
272282
:members:
273283

pythainlp/util/__init__.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"text_to_arabic_digit",
4949
"text_to_num",
5050
"text_to_thai_digit",
51+
"th_zodiac",
5152
"thai_digit_to_arabic_digit",
5253
"thai_keyboard_dist",
5354
"thai_strptime",
@@ -60,6 +61,7 @@
6061
"time_to_thaiword",
6162
"tis620_to_utf8",
6263
"to_idna",
64+
"to_lunar_date",
6365
"tone_detector",
6466
"words_to_num",
6567
]
@@ -114,12 +116,15 @@
114116
isthaichar,
115117
thai_word_tone_detector,
116118
)
119+
from pythainlp.util.thai_lunar_date import th_zodiac, to_lunar_date
117120
from pythainlp.util.thaiwordcheck import is_native_thai
118121
from pythainlp.util.time import thaiword_to_time, time_to_thaiword
119122
from pythainlp.util.trie import Trie, dict_trie
120123
from pythainlp.util.wordtonum import text_to_num, thaiword_to_num, words_to_num
121124

122-
# sound_syllable and pronounce have to be imported last
125+
# sound_syllable and pronounce have to be imported last,
126+
# to prevent circular import issues.
127+
# Other imports should be above this line, sorted.
123128
from pythainlp.util.syllable import (
124129
sound_syllable,
125130
syllable_length,

0 commit comments

Comments
 (0)