Skip to content

Commit b329aa8

Browse files
authored
Merge pull request #379 from PyThaiNLP/offload-init-py
Move non-init code out of __init__.py files
2 parents cf921bf + 949546b commit b329aa8

45 files changed

Lines changed: 1658 additions & 1427 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pip install pythainlp[extra1,extra2,...]
8080

8181
where `extras` can be
8282
- `attacut` (to support attacut, a fast and accurate tokenizer)
83-
- `benchmarks` (for word tokenization benchmarking)
83+
- `benchmarks` (for [word tokenization benchmarking](tokenization-benchmark.md))
8484
- `icu` (for ICU, International Components for Unicode, support in transliteration and tokenization)
8585
- `ipa` (for IPA, International Phonetic Alphabet, support in transliteration)
8686
- `ml` (to support ULMFiT models for classification)
@@ -180,7 +180,7 @@ pip install pythainlp[extra1,extra2,...]
180180

181181
โดยที่ `extras` คือ
182182
- `attacut` (ตัวตัดคำที่แม่นกว่า `newmm` เมื่อเทียบกับชุดข้อมูล BEST)
183-
- `benchmarks` (สำหรับเครื่องมือวัดความแม่นยำของตัวตัดคำ)
183+
- `benchmarks` (สำหรับเครื่องมือ[วัดความแม่นยำของตัวตัดคำ](tokenization-benchmark.md))
184184
- `icu` (สำหรับการถอดตัวสะกดเป็นสัทอักษรและการตัดคำด้วย ICU)
185185
- `ipa` (สำหรับการถอดตัวสะกดเป็นสัทอักษรสากล (IPA))
186186
- `ml` (สำหรับการรองรับโมเดล ULMFiT)

docs/api/tokenize.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Modules
1212
.. autofunction:: word_tokenize
1313
.. autofunction:: syllable_tokenize
1414
.. autofunction:: subword_tokenize
15-
.. autofunction:: dict_trie
1615
.. autoclass:: Tokenizer
1716
:members:
1817

docs/api/util.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Modules
1111
.. autofunction:: bahttext
1212
.. autofunction:: collate
1313
.. autofunction:: delete_tone
14+
.. autofunction:: dict_trie
1415
.. autofunction:: digit_to_text
1516
.. autofunction:: eng_to_thai
1617
.. autofunction:: find_keyword
@@ -31,4 +32,6 @@ Modules
3132
.. autofunction:: thai_digit_to_arabic_digit
3233
.. autofunction:: thaiword_to_num
3334
.. autofunction:: thai_day2datetime
34-
.. autofunction:: thai_time2time
35+
.. autofunction:: thai_time2time
36+
.. autoclass:: Trie
37+
:members:

pythainlp/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
Tokenizer,
4444
sent_tokenize,
4545
subword_tokenize,
46+
syllable_tokenize,
4647
word_tokenize,
4748
)
4849
from pythainlp.transliterate import romanize, transliterate

pythainlp/__main__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def main(args=None):
1919
type=str,
2020
default="",
2121
nargs="?",
22-
help="[%s]" % "|".join(cli.COMMANDS)
22+
help="[%s]" % "|".join(cli.COMMANDS),
2323
)
2424

2525
args = parser.parse_args(sys.argv[1:2])
@@ -30,12 +30,9 @@ def main(args=None):
3030
command = getattr(cli, args.command)
3131
command.App(sys.argv)
3232
else:
33-
print(f"Command not available: {args.command}\nPlease run with --help for alternatives")
34-
33+
print(f"Command not available: {args.command}")
34+
print("Please run with --help for alternatives")
3535

3636

3737
if __name__ == "__main__":
3838
main()
39-
40-
41-

pythainlp/benchmarks/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
from .word_tokenization import benchmark
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Performance benchmarking.
4+
"""
25

36
__all__ = ["benchmark"]
7+
8+
from pythainlp.benchmarks.word_tokenization import benchmark

0 commit comments

Comments
 (0)