MCPcopy Create free account
hub / github.com/EasyIME/PIME / extendtable

Class extendtable

python/cinbase/extendtable.py:4–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2from __future__ import unicode_literals
3
4class extendtable(object):
5
6 # TODO check the possiblility if the encoding is not utf-8
7 encoding = 'utf-8'
8
9 def __init__(self, fs):
10
11 self.chardefs = {}
12
13 for line in fs:
14
15 line = line.strip()
16
17 key, root = safeSplit(line)
18 key = key.lower().strip()
19 root = root.strip()
20
21 try:
22 self.chardefs[key].append(root)
23 except KeyError:
24 self.chardefs[key] = [root]
25
26 def __del__(self):
27 del self.chardefs
28 self.chardefs = {}
29
30 def isInCharDef(self, key):
31 return key in self.chardefs
32
33 def getCharDef(self, key):
34 """
35 will return a list conaining all possible result
36 """
37 return self.chardefs[key]
38
39
40def safeSplit(line):

Callers 3

initCinBaseContextMethod · 0.90
checkConfigChangeMethod · 0.90
runMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected