Skip to content

Commit b3e581d

Browse files
committed
Fix pep8 issues
1 parent f678d70 commit b3e581d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

pythainlp/tokenize/trie.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
# -*- coding: utf-8 -*-
2-
32
class Trie:
3+
44
class Node(object):
55
__slots__ = 'end', 'children'
66
def __init__(self):
7-
self.end = False
7+
self.end = False
88
self.children = {}
9-
9+
1010
def __init__(self, words):
1111
self.words = words
1212
self.root = Trie.Node()
1313
for word in words:
1414
cur = self.root
15-
for ch in word:
15+
for ch in word:
1616
node = cur.children.get(ch)
17-
if not node:
18-
node = Trie.Node()
19-
cur.children[ch] = node
17+
if not node:
18+
node = Trie.Node()
19+
cur.children[ch] = node
2020
cur = node
21-
cur.end = True
21+
cur.end = True
22+
2223
def prefixes(self, text):
2324
res = []
2425
cur = self.root
2526
for i, ch in enumerate(text):
2627
node = cur.children.get(ch)
27-
if not node: break
28+
if not node:
29+
break
2830
if node.end:
2931
res.append(text[:i+1])
3032
cur = node
@@ -34,4 +36,4 @@ def __contains__(self, key):
3436
return key in self.words
3537

3638
def __iter__(self):
37-
yield from self.words
39+
yield from self.words

0 commit comments

Comments
 (0)