emacs-elpa-diffs
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]