安裝結巴中文分詞
$ pip install jieba安裝正體中文的擴充套件
$ git clone https://github.com/enhao/sphinx.ext.search.zh_TW.git _extension修改專案目錄下的 conf.py
# If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('_extension')) ... # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = ['search-zh_TW'] ... # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' html_search_language = 'zh_TW' # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value html_search_options = {'dict': '_extension/dict/zh.dict'}sphinx.ext.search.zh_TW 的字典檔是用結巴中文分詞的 dict.txt.big ,不設定 html_search_options 的話,會使用結巴中文分詞的預設字典
參考
沒有留言:
張貼留言