Menu

#37 Din you mean...

v0.3
open
nobody
Core (10)
5
2012-08-16
2009-07-24
No

When an illegal option is found, CLOS should recognize possible typos and get the user a list of options he likely mean.

Discussion

  • Mikolas Janota

    Mikolas Janota - 2009-07-24

    that sounds quite similar to the TAB completion problem, if you know which strings can appear at some position, you can pick the one with smallest edit distance

     
  • Nobody/Anonymous

    Apache commons lang has an implementation of Levenshtein Distance that could be used. See org.apache.commons.lang.StringUtils.getLevenshteinDistance(String,String)->int.

    There's more to it though than just looking at what can appear at a position. We get an unknown option also when a user uses a genuine option somewhere in the format that it cannot appear.

    Due to the new error reporting system it might make sense for UnknownOptionError to carry an optional payload of information. Even without suggesting via edit distance we should be able to differentiate between when a real option is used in the wrong place and when an unknown option is used.

     
  • Radu GRIGORE

    Radu GRIGORE - 2009-07-27

    Levenshtein Distance is not quite what you want in a spell-checker. Luckily, it's really easy to implement a spell-checker:
    http://norvig.com/spell-correct.html

     
  • Fintan

    Fintan - 2009-08-19

    An article discussing the recently added behaviour for the command-not-found hook in bash for ubuntu.

    http://webupd8.blogspot.com/2009/08/command-not-found-becomes-more-useful.html

    It might be worth checking the implementation for this, how they go from a list of potential commands and the users input to suggestions of what they might have meant.

     
  • Radu GRIGORE

    Radu GRIGORE - 2009-08-22

    command-not-found has a gdbm database that maps commands to lists of packages. Now they added the spell checking code from Peter Norvig (to which I linked before).

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB