continuous frecency

a curve that seems to fit original behavior pretty closely.

h/t @dcervenkov
This commit is contained in:
rupa committed 2019-10-24 01:49:52 -04:00
1 parent dcd5541e7d
commit 4f08e7febb
1 file changed
+3 -6
+3 -6
View File
@@ -140,12 +140,9 @@ _z() {
local cd
cd="$( < <( _z_dirs ) awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
function frecent(rank, time) {
# relate frequency and time
dx = t - time
if( dx < 3600 ) return rank * 4
if( dx < 86400 ) return rank * 2
if( dx < 604800 ) return rank / 2
return rank / 4
# relate frequency and time
dx = t - time
return rank * (3.75/((0.0001 * dx + 1) + 0.25))
}
function output(matches, best_match, common) {
# list or return the desired directory