|
@@ -90,7 +90,7 @@ class FrontParser(Parser):
|
|
|
mini_dis = [99999., 0]
|
|
|
|
|
|
is_name = '姓' in txt or '名' in txt
|
|
|
- if is_name and len(txt) < 4:
|
|
|
+ if is_name and len(res) > 1:
|
|
|
for k in range(len(self.result[i])):
|
|
|
if k == j: continue
|
|
|
p = np.array(res[j].ct) - np.array(res[k].ct)
|
|
@@ -99,25 +99,24 @@ class FrontParser(Parser):
|
|
|
mini_dis = [min, k]
|
|
|
conf = self.result[i][k].conf
|
|
|
name_val = self.result[i][mini_dis[1]].txt
|
|
|
- elif is_name:
|
|
|
+ elif is_name and len(txt) > 3:
|
|
|
conf = self.result[i][mini_dis[1]].conf
|
|
|
name_val = txt.split("姓名")[-1]
|
|
|
|
|
|
- if name_val != None:
|
|
|
- if len(name_val) < 5:
|
|
|
- self.res["name"] = RecItem(name_val, conf)
|
|
|
- else:
|
|
|
- point_unicode = ["\u2E31", "\u2218", "\u2219", "\u22C5", "\u25E6", "\u2981",
|
|
|
- "\u00B7", "\u0387", "\u05BC", "\u16EB", "\u2022", "\u2027",
|
|
|
- "\u2E30", "\uFF0E", "\u30FB", "\uFF65", "\u10101"]
|
|
|
- for n in range(len(point_unicode)):
|
|
|
- point = re.findall(point_unicode[n], name_val)
|
|
|
- if len(point) != 0:
|
|
|
- name_list = name_val.split(point[0])
|
|
|
- self.res['name'] = RecItem(name_list[0] + '\u00B7' + name_list[1], conf)
|
|
|
- return
|
|
|
- else:
|
|
|
+ if name_val is None:
|
|
|
raise Exception('无法识别')
|
|
|
+ if len(name_val) < 5:
|
|
|
+ self.res["name"] = RecItem(name_val, conf)
|
|
|
+ else:
|
|
|
+ point_unicode = ["\u2E31", "\u2218", "\u2219", "\u22C5", "\u25E6", "\u2981",
|
|
|
+ "\u00B7", "\u0387", "\u05BC", "\u16EB", "\u2022", "\u2027",
|
|
|
+ "\u2E30", "\uFF0E", "\u30FB", "\uFF65", "\u10101"]
|
|
|
+ for n in range(len(point_unicode)):
|
|
|
+ point = re.findall(point_unicode[n], name_val)
|
|
|
+ if len(point) != 0:
|
|
|
+ name_list = name_val.split(point[0])
|
|
|
+ self.res['name'] = RecItem(name_list[0] + '\u00B7' + name_list[1], conf)
|
|
|
+ return
|
|
|
|
|
|
def national(self):
|
|
|
"""
|
|
@@ -147,9 +146,6 @@ class FrontParser(Parser):
|
|
|
self.res["ethnicity"] = RecItem(txt.split("族")[-1], conf)
|
|
|
return
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
# for nation in self.result[1]:
|
|
|
# txt = nation.txt
|
|
|
# conf = nation.conf
|