mykeels.com

A pseudo-generic text->phonics model in JavaScript

What if I could type an entire story and have it automatically converted into my bespoke phonetic-text syntax with decent accuracy?

A pseudo-generic text->phonics model in JavaScript

What if I could type an entire story and have it automatically converted into my bespoke phonetic-text syntax with decent accuracy?

This was the question I set out to answer. I'd been hand-crafting the phonetic-text syntax for stories at Under4.Games and I wondered if I could automate the process.

Machine Learning vs. Hand-Written Code

At first I wondered I could use an Machine Learning model to do this, but Machine Learning is not my forte and while I may still explore this in the future, I decided to use a more traditional approach with hand-written JavaScript code because:

  • the system is not expected to be perfect
  • under4.games is built for toddlers and preschoolers, so I don't expect complex words
  • I had LLMs to write the bulk of the phonetic mapping code for me, so why not?

The Prototype

After spending about an hour discussing with an LLM, I had a working prototype.

I could test it with words and sentences, see the output, tweak it, and run it again. I began using it to convert stories into phonetic-text syntax.

In the prototype,

  • I can write the text on the left, and see the phonetic-text syntax on the right.
  • I can click on each character to hear their phonetic sound.
  • I can also click on "Sentence" to read out the current line, or click on "Story" to read out the entire story.

Here are some more stories you can copy and paste into the input field above:

A big red duck sat on a big rock. I am a big fish in a little pond I come from alabama with a banjo on my knee

I hope you play with this and find this useful.

PS: If you find a word under 8 characters that is not converted to the correct phonetic-text syntax, please let me know in the comments below.

Do you have a toddler or preschooler who is learning to read? Check out Under4.games for more reading activities.

Related Articles

Tags