Peter Norvig's word segmentation issue: how can I segment words with misspellings inside?

Viewed 1273

I'm trying to understand, how does Peter Norvig's spelling corrector work.

On his jupyter-notebook title here he explains, how to segment a sequence of characters without spaces separating words. It works correct, when all the words in sequence are written correct:

>>> segment("deeplearning")
['deep', 'learning']

But when the word (or some words) in sequence is misspelled, it works incorrect:

>>> segment("deeplerning")
['deep', 'l', 'erning']

Unfortunately, I have no idea how to fix this and make the segment() function work with concatenated words with misspellings.

Does anybody have an idea how to deal with this problem?

1 Answers
Related