Skip to content

Commit ef4b703

Browse files
authored
Merge pull request #979 from bact/fix-nlpo3-bool-bug
Fix success check in nlpo3.load_dict
2 parents ed83a18 + 26082f7 commit ef4b703

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pythainlp/tokenize/nlpo3.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,31 @@
1010
from pythainlp.corpus import path_pythainlp_corpus
1111
from pythainlp.corpus.common import _THAI_WORDS_FILENAME
1212

13-
_NLPO3_DEFAULT_DICT_NAME = "_67a47bf9" # supposed to be unique
13+
_NLPO3_DEFAULT_DICT_NAME = "_73bcj049dzbu9t49b4va170k" # supposed to be unique
1414
_NLPO3_DEFAULT_DICT = nlpo3_load_dict(
1515
path_pythainlp_corpus(_THAI_WORDS_FILENAME), _NLPO3_DEFAULT_DICT_NAME
16-
)
16+
) # preload default dict, so it can be accessible by _NLPO3_DEFAULT_DICT_NAME
1717

1818

1919
def load_dict(file_path: str, dict_name: str) -> bool:
2020
"""Load a dictionary file into an in-memory dictionary collection.
2121
2222
The loaded dictionary will be accessible through the assigned dict_name.
23-
*** This function does not override an existing dict name. ***
23+
*** This function will not override an existing dict name. ***
2424
2525
:param file_path: Path to a dictionary file
2626
:type file_path: str
2727
:param dict_name: A unique dictionary name, used for reference.
2828
:type dict_name: str
29-
:return bool
29+
:return success: True if loaded successfully, False otherwise.
30+
:rtype: bool
3031
3132
:See Also:
3233
* \
3334
https://github.com/PyThaiNLP/nlpo3
3435
"""
3536
msg, success = nlpo3_load_dict(file_path=file_path, dict_name=dict_name)
36-
if bool is False:
37+
if not success:
3738
print(msg, file=stderr)
3839
return success
3940

0 commit comments

Comments
 (0)