MCPcopy Index your code
hub / github.com/clips/pattern / _edit2

Method _edit2

pattern/text/__init__.py:1759–1764  ·  view source on GitHub ↗

Returns a set of words with edit distance 2 from the given word

(self, w)

Source from the content-addressed store, hash-verified

1757 return set(delete + transpose + replace + insert)
1758
1759 def _edit2(self, w):
1760 """ Returns a set of words with edit distance 2 from the given word
1761 """
1762 # Of all spelling errors, 99% is covered by edit distance 2.
1763 # Only keep candidates that are actually known words (20% speedup).
1764 return set(e2 for e1 in self._edit1(w) for e2 in self._edit1(e1) if e2 in self)
1765
1766 def _known(self, words=[]):
1767 """ Returns the given list of words filtered by known words.

Callers 1

suggestMethod · 0.95

Calls 1

_edit1Method · 0.95

Tested by

no test coverage detected