[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #49375] pkg name similarity measurement is off
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #49375] pkg name similarity measurement is off / too simplistic |
Date: |
Mon, 17 Oct 2016 21:39:30 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 |
Follow-up Comment #2, bug #49375 (project octave):
See the end of scripts/pkg/private/get_forge_pkg.m. I'm pretty sure I wrote
it and it is pretty dumb.
## Try a simplistic method to determine similar names.
function d = fdist (x)
len1 = length (name);
len2 = length (x);
if (len1 <= len2)
d = sum (abs (name(1:len1) - x(1:len1))) + sum (x(len1+1:end));
else
d = sum (abs (name(1:len2) - x(1:len2))) + sum (name(len2+1:end));
endif
endfunction
dist = cellfun ("fdist", t);
[~, i] = min (dist);
error ("get_forge_pkg: package not found: ""%s"". Maybe you meant
""%s?""",
name, t{i});
Additional characters add a cost penalty assuming a reference of 0. This can
easily overwhelm distances in the first half of the calculation.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?49375>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/