git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: "Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>
Cc: git@vger.kernel.org
Subject: Re: [RFC/PATCH] Reduce cost of deletion in levenstein distance (4 -> 3)
Date: Thu, 24 May 2012 22:33:32 +0200	[thread overview]
Message-ID: <vpq62blwc83.fsf@bauges.imag.fr> (raw)
In-Reply-To: <4F9A6A4E.2070808@in.waw.pl> ("Zbigniew \=\?utf-8\?Q\?J\=C4\=99drze\?\= \=\?utf-8\?Q\?jewski-Szmek\=22's\?\= message of "Fri, 27 Apr 2012 11:43:42 +0200")

[ Sorry for the looong delay ]

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> On 04/27/2012 10:58 AM, Matthieu Moy wrote:
>> Before this patch, a character deletion has the same cost as 2 swaps, or
>> 4 additions, so Git prefers suggesting a completely scrambled command
>> name to removing a character. For example, "git tags" suggests "stage",
>> but not "tag".
>> 
>> By setting the deletion cost to 3, we keep it higher than swaps or
>> additions, but prefer 1 deletion to 2 swaps. "git tags" now suggests
>> "tag" in addition to staged.
>
> Hi,
> looks sensible, but I wonder if the algorithm shouldn't be tweaked even
> further. I understand why 'tags' and 'stage' are similar,
> but if I say 'tagz', git proposes (with your change), both 'stage' and
> 'tag'. 'tag' is one deletion away, but 'stage' requires a deletion and a
> replacement, so should loose to 'tag', I think.

First, my patch is also an improvement here since it allows showing tags
(previously, it showed only stage). The idea for showing stage before
tag is that the cost of deletion is greater than the cost of insertion,
which corresponds to the hypothesis that it's more common to miss one
character when typing than typing too many. That's probably subjective,
but I think it makes sense.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

      reply	other threads:[~2012-05-24 20:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-27  8:58 [RFC/PATCH] Reduce cost of deletion in levenstein distance (4 -> 3) Matthieu Moy
2012-04-27  9:43 ` Zbigniew Jędrzejewski-Szmek
2012-05-24 20:33   ` Matthieu Moy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpq62blwc83.fsf@bauges.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=zbyszek@in.waw.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).