[Haskell-cafe] google-like "do you mean?" feature
Max Bolingbroke
batterseapower at hotmail.com
Thu Apr 16 03:08:11 EDT 2009
2009/4/16 Michael Mossey <mpm at alumni.caltech.edu>:
> I don't think I would create a parser language that includes every variant,
> but instead the field names would be tokens that could be passed to another
> routine.
Right.
> The variants could be generated ahead of time. I would limit the
> number of variants to something manageable, like 10,000 for each field name.
Generating variants ahead of time isn't necessary. Instead, you could
just look at the edit distance between the token you get and each
possible valid field name using something like
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/edit-distance.
The token with the least edit distance is the one you should suggest.
Cheers,
Max
More information about the Haskell-Cafe
mailing list