;ELC���
;;; Compiled
;;; in Emacs version 26.3
;;; with all optimizations.

;;; This file contains utf-8 non-ASCII characters,
;;; and so cannot be loaded into Emacs 22 or earlier.
(and (boundp 'emacs-version)
     (< (aref emacs-version (1- (length emacs-version))) ?A)
     (string-lessp emacs-version "23")
     (error "`%s' was compiled for Emacs 23 or later" #$))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(byte-code "\300\301!\210\300\302!\207" [require pyim-common subr-x] 2)
#@97 小于这个数值(单位为M)的词典不需要用分区算法加速.可节约一半的内存.
(defvar pyim-dregcache-partition-minimum-size 32 (#$ . 480))
(defvar pyim-dregcache-cache nil)
(defvar pyim-dregcache-icode2word nil)
(defvar pyim-dregcache-iword2count nil)
(defvar pyim-dregcache-dicts-md5 nil)
#@47 Get VARIABLE dcache file path.

(fn VARIABLE)
(defalias 'pyim-dregcache-variable-file #[257 "\301!\302!P\207" [pyim-dcache-directory file-name-as-directory symbol-name] 4 (#$ . 794)])
#@52 Save VARIABLE with its VALUE.

(fn VARIABLE VALUE)
(defalias 'pyim-dregcache-save-variable #[514 "\301!\302\303\304!\302\"\210\305\306!r\211q\210\307\310\311\312\313!\314\"\315$\216c\210\316!*\262)\207" [save-silently pyim-dregcache-variable-file t make-directory file-name-directory generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205	�\302\300!\207" vconcat vector [buffer-name kill-buffer] 2 pyim-dcache-write-file] 10 (#$ . 986)])
#@55 载入 VARIABLE 对应的文件内容.

(fn VARIABLE)
(defalias 'pyim-dregcache-load-variable #[257 "\300!\211\205)�\301!\205)�\302\303!r\211q\210\304\305\306\307\310!\311\"\312$\216\313!\210\314 *\262\207" [pyim-dregcache-variable-file file-exists-p generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205	�\302\300!\207" vconcat vector [buffer-name kill-buffer] 2 insert-file-contents buffer-string] 9 (#$ . 1444)])
#@136 对 WORDS-LIST 排序,词频大的排在前面.

排序使用 `pyim-dregcache-iword2count' 中记录的词频信息

(fn WORDS-LIST)
(defalias 'pyim-dregcache-sort-words #[257 "\300\301\"\207" [sort #[514 "\301\302\"@\301\302\"@\303\"\206�\304\303\"\206�\304V\207" [pyim-dregcache-iword2count split-string ":" gethash 0] 8 "\n\n(fn A B)"]] 4 (#$ . 1880)])
#@24 对个人词库排序.
(defalias 'pyim-dregcache-sort-icode2word #[0 "\301\302!r\211q\210\303\304\305\306\307!\310\"\311$\216\312\313\"\211\203T�\211@\314\315\"\203A�\316\317\"\320\312\316\311\"\321\"!\322\323\324\325\321#P\"c\266\202M�\211\326\230\204M�\322\323\"c\210A\266\202\202�\210\327 \211*\207" [pyim-dregcache-icode2word generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205	�\302\300!\207" vconcat vector [buffer-name kill-buffer] 2 split-string "\n" string-match "^\\([a-z-]+ \\)\\(.*\\)" match-string 1 pyim-dregcache-sort-words " " format "%s\n" mapconcat identity "" buffer-string] 12 (#$ . 2253)])
#@79 将 RAW-CONTENT 划分成可以更高效搜索的缓冲区.

(fn RAW-CONTENT)
(defalias 'pyim-dregcache-create-cache-content #[257 "\301G\302_W\203�\303D\262\202r�\304\301\305\301\211\305\301GW\203R�\306\307\234!P\262\310\n#\262\211\203K�\311\312#C\"\262\313\262\211\262T\262\202�\203j�\311\312#C\"\262\303D\262\202p�\303	D\262\266\211\207" [pyim-dregcache-partition-minimum-size nil 1048576 :content "bcdefghjklmnopqrstwxyz" 0 "^" string string-match append substring-no-properties t] 15 (#$ . 2892)])
#@38 READ from DICT-FILE.

(fn DICT-FILE)
(defalias 'pyim-dregcache-load-dictionary-file #[257 "\301\302!r\211q\210\303\304\305\306\307!\310\"\311$\216\312!\210\313 *\262\314\315!\316!#\211\207" [pyim-dregcache-cache generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205	�\302\300!\207" vconcat vector [buffer-name kill-buffer] 2 insert-file-contents buffer-string lax-plist-put file-truename pyim-dregcache-create-cache-content] 8 (#$ . 3442)])
#@310 读取并加载词库.

读取 `pyim-dicts' 和 `pyim-extra-dicts' 里面的词库文件,生成对应的
词库缓冲文件,然后加载词库缓存。

DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码.

如果 FORCE 为真,强制加载。

(fn DICT-FILES DICTS-MD5 &optional FORCE)
(defalias 'pyim-dregcache-update-code2word #[770 "\211\204�\232?\205!�\211\203�\211@\301!\210A\266\202\202\f�\210\211\207" [pyim-dregcache-dicts-md5 pyim-dregcache-load-dictionary-file] 7 (#$ . 3905) nil])
#@98 将声母 CHAR 转换为通用正则表达式匹配所有以该声母开头的汉字.

(fn CHAR)
(defalias 'pyim-dregcache-shenmu2regexp '(macro . #[257 "\300\301BB\207" [concat ("[a-z]*")] 4 (#$ . 4435)]))
#@46 判断CODE 是否是一个声母.

(fn CODE)
(defalias 'pyim-dregcache-is-shenmu '(macro . #[257 "\300\301\302D\303BB\304\305\306BBDE\207" [and eq length (1) not string-match ("aeo")] 7 (#$ . 4649)]))
#@151 将 CODE 转换成正则表达式用来搜索辞典缓存中的匹配项目.
单个声母会匹配所有以此生母开头的单个汉字.

(fn CODE)
(defalias 'pyim-dregcache-code2regexp #[257 "\300G\301=\203�\302\303\"\204�\304P\202P�\305\306\"\211\262G\301=\203&�\202P�\307\310\306#G\311W\2036�\211\202N�\211GS\234\312=\203K�\211\313GSO\314P\202N�\211\315P\262\207" [nil 1 string-match #1="aeo" #2="[a-z]*" split-string "-" mapconcat #[257 "\211G\300=\203�\301\302\"\204�\211\303P\207\207" [1 string-match #1# #2#] 4 "\n\n(fn E)"] 3 42 0 "?[a-z-]*" "[a-z-]*"] 6 (#$ . 4859)])
#@13 

(fn CODE)
(defalias 'pyim-dregcache-match-line '(macro . #[257 "\300\301\302D\303BBB\207" [concat "^" pyim-dregcache-code2regexp (" \\(.+\\)")] 5 (#$ . 5460)]))
#@21 所有词典文件.
(defalias 'pyim-dregcache-all-dict-files #[0 "\301\211\203�\211@\211;\203�\211B\262A\266\202\202�\210\211\237\207" [pyim-dregcache-cache nil] 5 (#$ . 5630)])
#@106 找到 CODE 对应的字典子缓冲区.  FILE-INFO 是字典文件的所有信息.

(fn CODE FILE-INFO)
(defalias 'pyim-dregcache-get-content #[514 "\300\301\"\302\303\234<\2037�\211\304X\203�\211\305Z\262\2022�\211\306X\203+�\307\305\310#\262\2022�\307\305\311#\2628\262\207" [plist-get :content nil 0 104 97 116 - 1 3] 9 (#$ . 5822)])
#@21 

(fn CONTENT CODE)
(defalias 'pyim-dregcache-get-1 #[514 "\301\302\303\304!\305QG\306\211W\203S�\307	#\211\262\203S�\310\311	\"\262\203E�\307\312\"\203;�B\262\202E�\313\314\315\"\237\"\262\316\317	GG$\262\202�)\207" [case-fold-search t 0 "^" pyim-dregcache-code2regexp " \\(.+\\)" nil string-match match-string-no-properties 1 "^[^ ]+$" append split-string " +" + 2] 13 (#$ . 6179)])
#@90 从 `pyim-dregcache-cache' 搜索 CODE, 得到对应的词条.

(fn CODE &optional FROM)
(defalias 'pyim-dregcache-get #[513 "\302>\204\f�\303>\203�\304!\207\305 \306\203�\307\310\"\210\203E�\211\203D�\211@\311	\"\312\"\313\314\n\"\"\262\266A\266\202\202!�\210\211\237\262\313\315\316\211#\"\207" [pyim-debug pyim-dregcache-cache icode2word ishortcode2word pyim-dregcache-get-icode2word-ishortcode2word pyim-dregcache-all-dict-files nil message "pyim-dregcache-get is called. code=%s" lax-plist-get pyim-dregcache-get-content append pyim-dregcache-get-1 pyim-pymap-py2cchar-get t] 12 (#$ . 6596)])
#@123 以 CODE 搜索个人词和个人联想词.  正则表达式搜索词库,不需要为联想词开单独缓存.

(fn CODE)
(defalias 'pyim-dregcache-get-icode2word-ishortcode2word #[257 "\203	�\302\303\"\210	\205�\304	\"\237\207" [pyim-debug pyim-dregcache-icode2word message "pyim-dregcache-get-icode2word-ishortcode2word called => %s" pyim-dregcache-get-1] 4 (#$ . 7225)])
#@219 合并 `pyim-dregcache-icode2word' 磁盘文件. 加载排序后的结果.

在这个过程中使用了 `pyim-dregcache-iword2count' 中记录的词频信息。
如果 FORCE 为真,强制排序

(fn &optional FORCE)
(defalias 'pyim-dregcache-update-personal-words #[256 "\301\300!\211\203\222�\302\303!r\211q\210\304\305\306\307\310!\311\"\312$\216\313\211\211\211\211\203&�c\210c\210\314\313ed#\210\315ed\313\316\313%\210eb\210\317\320\321 \316#\204G�\322c\210eb\210m\204\213�\323 b\210`\262\324 \262@\262\325y\305U\203J�\324 \262@\262\230\203J�\211\321 |\210\326\327\"!\330\331\332#\266\202c\210\202J�\266\333 *\210\210\211\205\235�\205\235�\334 \207" [pyim-dregcache-icode2word pyim-dregcache-load-variable generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205	�\302\300!\207" vconcat vector [buffer-name kill-buffer] 2 nil sort-lines delete-duplicate-lines t re-search-forward "utf-8-unix" line-end-position "## -*- coding: utf-8-unix -*-\n" line-beginning-position pyim-dline-parse 1 delete-dups append " " mapconcat identity buffer-string pyim-dregcache-sort-icode2word] 14 (#$ . 7610)])
#@37 初始化 cache 缓存相关变量.
(defalias 'pyim-dregcache-init-variables #[0 "\301\302\303\304\305!#\210?\205�\306\307!\207" [pyim-dregcache-icode2word pyim-dcache-set-variable pyim-dregcache-iword2count nil pyim-dcache-get-variable pyim-dhashcache-iword2count pyim-dregcache-update-personal-words t] 5 (#$ . 8742)])
#@36 保存缓存内容到默认目录.
(defalias 'pyim-dregcache-save-personal-dcache-to-file #[0 "\203�\302\303!\210	\203�\304\301	\"\210\305\306!\207" [pyim-debug pyim-dregcache-icode2word message "pyim-dregcache-save-personal-dcache-to-file called" pyim-dregcache-save-variable pyim-dcache-save-variable pyim-dregcache-iword2count] 3 (#$ . 9071)])
#@6 TODO
(defalias 'pyim-dregcache-insert-export-content #[0 "\300\207" ["TODO"] 1 (#$ . 9426)])
#@71 保存词频到缓存.

(fn WORD &optional PREPEND WORDCOUNT-HANDLER)
(defalias 'pyim-dregcache-update-iword2count #[769 "\203	�\302\303\"\210\304	\"\305!\203�!\202(�\247\203\"�\202(�\211\206'�\306T\232?\2054�\307	#\207" [pyim-debug pyim-dregcache-iword2count message "pyim-dregcache-update-iword2count. word=%s" gethash functionp 0 puthash] 9 (#$ . 9525)])
#@59 将中文词条 WORD 从个人词库中删除.

(fn WORD)
(defalias 'pyim-dregcache-delete-word #[257 "\303\304!r\211q\210\305\306\307\310\311!\312\"\313$\216c\210eb\210\314\315\211\211\316\317\320Q\315\314#\203V�\306\224\262\306\225\262\321\322!\321\313!\321\323!Q\262T|\210\324\325\"G\322V\203�b\210c\210\202�\326 )\266*\210\327\n\"\207" [pyim-dregcache-icode2word case-fold-search pyim-dregcache-iword2count generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205	�\302\300!\207" vconcat vector [buffer-name kill-buffer] 2 t nil re-search-forward "^\\([a-z-]+\\) \\(.*\\)" "\\(.*\\)$" match-string-no-properties 1 3 split-string " " buffer-string remhash] 9 (#$ . 9902)])
#@106 保存个人词到缓存,和其他词库格式一样以共享正则搜索算法.

(fn WORD CODE PREPEND)
(defalias 'pyim-dregcache-insert-word-into-icode2word #[771 "\203�\303\304$\210\305\306!r\211q\210\307\310\311\312\313!\314\"\315$\216	\203%�	c\210eb\210\316\317\211\211\211\211\320\321	\322Q\317\316#\203n�\310\224\262\310\225\262\323\324!\262|\210\325\326\327\"!\262\327\330\331
C\"!\327\332\333#\266\202Q\262\202{�\327\206w�\n\334R\262\206\200�db\210c\210)\266\335 \211*\207" [pyim-debug pyim-dregcache-icode2word case-fold-search message "pyim-dregcache-insert-word-into-icode2word called => %s %s %s" generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205	�\302\300!\207" vconcat vector [buffer-name kill-buffer] 2 t nil re-search-forward "^" " \\(.*\\)" match-string-no-properties 1 pyim-dregcache-sort-words split-string " " delete-dups append mapconcat identity "\n" buffer-string] 17 (#$ . 10608)])
#@231 升级 icode2word 缓存。

dregcache 只支持全拼和双拼,不能用于五笔之类的型码输入法,而
update-icode2word 目前只要是用于更新型码输入法的 code-prefix, 所
以不需要具体实现细节。
(defalias 'pyim-dregcache-upgrade-icode2word #[0 "\300\207" ["升级 icode2word 缓存。\n\ndregcache 只支持全拼和双拼,不能用于五笔之类的型码输入法,而\nupdate-icode2word 目前只要是用于更新型码输入法的 code-prefix, 所\n以不需要具体实现细节。"] 1 (#$ . 11566)])
#@21 

(fn WORD CONTENT)
(defalias 'pyim-dregcache-search-word-code-1 #[514 "\301\302\303\304\305\260\306\"\205�\307\310\")\207" [case-fold-search t "^\\([a-z-]+\\)\\(.*\\) " "\\(" " \\|" "$\\)" string-match match-string-no-properties 1] 8 (#$ . 12117)])
#@105 从 `pyim-dregcache-cache' 和 `pyim-dregcache-icode2word' 搜索 word, 得到对应的code.

(fn WORD)
(defalias 'pyim-dregcache-search-word-code #[257 "\203	�\303\304\"\210	\205p�\3052p�\306 \307\n\203(�\310\n\"\262\211\203(�\311\305C\"\210\211\205k�\211@\312	\"\312\313\"\211<\203@�\211\202B�\211C\211\203b�\211@\310	\"\262\203[�\311\305C\"\210A\266\202\202B�\266A\266\202\202)�\262\266\2020\207" [pyim-debug pyim-dregcache-cache pyim-dregcache-icode2word message "pyim-dregcache-search-word-code word=%s" result pyim-dregcache-all-dict-files nil pyim-dregcache-search-word-code-1 throw lax-plist-get :content] 12 (#$ . 12382)])
#@58 将个人词库存入 FILE.

(fn FILE &optional CONFIRM)
(defalias 'pyim-dregcache-export-personal-words #[513 "\205>�\301 \210\302\303!r\211q\210\304\305\306\307\310!\311\"\312$\216c\210eb\210\313\314\315\316#\2031�\317\320\315\316#\210\202 �\321\315ed#\210\322\"*\262\207" [pyim-dregcache-icode2word pyim-dregcache-sort-icode2word generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205	�\302\300!\207" vconcat vector [buffer-name kill-buffer] 2 re-search-forward "^[a-z]+ [^a-z]*" nil t replace-match "" sort-lines pyim-dcache-write-file] 9 (#$ . 13039)])
(provide 'pyim-dregcache)