Merge pull request #158 from SDSRV-IDP/dev/semi_correct

Update: Imei with maximum 14 characters
This commit is contained in:
Le Van Tuan 2024-07-22 10:38:13 +07:00 committed by GitHub Enterprise
commit 01a3411d5f
2 changed files with 7 additions and 1 deletions

View File

@ -308,3 +308,5 @@ REASON_SOLUTION_MAP = {"Invalid image": "Remove this image from the evaluation r
"Wrong feedback": "Update revised resutl and re-calculate accuracy",
"Ocr cannot extract": "Improve OCR",
}
IMEI_MAX_LENGHT = 14

View File

@ -5,6 +5,7 @@ import time
import json
import glob
import shutil
from django.conf import settings
import pandas as pd
from tqdm import tqdm
from pathlib import Path
@ -64,6 +65,9 @@ def post_processing_str(class_name: str, s: str, is_gt: bool, sub: str) -> str:
s = convert_datetime_format(s)
if class_name == "retailername":
s = normalise_retailer_name(s, sub)
if class_name == "imei_number" and isinstance(s, str):
if len(s) > settings.IMEI_MAX_LENGHT:
s = s[:settings.IMEI_MAX_LENGHT]
return s