|
From: | Le Wang |
Subject: | Re: Emacs needs truely useful flex matching |
Date: | Mon, 15 Apr 2013 00:48:21 +0800 |
On Fri, Mar 22, 2013 at 7:58 AM, Stefan MonnierI hadn't thought of this, and I'll try it soon.
<address@hidden> wrote:
>>> The sorting algorithm is roughly this for a query: "abcd"
>>>
>>> 1. Get all matches for "a.*b.*c.*c"
>>> 2. Calculate score of each match
>>> - contiguous matched chars gets a boost
>>> - matches at word and camelCase boundaries (abbreviation) get a boost
>>> - matches with smallest starting index gets a boost
>>> 2. Sort list according to score.
>
> I think that if you turn "abcd" into a regexp of the form
> "\\(\\<\\)?a\\([^b]*\\)\\(\\<\\)?b\\([^c]*\\)\\(\\<\\)?c\\([^d]*\\)\\(\\<\\)?d"
> the regexp matching should be fairly efficient and you should be able to
> compute the score efficiently as well (at least if
> you ignore the camelCase boundaries).
[Prev in Thread] | Current Thread | [Next in Thread] |