Skip to content

Commit 8b5ddaf

Browse files
authored
Refactor deepcut segment logic in core.py
Simplify deepcut segment handling by removing custom_dict checks.
1 parent cd70249 commit 8b5ddaf

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

pythainlp/tokenize/core.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def word_tokenize(
159159
`budoux <https://github.com/google/budoux>`_.
160160
:Note:
161161
- The **custom_dict** parameter only works for \
162-
*deepcut*, *longest*, *newmm*, and *newmm-safe* engines.
162+
*longest*, *newmm*, and *newmm-safe* engines.
163163
- Built-in tokenizers (*longest*, *mm*, *newmm*, and *newmm-safe*) \
164164
are thread-safe.
165165
- Wrappers of external tokenizer are designed to be thread-safe \
@@ -274,11 +274,7 @@ def word_tokenize(
274274
elif engine == "deepcut": # deepcut can optionally use dictionary
275275
from pythainlp.tokenize.deepcut import segment as deepcut_segment # noqa: I001
276276

277-
if custom_dict:
278-
custom_dict = list(custom_dict) # type: ignore[assignment]
279-
segments = deepcut_segment(text, custom_dict)
280-
else:
281-
segments = deepcut_segment(text)
277+
segments = deepcut_segment(text)
282278
elif engine == "icu":
283279
from pythainlp.tokenize.pyicu import segment as pyicu_segment # noqa: I001
284280

0 commit comments

Comments
 (0)