hazimp.spell_check

Spell checking based on http://norvig.com/spell-correct.html

Module Contents

Classes

SpellCheck

Given a base set of works, check the spelling of a new work and

Functions

edits1(word)

Build a set of the word with various changes

train(features)

Builds the nwords data structure.

Attributes

ALPHABET

hazimp.spell_check.ALPHABET = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
hazimp.spell_check.edits1(word)

Build a set of the word with various changes

hazimp.spell_check.train(features)

Builds the nwords data structure.

class hazimp.spell_check.SpellCheck(base_words)

Bases: object

Given a base set of works, check the spelling of a new work and suggest what base word was meant.

known_edits2(self, word)
known(self, words)
correct(self, word)

If the word is known ‘word’ is returned. If the word is unknow, by 1 or 2 modifications from known words,

The known word is returned

Otherwise the unknown word is returned.

Parameters:

word – The word that might have a typo.

Returns:

??