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

 
 

bug #46881: provide hints for possible misspelled symbol names

Submitted by:  None
Submitted on:  Tue 12 Jan 2016 05:37:23 PM UTC  
 
Category:  Octave Function Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  dev
Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

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

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-13 jwe CategoryOctave Forge 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.5