shithub: patch

Download patch

ref: 56dc18887a7df44e90ceea06adb55475cb508593
parent: 70d650eb94605d73027a80a37c94362f635dc98a
author: qwx <qwx@sciops.net>
date: Sun May 8 12:13:47 EDT 2022

add fm-tweaks: fm(1) fuzzy matching adjustments

this is the wrong algorithm for this.

--- /dev/null
+++ b/fm-tweaks
@@ -1,0 +1,26 @@
+diff 1582b3f523dd18147b2c32003584b990b6e58bfe uncommitted
+--- a/fm.c
++++ b/fm.c
+@@ -10,6 +10,7 @@
+ 	Reclimit = 10,
+ 
+ 	/* score modifiers */
++/*
+ 	Bseq = 15,
+ 	Bsep = 30,
+ 	Bcamel = 30,
+@@ -17,6 +18,14 @@
+ 	Plead = -5,
+ 	Pmaxlead = -15,
+ 	Punmatched = -1,
++*/
++	Bseq = 1, // bonus for adjacent matches
++	Bsep = 0, // bonus if match occurs after a separator
++	Bcamel = 0, // bonus if match is uppercase and prev is lower
++	Bfirst = 1, // bonus if the first letter is matched
++	Plead = 0, // penalty applied for every letter in str before the first
++	Pmaxlead = -100, // maximum penalty for leading letters
++	Punmatched = -1, // penalty for every letter that doesn't matter
+ };
+ 
+ int