Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
SoluMilken committed Mar 13, 2019
1 parent 6b07cb8 commit 467cd2e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions uttut/pipeline/ops/utils/trie.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ def __init__(self):
self._word = None

def has_child(self, key):
if key in self._children:
return True
return False
return key in self._children

def get_child(self, key):
return self._children[key]
Expand All @@ -16,7 +14,10 @@ def insert_child(self, key):
self._children[key] = TrieNode()

def set_word(self, word):
self._word = word
if not self._word:
self._word = word
else:
raise ValueError('Word exists')

def get_word(self):
return self._word
Expand Down

0 comments on commit 467cd2e

Please sign in to comment.