hedyorg / hedy

Hedy is a gradual programming language to teach children programming. Gradual languages use different language levels, where each level adds new concepts and syntactic complexity. At the end of the Hedy level sequence, kids master a subset of syntactically valid Python.
https://www.hedy.org
European Union Public License 1.2
1.29k stars 284 forks source link

Suggestion for misspelling commands prefers echo above ask command level-1 #162

Closed MarinusVanDijk closed 3 years ago

MarinusVanDijk commented 3 years ago

Nice error message when typing askquestion without space:

image

But then when typing askechoquestion without space:

image

Error message suggestion preference is the command echo.

I expect a suggestion for the ask command, because the command line starts with ask command?

And perhaps also give a suggestion for the echo command?

Felienne commented 3 years ago

We now give suggestions by a very simple string distance algorithm, see https://github.com/Felienne/hedy/blob/master/hedy.py lines 9-32.

For now it is fine I think, the goal is to be better than "command not found"

But if you are interested to improve it, as the comment also says "could be more sophisticated MACHINE LEARNING!" :)

Feel free to improve!

MarinusVanDijk commented 3 years ago

Here is my improvement (I do not have access to make branches).

We can in future introduce a phonetic compare function.

In that case spelling errors children make can be better dealt with.

image