MCPcopy Index your code
hub / github.com/lancopku/pkuseg-python / insert

Method insert

pkuseg/__init__.py:62–72  ·  view source on GitHub ↗

Trie树中插入单词

(self, word, usertag)

Source from the content-addressed store, hash-verified

60 self.insert(w, t)
61
62 def insert(self, word, usertag):
63 """Trie树中插入单词"""
64 l = len(word)
65 now = self.trie
66 for i in range(l):
67 c = word[i]
68 if not c in now.children:
69 now.children[c] = TrieNode(False)
70 now = now.children[c]
71 now.isword = True
72 now.usertag = usertag
73
74 def solve(self, txt):
75 """对文本进行预处理"""

Callers 2

__init__Method · 0.95
post_processMethod · 0.80

Calls 1

TrieNodeClass · 0.85

Tested by

no test coverage detected