Skip to content

Commit 4b04609

Browse files
committed
safe_print in tokenize
1 parent f8aa23e commit 4b04609

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pythainlp/cli/tokenize.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
subword_tokenize,
1717
word_tokenize,
1818
)
19+
from pythainlp.tools import safe_print
1920

2021
DEFAULT_SENT_TOKEN_SEPARATOR = "@@"
2122
DEFAULT_SUBWORD_TOKEN_SEPARATOR = "/"
@@ -71,7 +72,7 @@ def __init__(self, name, argv):
7172
engine=args.algorithm,
7273
keep_whitespace=args.keep_whitespace,
7374
)
74-
print(args.separator.join(result) + args.separator)
75+
safe_print(args.separator.join(result) + args.separator)
7576

7677

7778
class WordTokenizationApp(SubAppBase):
@@ -144,4 +145,4 @@ def __init__(self, argv):
144145
elif token_type.startswith("se"):
145146
SentenceTokenizationApp("sent", argv)
146147
else:
147-
print(f"Token type not available: {token_type}")
148+
safe_print(f"Token type not available: {token_type}")

0 commit comments

Comments
 (0)