Commit bfa69990 authored by Jeroen F.J. Laros's avatar Jeroen F.J. Laros

Documentation.

parent f5212467
def _hamming(path, node, word, distance): def _hamming(path, node, word, distance):
""" """
Find the first path in the trie that is within a certain hamming distance
of {word}. Note that this does not necessarily the one with the smallest
distance.
:arg str path: Path taken so far to reach the current node. :arg str path: Path taken so far to reach the current node.
:arg dict node: Current node. :arg dict node: Current node.
:arg str word: Query word. :arg str word: Query word.
:arg int distance: Amount of errors we can still make. :arg int distance: Amount of errors we can still make.
:returns str: :returns str: A word in the trie that has Hamming distance of at most
{distance} to {word}.
""" """
if distance < 0: if distance < 0:
return '' return ''
...@@ -50,7 +55,7 @@ class Trie(object): ...@@ -50,7 +55,7 @@ class Trie(object):
:arg str word: A word. :arg str word: A word.
:returns dict: The node if found, None otherwise. :returns dict: The node if found, {} otherwise.
""" """
node = self.root node = self.root
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment