Share your repls and programming experiences

← Back to all posts
Text Prediction in JavaScript
davwheat (23)

This is just a small but cool project I made in HTML and JavaScript.

It loads a file on load using AJAX, then as the user types into a text input, it searches the text file for the first word that starts with what the user is typing.

For example, if you started typing 'ele', it might find 'electricity' or 'elephant'.

I am planning to make this project reorder the list as people type what they ACTUALLY wanted and also take context into account.

An example of context would be:
In India and Africa, there are many ele_.
Instead of selecting electricity, it would suggest elephants instead.

If you wanna have a chat about this, contact me on Discord (@MrJeeves#6969). I'm also on the Discord too, as 'davwheat':

slip1244 (256)

i would much rather use this than my phone's autocorrect

timmy_i_chen (1153)

Super cool! Do subsequent words take into account the words before them?

davwheat (23)

@timmy_i_chen Not at the moment, no, but I want to add it in the future :)

davwheat (23)

@timmy_i_chen I just added some idioms like 'so far so good', etc. so I now know how to implement the context (subsequent words)