Thu 03 Mar 2016 03:08:33 PM UTC, comment #8:
Realized I never got a project suggestion posted to the GSOC wiki. Just added one now. Could use some points filled in such as Minimum Requiremets, mentor, etc.
http://wiki.octave.org/Summer_of_Code_Project_Ideas#Command_line_suggestion_feature
|
Thu 18 Feb 2016 03:09:19 AM UTC, comment #7:
Haven't written one up or even seen one before, but I can take a look at it thus weekend. Assuming there are models on the gsoc wiki page. If not point me in the right direction. As far as mentoring if simeone picks it up though, would probably need someone who knows more of the back end of the interpreter/GUI.
|
Thu 18 Feb 2016 02:59:52 AM UTC, comment #6:
Nicholas, you absolutely right that this type of "user experience" issue is where Octave can really be better than Matlab. For those of us who need to write Matlab-compatible code, this is much more important than incompatible language extensions (even though things like += are amazingly useful).
Matlab (R2013b) doesn't use a lookup table for this. It recognizes when I mistype a long variable. It seems to check for matches against variables that are at least four characters, even if I only type three.
Regarding "interp", I get
I like the fact that only ENTER is required to execute the suggested command. In the GUI, it would be possible to have a pop-up with multiple options, so that again only ENTER is required to select the "most likely" one, whatever that means.
GOSC is a good idea. Do you have the time to write a project specification for it?
|
Wed 17 Feb 2016 03:52:04 PM UTC, comment #5:
i was curious. a few trials did not produce the 'did you mean' response until the command had >=5 characters. Arcsin(1) did suggest asin(1),but arcsec(1) didn't suggest asec(1).
Regarding multiple possibilities, various misspellings of interp, interp1, interp2, interpn, etc., failed to invoke the 'did you mean'.
so I'm guessing there's just a lookup table involved with frequent misspellings. (maybe matlab logs and reports back such things?). But, this is one of those areas where Octave isn't bounded by Matlab behavior, so it could be an interesting area for improvement.
For how to handle things, Matlab immediately places the suggested command on the interpreter line, such that you hit enter and it executes. So that precludes multiple options. I guess you could try presenting the options in a bash tab-completion sort of way (a la the show-all-if-ambiguous option)
This could quickly get quite involved. Maybe it should go on a GSOC project suggestion?
|
Mon 18 Jan 2016 01:20:51 PM UTC, comment #4:
It was asked, what types of "close" should be included.
I think, the Levenstein distance (editdistance as Octave function) is what is needed here. One then could sort all possible suggestions by their Levenstein distance and ommit the suggestions having a to big distance.
Obviously, the 4 points by Lachlan Andrew would be Levenstein with a maximal distance of 1.
|
Thu 14 Jan 2016 04:19:59 AM UTC, comment #3:
Yes, I have been thinking that it would be nice to have something like Matlab's "Did you mean" prompts.
What types of "close" should be included? Possibilities are:
1. one-letter substitution (including digits and underline)
2. one-letter addition
3. one-letter deletion
4. transposition of adjacent letters
We should probably not do this for very short identifiers. Would 4 characters be a suitable minimum?
I assume the reference list would be the list of ~2000 returned by pressing "<TAB>" at the start of a word. Unfortunately, preprocessing couldn't be cached, because that list contains the variables in the current scope, but this is in the slow path anyway.
What should we do if there is more than one replacement? The enthusiastic option would be to prioritise "likely" ones (such as ...our->...or/...ise->...ize, adjacent on the keyboard, vowel-to-vowel replacement). Alternative approaches would be to list all of them, suggest the first one found, or do nothing.
(Although I think this is a great idea, could someone please reduce the severity and priority of this bug?)
|
Tue 12 Jan 2016 06:54:20 PM UTC, comment #2:
We should not make synonyms, but it is OK to suggest function names that might have been intended.
However, instead of doing this for a specific fixed list of words, it seems to me that it would be better to change the function that handles the undefined symbol error to look for possible existing symbols (variables or functions) that are "close" in spelling.
|
Tue 12 Jan 2016 05:42:45 PM UTC, comment #1:
Example: error: 'rgb2grey' undefined near line 1 column 1. Did you mean 'rgb2gray' (U.S. spelling)?
instead of:
error: 'rgb2grey' undefined near line 1 column 1
R treats the two as synonyms, but obviously that would harm Matlab compatibility. Color/colour might also be useful.
The example is from the "image" package, but applicability is wider.
|
Tue 12 Jan 2016 05:37:23 PM UTC, original submission:
Could Octave possibly provide a specific error message when the word "grey" is used instead of "gray" in a function name?
Example:
|