LEVEL 1 · STARTER

Vocabulary Autocomplete Pad

Help a writer reuse their own terminology with a small local autocomplete model built from token counts, prefixes and short word histories. Show the evidence behind each suggestion and export an interactive writing pad plus a portable vocabulary model for another editor.

4 stages~8 hoursTypeScriptcore
YOU END UP WITH

A local autocomplete writing page and vocabulary-model.json

WHY THESE LANGUAGES
  • TypeScript Typed local transformations and portable browser interfaces run with Node standard libraries.
PROJECT OUTLINE

Vocabulary Autocomplete Pad in 4 stages

Build suggestions that explain which words they learned from.

  1. Tokenize a corpus and count word histories

    tokenize(text: string): string[]; train(corpus: unknown): Model

    starter · ~2 hours · TypeScript

    Tokenize a corpus and count word histories
  2. Rank prefix and next-word candidates

    suggest(model: Model, prefix: string, history?: string[], limit?: number): Suggestion[]

    core · ~2 hours · TypeScript

    Rank prefix and next-word candidates
  3. Accept suggestions in a writing pad

    completeText(model: Model, text: string, limit?: number): {prefix:string;history:string[];suggestions:Suggestion[]}; acceptSuggestion(text:string,prefix:string,word:string):string

    core · ~2 hours · TypeScript

    Accept suggestions in a writing pad
  4. Export the learned model and editor function

    importModel(value: unknown): Model; renderPad(model: Model, initial?: string): string

    stretch · ~2 hours · TypeScript

    Export the learned model and editor function

All projects · Course catalog · Source on GitHub