Comments (3)
How about storing it as a trie or Radix Tree
from toipe.
@Samyak2 I think my suggestion is a little wrong, even though a trie or radix tree might be faster in computation of the random word(not entirely sure of this), If im not wrong, what you want to do is find a way to store the word lists by reducing the size of the file
Taking inspiration from the trie maybe you could store words in the following fashion
where the number represents the number of letters taken from the 0th word and the letters represent the letters to be added
A example taken from below would be <5,t> which amounts to applet by taking the first 5 letters from apple
Note:- // is used a comment
0, apple
5, t // applet
3, ear //appear
0, ball
3, d //bald
...
...
Now one drawback in storing it this way would be the extra computation of finding the most recent '0'th word in the series, though it might be that heavy it would be nice to avoid it altogether. A variation of the above in storing it could be
0, 0, apple
5, 1, t
3, 2, ear
0, 0, ball
3, 1, d
Where the second integer represents number of steps to the 0th word
And as for random words in tries this might help
from toipe.
How about storing it as a trie or Radix Tree
@lucasace that's a good way to compress the data. Although, I'm not sure if it will help in selecting random words in a uniform manner from the list. Do you have any ideas about implementing that in a trie or a radix tree?
from toipe.
Related Issues (20)
- not working with cusotm words list HOT 1
- Add shortcut to delete previous words and show statistics of previous typing tests HOT 1
- Problem with custom word list HOT 3
- Add support for phrases and code HOT 1
- Setup cache in CI
- 0.0 wpm HOT 1
- Extra space at the end of certain tests
- Words starting with z are most likely ignored HOT 2
- [enhancement] Resetting the cursor HOT 2
- Use charmbracelet/vhs to auto-generate demo image
- Handle terminal resize gracefully
- ctrl+h to backspace HOT 2
- C-w can't delete space
- Add support for custom books HOT 4
- Build failed from Cargo HOT 2
- I'm missing OS wordlist from install HOT 3
- Add support for punctuation HOT 1
- Add support for long words HOT 1
- Fix release workflow and add MacOS ARM binaries
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toipe.