[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx 0519734c5b 030/182: consider runs of capitals to be sa
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx 0519734c5b 030/182: consider runs of capitals to be same word |
Date: |
Tue, 13 Dec 2022 03:59:22 -0500 (EST) |
branch: elpa/flx
commit 0519734c5bb7dc93a3cb37ec08740468722dc915
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
consider runs of capitals to be same word
#8
---
flx.el | 5 +++--
tests/flx-test.el | 53 +++++++++++++++++++++++++++++++++--------------------
2 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/flx.el b/flx.el
index cda9c04a8e..3b5cb08337 100644
--- a/flx.el
+++ b/flx.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 11
+;; Update #: 12
;; URL:
;; Keywords:
;; Compatibility:
@@ -100,7 +100,8 @@
(<= ?A char))))
(defsubst flx-is-boundary (last-char char)
- (or (flx-is-capital char)
+ (or (and (not (flx-is-capital last-char))
+ (flx-is-capital char))
(null last-char)
(and (not (flx-is-word last-char))
(flx-is-word char))))
diff --git a/tests/flx-test.el b/tests/flx-test.el
index ec03f0ceba..23d8f12960 100644
--- a/tests/flx-test.el
+++ b/tests/flx-test.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 7
+;; Update #: 9
;; URL:
;; Keywords:
;; Compatibility:
@@ -191,21 +191,6 @@
(lower (flx-score "ab" query (flx-make-filename-cache))))
(should (> (car higher) (car lower)))))
-(ert-deftest flx-entire-match-3 ()
- "when entire string is match, it shoud overpower acronym matches"
- (let* ((query "rss")
- (higher (flx-score "rss" query (flx-make-filename-cache)))
- (lower (flx-score "rff-sff-sff" query (flx-make-filename-cache))))
- (should (> (car higher) (car lower)))))
-
-(ert-deftest flx-entire-match-5 ()
- "when entire string is match, 4 letters is the cutoff when
-substring can overpower abbreviation."
- (let* ((query "rssss")
- (higher (flx-score "rssss" query (flx-make-filename-cache)))
- (lower (flx-score "rff-sff-sff-sff-sff" query
(flx-make-filename-cache))))
- (should (> (car higher) (car lower)))))
-
;;;;;;;;;;;;;;
;; advanced ;;
;;;;;;;;;;;;;;
@@ -335,18 +320,46 @@ In this case, the match with more contiguous characters
is better."
(ert-deftest
flx-imported-provides-intuitive-results-for-d-and-doc/command-t.txt ()
(let ((query "d"))
- (let ((higher (flx-score "TODO" query (flx-make-filename-cache)))
- (lower (flx-score "doc/command-t.txt" query
(flx-make-filename-cache))))
+ (let ((lower (flx-score "TODO" query (flx-make-filename-cache)))
+ (higher (flx-score "doc/command-t.txt" query
(flx-make-filename-cache))))
(should (> (car higher) (car lower))))))
(ert-deftest
flx-imported-provides-intuitive-results-for-do-and-doc/command-t.txt ()
(let ((query "do"))
;; This test is flipped around, because we consider capitals to always be
;; word starters, and we very heavily favor basepath matches.
- (let ((higher (flx-score "TODO" query (flx-make-filename-cache)))
- (lower (flx-score "doc/command-t.txt" query
(flx-make-filename-cache))))
+ (let ((higher (flx-score "doc/command-t.txt" query
(flx-make-filename-cache)))
+ (lower (flx-score "TODO" query (flx-make-filename-cache))))
(should (> (car higher) (car lower))))))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; new features (not in ST2) ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(ert-deftest flx-entire-match-3 ()
+ "when entire string is match, it shoud overpower acronym matches"
+ (let* ((query "rss")
+ (higher (flx-score "rss" query (flx-make-filename-cache)))
+ (lower (flx-score "rff-sff-sff" query (flx-make-filename-cache))))
+ (should (> (car higher) (car lower)))))
+
+(ert-deftest flx-entire-match-5 ()
+ "when entire string is match, 4 letters is the cutoff when
+substring can overpower abbreviation."
+ (let* ((query "rssss")
+ (higher (flx-score "rssss" query (flx-make-filename-cache)))
+ (lower (flx-score "rff-sff-sff-sff-sff" query
(flx-make-filename-cache))))
+ (should (> (car higher) (car lower)))))
+
+(ert-deftest flx-capital-runs ()
+ "Runs of capital letters should be considered one word."
+ (let* ((query "ab")
+ (score1 (flx-score "AFFB" query (flx-make-filename-cache)))
+ (score2 (flx-score "affb" query (flx-make-filename-cache))))
+ (should (= (car score1) (car score2)))))
+
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; flx-test.el ends here
- [nongnu] elpa/flx d21ac098df 050/182: add option `flx-ido-use-faces', (continued)
- [nongnu] elpa/flx d21ac098df 050/182: add option `flx-ido-use-faces', ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f9bd16221b 063/182: update large collection guidelines, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 27bc47899a 075/182: Merge pull request #37 from artagnon/make, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx abe1a77c02 081/182: Merge pull request #38 from artagnon/cl-lib, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9200e27309 083/182: use "flex" filtering when collection too large, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx c85273a6e8 009/182: fix helm demo typo, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 7110df04e2 005/182: update tests, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx fabca711e9 013/182: fix typo, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx dc739574ad 011/182: add helm demo without flx, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 955772f489 029/182: optimize full-match boost, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 0519734c5b 030/182: consider runs of capitals to be same word,
ELPA Syncer <=
- [nongnu] elpa/flx e80bc0dea4 018/182: more ido optimizations, refactor out flx-propertize, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a31814e5ef 031/182: update README to say alpha, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 5ab18c3101 024/182: fix over manipulation of strings, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx fd10bf595d 025/182: fix typo, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx af1010e4ad 035/182: Reverting "fix `ido-merge-work-directories`", ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 11f3fad14f 041/182: get complete cache key more smartly, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx c6601c7162 022/182: readme update, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a13d654096 045/182: disable caching for files/dirs for now, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1f175f3c65 047/182: add comment about disabling ido faces, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 222f60d28e 055/182: Merge pull request #18 from jschaf/master, ELPA Syncer, 2022/12/13