Cut down on false positive phone numbers by requiring all matched phone numbers to have at least 3 digits (so that emergency services' phone numbers are also matched).

This commit is contained in:
AccentuSoft
2022-05-07 06:14:48 +03:00
parent fd5ebb1f5a
commit 8d3afe06b4

View File

@@ -98,8 +98,9 @@ class PhoneNumbersExtractor:
tagContents = tag.text
cleanTagContentsList = re.sub(cleanTagsRegex, '', tagContents).split('\n')
for cleanTag in cleanTagContentsList:
if not phoneNumCharsExclusion.findall(cleanTag):
returnResults.append([{'Phone Number': cleanTag.strip(),
cleanTag = cleanTag.strip()
if not phoneNumCharsExclusion.findall(cleanTag) and len(re.findall(r'\d', cleanTag)) >= 3:
returnResults.append([{'Phone Number': cleanTag,
'Entity Type': 'Phone Number'},
{currentUID: {'Resolution': 'Phone Number Found',
'Notes': ''}}])