-
Notifications
You must be signed in to change notification settings - Fork 0
/
fuzzy.elc
60 lines (55 loc) · 6.83 KB
/
fuzzy.elc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
;ELC
;;; Compiled by tknew@Transport on Fri Jan 25 11:18:28 2013
;;; from file /home/tknew/.emacs.d/auto-complete-1.3.1/fuzzy.el
;;; in Emacs version 24.3.50.1
;;; with all optimizations.
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(byte-code "\300\301!\210\302\303\304\305\306\307\310\311&\210\312\313\314\315\306\303%\207" [require regexp-opt custom-declare-group fuzzy nil "Fuzzy matching utilities." :group convenience :prefix "fuzzy-" custom-declare-variable fuzzy-accept-error-rate 0.1 "Error threshold."] 8)
(defvar fuzzy-accept-length-difference 2)
(defvar fuzzy-regexp-some-char (format "\\w\\{0,%s\\}" fuzzy-accept-length-difference))
(defalias 'fuzzy-reverse-string #[(string) "\301\300\302\303\"\237\"\207" [string apply append nil] 5])
(defalias 'fuzzy-regexp-compile #[(string) "\306\211\211\302\211\307L\210)\301\211\310L\210)\300\211\311L\210)\312\313G\306\314W\203V \301J!\203B \302J!\202D PT\211\202, ,\315\313G\306\314W\203\224 \300J!\203\200 \302J!\202\202 PT\211\202j ,\316\260+\207" [#1=#:--cl---cl-oddp---- #2=#:--cl---cl-evenp---- #3=#:--cl---cl-opt---- #4=#:v #5=#:v #6=#:v nil #[(n) "\302\303\304 S]G \305\\^O\306\"!\207" [string n regexp-opt-charset append 0 2 nil] 7] #[(n) "\301\302\"\303=\207" [n logand 1 0] 3] #[(n) "\301\302\"\302=\207" [n logand 1] 3] "\\(" 0 "" "\\|" "\\)" i string #7=#:--cl-var-- c #8=#:--cl-var-- fuzzy-regexp-some-char #9=#:--cl-var-- #10=#:--cl-var--] 6])
(defalias 'fuzzy-edit-distance 'fuzzy-jaro-winkler-distance)
#@52 http://en.wikipedia.org/wiki/Jaro-Winkler_distance
(defalias 'fuzzy-jaro-winkler-distance #[(s1 s2) "G\nG\306 ]\307\245S]\310\211\310\311\211\312\311\"\310 \311W\203\250 H\310\fZ]\f\\^\311\313 \311!W\203\233 \nH\314\"\203\216 H\204\216 BI\210T\311\211!\211 \202\217 \313\203\233 T\211\202U !\210-T\211\202. \237\310\"\311\211#$\"W\203\334 H\211#\203\323 #$B$T\211\202\273 $\237,,%\311&\311%:\203\"%@&:\203\"&@\314\"\204T%A%&A&\202\361 ,\310\315^'(\316)\311\n*\316+\311'W\203\204)T\211)(GW\203\204()H+T\211+*GW\203\204*+H\314\"\203\204TT\211\202?.\310=\203\220\317\202\264\320!\321 \245\245\307\245Z\245#\322\245\211,\323\324\306,Z#\\).\207" [s1 l1 s2 l2 r m 1 2 0 nil make-vector t char-equal 5 -1 0.0 float + 3 * 0.1 tr p cs1 cs2 seen i #1=#:--cl-var-- c1 j #2=#:--cl-var-- c2 #3=#:--cl-var-- #4=#:--cl-var-- #5=#:--cl-var-- c #6=#:--cl-var-- #7=#:--cl-var-- #8=#:--cl-var-- #9=#:--cl-var-- #10=#:--cl-vec-- #11=#:--cl-idx-- #12=#:--cl-vec-- #13=#:--cl-idx-- dj] 7 (#$ . 1847)])
(byte-compile 'fuzzy-jaro-winkler-distance)
(defalias 'fuzzy-match #[(s1 s2 &optional function) "\204 \305\306 G\nGZ!X\205 \n\"\307\fZY\207" [function s1 s2 fuzzy-accept-length-difference fuzzy-accept-error-rate fuzzy-edit-distance abs 1] 3])
#@45 all-completions family with fuzzy matching.
(defalias 'fuzzy-all-completions #[(string collection) "G\n\306\211\306 :\2033 @\211\307\fG \n\\^O\310\"\203, \f B A\211\202 \237-\207" [string length collection #1=#:--cl-var-- str s nil 0 fuzzy-match #2=#:--cl-var-- fuzzy-accept-length-difference] 6 (#$ . 3296)])
(defvar fuzzy-search-cache nil)
(defvar fuzzy-search-cache-string nil)
(defalias 'fuzzy-search-cache-activate #[nil "\302 \303\211\207" [fuzzy-search-cache fuzzy-search-cache-string make-hash-table nil] 2])
(defalias 'fuzzy-search-cache-deactive #[nil "\302\211\211\207" [fuzzy-search-cache fuzzy-search-cache-string nil] 3])
(defalias 'fuzzy-search-edit-distance #[(s1 s2) "\203# \204 \n\202# \n\232\204 \n\305!\210\202# \306\"\2064 \307\n\"\2032 \310\f#\210\f)\207" [fuzzy-search-cache fuzzy-search-cache-string s1 s2 d clrhash gethash fuzzy-edit-distance puthash] 4])
(defalias 'fuzzy-search-match #[(s1 s2) "\302 \303#\207" [s1 s2 fuzzy-match fuzzy-search-edit-distance] 4])
(defalias 'fuzzy-search-forward #[(string &optional bound noerror count) "\304!\305\212\n\204+ \306 \307#\203+ \310\311\312!\"\203# \302 \211\202 \312\224Tb\210\202 )\n\2057 \313\n!\210\312\225b*\207" [string regexp match-data bound fuzzy-regexp-compile nil re-search-forward t fuzzy-search-match match-string 1 store-match-data] 5])
(defalias 'fuzzy-search-backward #[(string &optional bound noerror count) "\306!\307\211\307\212\n\204T \310 \311#\203T \312\224\312\225\313\307!\210eG\314_Z]b\210\315 \f\311#\203J \316\317\312!\"\203B \302 \202+ \312\224Tb\210\202+ \n\204 b\210\202 \n\203b \313\n!\210\312\224b\202e \313\307!-\207" [string regexp match-data begin end bound fuzzy-regexp-compile nil re-search-backward t 1 store-match-data 2 re-search-forward fuzzy-search-match match-string] 5])
(defvar fuzzy-isearch nil)
(defvar fuzzy-isearch-failed-count 0)
(defvar fuzzy-isearch-enabled 'on-failed)
(defvar fuzzy-isearch-original-search-fun nil)
(defvar fuzzy-isearch-prefix "[FUZZY] ")
(defalias 'fuzzy-isearch-activate #[nil "\302\303\304 \207" [fuzzy-isearch fuzzy-isearch-failed-count t 0 fuzzy-search-cache-activate] 1])
(defalias 'fuzzy-isearch-deactivate #[nil "\302\303\304 \207" [fuzzy-isearch fuzzy-isearch-failed-count nil 0 fuzzy-search-cache-deactive] 1])
(defalias 'fuzzy-isearch #[nil "\203\f \203\n \306\207\307\207\n\203 \203 \310\207\311\207\204<