bugGNU Octave - Bugs: bug #46881, provide hints for possible...

 
 

bug #46881: provide hints for possible misspelled symbol names

Submitter:  None
Submitted:  Tue 12 Jan 2016 05:37:23 PM UTC
   
 
Category:  Interpreter Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Patch Submitted Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 24 Jan 2023 08:18:55 PM UTC, comment #14: 

As some links are getting stale, the patch can now also be found at patch #10287

Sadly it has not yet been refreshed to consider for inclusion. :(

Nicholas Jankowski <nrjank>
Group Member
Wed 11 Nov 2020 01:40:40 AM UTC, comment #13: 

Found this one again after reading Discourse https://octave.discourse.group/t/please-add-closing-parenthesis/386

A patch has been submitted 2018 by Sudeepam to GitHub:

https://github.com/Sudeepam97/Correction_suggestion

Sorry, that it has not been applied yet.  Despite the patch needs a freshening up (it does not apply cleanly to the default branch) are there any reasons not to apply it for Octave 7?

Kai Torben Ohlhus <siko1056>
Group Member
Mon 26 Mar 2018 10:13:58 AM UTC, comment #12: 

Yes, Shane here, has been extremely helpful and the data he has shared with me will be essential for the development of this feature. I was thinking of a Neural Network based approach.

I have explained my idea here: https://wiki.octave.org/User:Sudeepam#Project_Description

This link also links to a demo implementation that I have made. I am excited to discuss the idea. Suggestions will be appreciated.

P Sudeepam <sudeepam>
Mon 26 Mar 2018 09:11:47 AM UTC, comment #11: 

Hi everyone,

This is Shane here from Octave Online.  I shared with Sudeepam a number of Octave Online sessions from late 2017 that shows the command a user entered, the error message, and the command that the user followed up with.  Here are some examples:

==========
cmd: Sqrt(4)
err: error: 'Sqrt' undefined near line 1 column 1
err:
cmd: sqrt(4)
==========
cmd: grod
err: error: 'grod' undefined near line 1 column 1
err:
cmd: grid
==========
cmd: titel('m');
err: error: 'titel' undefined near line 1 column 1
err:
cmd: title('m');
==========
cmd: lc
err: error: 'lc' undefined near line 1 column 1
err:
cmd: clc
==========

Based on looking through many of these sessions, the many various different ways of spelling "clc" seem to top the list for the most often misspelled token.

Shane <octaveonline>
Thu 01 Mar 2018 04:43:27 PM UTC, comment #10: 

Has a decision about mentor been made yet? Things like the definition of 'close' would need some discussions... or will it be preferred that such discussions take place only 'after' a proposal regarding this issue gets selected?

P Sudeepam <sudeepam>
Thu 22 Feb 2018 06:08:29 PM UTC, comment #9: 

I got some really cool idea.
As soon as some mentor will be decided I will start working for this.Please do this quick.

Dildar Sk <hodor123456>
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

Nicholas Jankowski <nrjank>
Group Member
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.

Nicholas Jankowski <nrjank>
Group Member
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


>> intep
Undefined function or variable 'intep'.

Did you mean:
>> interp



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?

Lachlan Andrew <lachlan>
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?

Nicholas Jankowski <nrjank>
Group Member
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.

Max Görner <maxg>
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?)

Lachlan Andrew <lachlan>
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.

John W. Eaton <jwe>
Group administrator
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.

Anonymous
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:

+verbatim+'rgb2grey' undefined. Did you mean 'rgb2gray' (U.S. spelling)?-verbatim-

instead of:

+verbatim+error: 'rgb2grey' undefined near line 1 column 11-verbatim-


R treats the two as synonyms, but obviously that would harm Matlab compatibility in a way a helpful error message wouldn't. Something similar for color/colour function names might also be desirable.

The example is from the "image" package, but applicability is not restricted to that package.

Thank you.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   patch dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by octaveonline (Posted a comment)
  • -email is unavailable- added by sudeepam (Posted a comment)
  • -email is unavailable- added by hodor123456 (Posted a comment)
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by maxg (Posted a comment)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-24 nrjank Dependencies- Depends on patch #10287
    2020-11-11 siko1056 CategoryOctave Function Interpreter
    2020-11-11 siko1056 StatusNone Patch Submitted
    2017-08-13 jwe CategoryOctave Package Octave Function
        Summarygrey/gray provide hints for possible misspelled symbol names
    2016-02-18 lachlan Severity3 - Normal 1 - Wish
        Priority5 - Normal 3 - Low
        Release4.0.0 dev

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code