From 51efb77261bc98e52b8684e0d7a7de1244980a6f Mon Sep 17 00:00:00 2001 From: weiweiw <14335254+weiweiw22@user.noreply.gitee.com> Date: Wed, 8 May 2024 11:09:25 +0800 Subject: [PATCH] fix issue --- OCRPython/extractor/identitycard_extractor.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/OCRPython/extractor/identitycard_extractor.py b/OCRPython/extractor/identitycard_extractor.py index 1f380a1..592fecb 100644 --- a/OCRPython/extractor/identitycard_extractor.py +++ b/OCRPython/extractor/identitycard_extractor.py @@ -113,7 +113,7 @@ class IdentityCardExtractor(Extractor): result["name"] = name.group(1).strip() tempName = result["name"] if tempName.startswith("名"): - result["name"] = text[len("名"):] + result["name"] = tempName[len("名"):] # 提取民族 ethnicity = re.search(r"民\s*(族|旅)\s*(\S+)", text, re.DOTALL) @@ -382,7 +382,21 @@ class IdentityCardExtractor(Extractor): # 23 # 公民身份号码 # 430281197011090090""" - +# text = """中华人民共和国 +# 居民身份证 +# 签发机关湘乡市公安局 +# 有效期限2016.01.25-2036.01.25 +# 名李绍光 +# 性别男 +# 民族汉 +# 出 +# 生 +# 1983年11月24日 +# 住址 +# 湖南省湘乡市山枣镇龙泉 +# 村峡山口村民组156号 +# 公民身份号码 +# 43038119831124301X""" # extractor = IdentityCardExtractor() # jsonstring = extractor.extract_textbyPaddle(text) # print(jsonstring)