Close the chapter by running the indexed corrector over a whole passage. Today you build CorrectionsFast and confirm it produces the same report as the slow path, now cheap enough for real text.
Correct every unknown word in a passage using the index, matching the earlier Corrections output.
The document corrector, now on the index: CorrectionsFast walks the unknown tokens
of a passage and corrects each with CorrectFast. Its output matches the slow
Corrections byte for byte, because every piece underneath was proven equivalent -
but it is now fast enough to run over pages of prose without the two-edit generator’s
explosion of strings.
That completes the performance arc of the project. From here on, the checker is fast and correct, and the remaining chapter is about the product: turning corrections into a real tool with top-N suggestions, original-case output, line and column reporting, a readable report format, and a personal ignore list. The engine is done; the polish begins.
func (d *Dictionary) CorrectionsFast(text string) []Correction {// like Corrections, but call CorrectFast on each unknown token}