I wrote a simple algorithm for predictive text that uses preceding words as context. Without looking at prior, it was an attempt as seeing what I could come up with.
The goal is for it to be incorporated in chorded input and pick the best candidate for the entered chord with the given context. Chorded input is the method of hitting all keys for a word simultaneously instead of hitting each key individually in expected order.
E.g youâve typed âthis is the worstâ and hit the chord âaetâ, which word should be chosen? ate? tea? eta? This algorithm is there to answer that.
What Iâm looking for in the code review in order of importance:
- documentation (is it understandable? are there things missing? â¦)
- code architecture, code structure (function should be a member? composition could be changed? clarity, â¦)
- algorithm review (optimisations, improvements)
- variable and class names (naming things is hard)
- rust specific stuff (f64 instead of u32 maybe? dyn vs impl? â¦)
The code is linted and automatically formatted.
Cool! Iâve given two cents about the code, apologize if thereâs I said anything, I didnât mean it. English isnât my first language.
Thank you! I implemented some of the feedback (havenât pushed yet) and responded to the comments. Learned something ð


