|
@@ -114,16 +114,29 @@ class FrontParser(Parser):
|
|
|
raise Exception('无法识别')
|
|
|
|
|
|
def national(self):
|
|
|
- # 性别女民族汉
|
|
|
- if len(self.result[1]) == 1:
|
|
|
- txt = self.result[1][0].txt
|
|
|
- conf = self.result[1][0].conf
|
|
|
+ """
|
|
|
+ 性别 <-- id
|
|
|
+ 民族汉
|
|
|
+ """
|
|
|
+
|
|
|
+ for nation in self.result[1]:
|
|
|
+ txt = nation.txt
|
|
|
+ conf = nation.conf
|
|
|
res = re.findall(".*民族[\u4e00-\u9fa5]+", txt)
|
|
|
|
|
|
if len(res) > 0:
|
|
|
self.res["ethnicity"] = RecItem(res[0].split("族")[-1], conf)
|
|
|
return
|
|
|
|
|
|
+ # if len(self.result[1]) == 1:
|
|
|
+ # txt = self.result[1][0].txt
|
|
|
+ # conf = self.result[1][0].conf
|
|
|
+ # res = re.findall(".*民族[\u4e00-\u9fa5]+", txt)
|
|
|
+ #
|
|
|
+ # if len(res) > 0:
|
|
|
+ # self.res["ethnicity"] = RecItem(res[0].split("族")[-1], conf)
|
|
|
+ # return
|
|
|
+
|
|
|
def address(self):
|
|
|
"""
|
|
|
身份证地址
|
|
@@ -165,6 +178,8 @@ class FrontParser(Parser):
|
|
|
raise Exception('无法识别')
|
|
|
|
|
|
def split_addr(self):
|
|
|
+
|
|
|
+ print(self.res['address'].text, '=======')
|
|
|
conf = self.res["address"].confidence
|
|
|
df = cpca.transform([self.res["address"].text])
|
|
|
# print(df)
|