mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Use the default Jieba dict for Chinese search if not set (#13005)
This commit is contained in:
parent
25ad2a031e
commit
80642f6524
@ -234,7 +234,10 @@ class SearchChinese(SearchLanguage):
|
|||||||
|
|
||||||
def init(self, options: dict[str, str]) -> None:
|
def init(self, options: dict[str, str]) -> None:
|
||||||
if JIEBA:
|
if JIEBA:
|
||||||
dict_path = options.get('dict')
|
default_dict_path = os.path.join(
|
||||||
|
os.path.dirname(jieba.__file__), jieba.DEFAULT_DICT_NAME
|
||||||
|
)
|
||||||
|
dict_path = options.get('dict', default_dict_path)
|
||||||
if dict_path and os.path.isfile(dict_path):
|
if dict_path and os.path.isfile(dict_path):
|
||||||
jieba.load_userdict(dict_path)
|
jieba.load_userdict(dict_path)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user