Skip to content

Commit 7479baa

Browse files
committed
Add list support in crfcut.py
1 parent 15471e2 commit 7479baa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pythainlp/tokenize/crfcut.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ def segment(text: str) -> List[str]:
189189
:param str text: text to be tokenized to sentences
190190
:return: list of words, tokenized from the text
191191
"""
192-
toks = word_tokenize(text)
192+
if isinstance(text, str):
193+
toks = word_tokenize(text)
194+
else:
195+
toks = text
193196
feat = extract_features(toks)
194197
labs = _tagger.tag(feat)
195198
labs[-1] = "E" # make sure it cuts the last sentence

0 commit comments

Comments
 (0)