I want to know if it can be done?

hello I’m thinking of getting a arduboy and I struggle with disabilities that affect my spelling and I was thinking about giving a shot at coding a spell corrector for the arduboy! I just want to know if this is even possible? Thanks

Possibly, but I’m not sure how you would type the characters without a keyboard.

You could connect the Arduboy to a computer to feed characters to it over a serial connection,
but that would sort of defeat the purpose of using the Arduboy because it would have to be connected to the computer to use the program.

You could use the keyboard logic from this program > ArduRemote - Virtual keyboard and mouse

However, how many words do you anticipate the program having embedded in it? The Arduboy has very little memory so it will not be able to store much of a dictionary.

Common English spoken words not all the dictionary

By the time you get a basic program running that allows you to type in the word, you might have around 8 to 10K left. Assuming you words are on average 6 characters long plus an end of word marker, you will get around 1,100 to 1,400 words into the system. Is that enough?

You could look at some compression to increase the word count but that would take a bit more effort but might increase the word count to 2,000 words if done well.

The performance of the system would also be interesting - the ability to scan for words where letters are transposed or common mis-spellings anticipated might take a chunk of code. A better way to tackle this might be to get the user to type a number of letters and have the system prompt with words starting with those letters.

If the words are restricted to 26 letters (no capitals, maybe a hyphen) then theoretically you can pack 3 characters into 2 bytes (5 bits per character), which should easily increase the 1,100-1,400 to ~2000 in a very cheap and relatively beginner friendly way.

Using huffman coding on top of that might manage something better,
but that’s not exactly beginner friendly.

I can think of a few other things, but this is starting to creep into the realm of abstract nonsense and mathematics…

Agreed, that would only require the words being stored as a sorted list that can be indexed.

If performance is an issue then it would be possible to do e.g. 100 increment+tests per frame and render a ‘loading’ icon in the mean time.

No not really. As you say later, a sorted linked list would be better.

Not really as you still need the pointers between ‘words’ or an ‘end of word’ maker. Packing 3 characters into 2 bytes is really only possible when you are rendering sentences and a ‘stop’ character is not an expensive overhead.

A list, but not a linked list. Linked lists are memory hungry and somewhat inefficient.

A better approach would be to have 26 pointers (assuming zebra and xylophone are in the corpus) that point to the start of
the letter sections.

E.g.

struct Char3 { uint16_t data; }

const Char3 words[] PROGMEM { ... };

const Char3 * const index[26] PROGMEM
{
  &words[/*index of first 'a' word*/],
  &words[/* index of first 'b' word*/],
};

Maybe even a pointer and a length to specify a range.
Probably only worth doing for the top level.

You can just use the left over bit to mark the end of the word.
The last triple of a word gets the ‘high bit’ set to mark the word end.

Say for example 0 is ‘null character’, 1-26 is a-z,
‘marimba’ would be pack(13, 1, 18), pack(9, 13, 2), packLast(2, 1, 0),
where pack packs three characters into a Char3/uint16_t,
and packLast does the same but sets the high bit to indicate the word end.

It’s like having a null-terminated string, but the null is fused into the last character.

That would work too.

A demo, just for the sake of proof:

1 Like

Nicely done!

1 Like

Even it’s can be done, to be honest, some raspberry with google voice and mini keyboard will be biger more expensive but alot more able to do the job (and probably better).
Of course, it’s can be a challenge to do it on Arduboy, but the goal is maybe to stock expression and be able to translate them in addition of words… So you will need a least an extension cardbridge, i think to be able to use it (you could make a special cardbridge then and maybe add a keyboard to to gain time when you enter words. Some have make arduboy comptabiles in cases of words game (somethink looking like blackberry). If yo ucan add an external memory in like the cardbridge system, it’s could be a great hardware to do it)

1 Like

Thanks for the help guys I just wish that arduboy had more memory maybe the arduboy 2.0 or 2.5? fingers crossed

Even with more memory you’re still stuck with the problem of how to input text.

Something like a Pi Zero with a USB keyboard would be better suited to that sort of thing,
or just a regular laptop or desktop.

Come to think of it, you actually have to get the words from somewhere as well.