Skip to content

Commit b70ee14

Browse files
committed
Update document for command line
1 parent 2901373 commit b70ee14

2 files changed

Lines changed: 25 additions & 20 deletions

File tree

docs/notes/command_line.rst

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,56 @@ You can use PyThaiNLP from Command Line.
55

66
Run Command Line and type the commands:::
77

8-
pythainlp
8+
thainlp
99

1010
**Word tokenization**::
1111

12-
pythainlp tokenization word --text TEXT
12+
thainlp tokenize word TEXT
1313

1414
*Example*::
1515

16-
$ pythainlp tokenization word --text "ผมร<0e31>กประเทศไทย? สามารถ" --engine newmm
17-
ผม|รัก|ประเทศไทย|?| |สามารถ
18-
16+
$ thainlp tokenize word สภาพการจ้างและสภาพการทำงาน
17+
สภาพการจ้าง|และ|สภาพ|การทำงาน|
1918

2019
**Syllable tokenization**::
2120

22-
pythainlp tokenization syllable --text TEXT
21+
thainlp tokenize syllable TEXT
22+
23+
*Example*::
24+
25+
$ thainlp tokenize syllable สภาพการจ้างและสภาพการทำงาน
26+
สภาพ~การ~จ้าง~และ~สภาพ~การ~ทำ~งาน~
27+
28+
**Subword tokenization**::
29+
30+
thainlp tokenize subword TEXT
2331

2432
*Example*::
2533

26-
$ pythainlp tokenization syllable --text "ผมร<0e31>กประเทศไทย? สามารถ"
27-
ผม~รัก~ประ~เทศ~ไทย~? ~สา~มารถ
34+
$ thainlp tokenize subword สภาพการจ้างและสภาพการทำงาน
35+
ส/ภา/พ/กา/ร/จ้า/ง/และ/ส/ภา/พ/กา/ร/ทำ/งา/น/
2836

2937
**Part-Of-Speech tagging**::
3038

31-
pythainlp tagging pos --text TEXT
39+
pythainlp tagg pos -s SEPARATOR TEXT
3240

3341
*Example*::
3442

35-
$ pythainlp tagging pos --text "ผม|ไม่|กิน|เผ็ด"
43+
$ thainlp tag pos -s . ผม.ไม่.กิน.เผ็ด
3644

3745
**Soundex**::
3846

39-
pythainlp soundex --text TEXT
47+
thainlp soundex TEXT
4048

4149
*Example*::
4250

43-
$ pythainlp soundex --text "บ<0e39>รณการ" --engine lk82
44-
บE419
51+
$ thainlp soundex บรรณการ
52+
บ319000
4553

4654
**Mange corpus**::
4755

48-
pythainlp corpus
56+
thainlp data
4957

5058
**Help**::
5159

52-
pythainlp --help
60+
thainlp --help

pythainlp/cli/tokenize.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,9 @@ def __init__(self, name, argv):
5959
parser.set_defaults(keep_whitespace=True)
6060

6161
args = parser.parse_args(argv)
62-
6362
self.args = args
64-
print(args)
6563

6664
cli.exit_if_empty(args.text, parser)
67-
6865
result = self.run(
6966
args.text,
7067
engine=args.algorithm,
@@ -96,7 +93,7 @@ def __init__(self, *args, **kwargs):
9693
self.keep_whitespace = True
9794
self.algorithm = DEFAULT_SENT_TOKENIZE_ENGINE
9895
self.separator = DEFAULT_SENT_TOKEN_SEPARATOR
99-
self.run = syllable_tokenize
96+
self.run = sent_tokenize
10097
super().__init__(*args, **kwargs)
10198

10299

@@ -105,7 +102,7 @@ def __init__(self, *args, **kwargs):
105102
self.keep_whitespace = True
106103
self.algorithm = DEFAULT_SUBWORD_TOKENIZE_ENGINE
107104
self.separator = DEFAULT_SUBWORD_TOKEN_SEPARATOR
108-
self.run = syllable_tokenize
105+
self.run = subword_tokenize
109106
super().__init__(*args, **kwargs)
110107

111108

0 commit comments

Comments
 (0)