Skip to content

Commit b22fb70

Browse files
committed
合并一部分同功能函数
1 parent d922e36 commit b22fb70

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

thulac/manage/Preprocesser.py

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,45 @@ def __init__(self, rm_space=False):
3030
self.t2s = {}
3131
self.s2t = {}
3232
self.rmSpace = rm_space
33+
self.isOther = self.is_X(self.otherSet)
34+
self.isSinglePun = self.is_X(self.singlePunSet)
35+
self.isHttp = self.is_X(self.httpSet)
36+
self.isModalParticleSet = self.is_X(self.modalParticleSet)
3337

3438

35-
def isOther(self, c):
36-
if(c in self.otherSet):
37-
return True
38-
else:
39-
return False
39+
def is_X(self, charType):
40+
def func(c):
41+
if(c in charType):
42+
return True
43+
else:
44+
return False
45+
return func
46+
47+
48+
49+
# def isOther(self, c):
50+
# if(c in self.otherSet):
51+
# return True
52+
# else:
53+
# return False
4054

41-
def isSinglePun(self, c):
42-
if(c in self.singlePunSet):
43-
return True
44-
else:
45-
return False
55+
# def isSinglePun(self, c):
56+
# if(c in self.singlePunSet):
57+
# return True
58+
# else:
59+
# return False
4660

47-
def isHttp(self, c):
48-
if(c in self.httpSet):
49-
return True
50-
else:
51-
return False
61+
# def isHttp(self, c):
62+
# if(c in self.httpSet):
63+
# return True
64+
# else:
65+
# return False
5266

53-
def isModalParticleSet(self, c):
54-
if(c in self.modalParticleSet):
55-
return True
56-
else:
57-
return False
67+
# def isModalParticleSet(self, c):
68+
# if(c in self.modalParticleSet):
69+
# return True
70+
# else:
71+
# return False
5872

5973
def setT2SMap(self, filename):
6074
file = open(filename, "rb")

0 commit comments

Comments
 (0)