Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Laros
dict-trie
Commits
bfa69990
Commit
bfa69990
authored
Feb 16, 2017
by
Laros
Browse files
Documentation.
parent
f5212467
Changes
1
Hide whitespace changes
Inline
Side-by-side
dict_trie/dict_trie.py
View file @
bfa69990
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 dict node: Current node.
:arg str word: Query word.
: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
:
return
''
...
...
@@ -50,7 +55,7 @@ class Trie(object):
:arg str word: A word.
:returns dict: The node if found,
None
otherwise.
:returns dict: The node if found,
{}
otherwise.
"""
node
=
self
.
root
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment