emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new-flex-completion-style


From: João Távora
Subject: Re: new-flex-completion-style
Date: Thu, 14 Feb 2019 14:59:59 +0000

On Thu, Feb 14, 2019 at 1:55 PM João Távora <address@hidden> wrote:
>
> On Thu, Feb 14, 2019 at 1:36 PM Stefan Monnier <address@hidden> wrote:
> >
> > > I don't think it's odd.  I call the former "scattered match"
> > > and the latter a "tighter match".
> >
> > Don't you find it odd that "foo" gives a better score to
> > "fotttttttttttttttto" than to "foto" ?
>
> Perhaps.  But as it stands it doesn't make sense to
> compare scores across different length strings.
>
> It does make sense to compare the score between
> foo's matches of foot and foto.
>
> > [ Given them the same score sounds acceptable, tho.  ]
>
> Feel free to add some kind of normalization to the function
> if you can come up with it.  Or come up with another function
> entirely.  As I said, a function that measures the distance
> in "boring editing operations" between the pattern and the target
> would be a nicer measure.

I've been experimenting with a simpler function that just counts the
number of "holes" and the length of those holes separately
in the denominator. The numerator is the same and a perfect
match is still a 1. It seems to fare better for your cases. For foo

Eventually we could weight the number and length
of holes differently so we can get this:

score(foo,barfoobaz) > score(foo,fabrobazo) >
score(foo,fotttttttttttttttttttttto)

Which would be nicer, I think.

João



reply via email to

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