Skip to main content

Normalizing phone numbers

The phones app enriches phone number annotations by:

  • Normalizing local phone numbers by resolving land lines depending on city or countries it has encountered in the document
  • Collecting all phone numbers present in the document

The application performs a resolution lookup each time a PhoneNr entity is found. You can find this in the contact-info domain or you can make your own custom domain with this entity.

Options

PhonesOptions

interface PhonesOptions {
  countries?: string[];
  distance?: string[];
}

with:

Property Description
countries Country names to try to resolve a local phone number
distance Maximum distance between a location and the phone number to be resolved

Results

PhonesResults

type PhonesResults = PhoneResult[];

PhoneResult

interface PhoneResult {
  phone_nr: string;
  country_code: string;
  country: string;
  location?: string;
}

with:

Property Description
phone_nr Normalized phone number
country_code Country phone code of the phone number, e.g. +32
country Country code of the phone number, e.g. 'Belgium'
location Precise location, if available

Examples

Normalizing phone numbers

The phones app enriches phone number annotations by:

  • Normalizing local phone numbers by resolving land lines depending on city or countries it has encountered in the document
  • Collecting all phone numbers present in the document

The application performs a resolution lookup each time a PhoneNr entity is found. You can find this in the contact-info domain or you can make your own custom domain with this entity.

Options

PhonesOptions

interface PhonesOptions {
  countries?: string[];
  distance?: string[];
}

with:

Property Description
countries Country names to try to resolve a local phone number
distance Maximum distance between a location and the phone number to be resolved

Results

PhonesResults

type PhonesResults = PhoneResult[];

PhoneResult

interface PhoneResult {
  phone_nr: string;
  country_code: string;
  country: string;
  location?: string;
}

with:

Property Description
phone_nr Normalized phone number
country_code Country phone code of the phone number, e.g. +32
country Country code of the phone number, e.g. 'Belgium'
location Precise location, if available

API

Examples

You will need to install the english language module to run the sample. pip install wowool-english

Extracting and normalizing phone numbers

The script extracts and normalizes a Belgian phone number from the text, identifies its country and location, and prints this structured information.

from wowool.sdk import Pipeline
from wowool.phones.app_id import APP_ID

text = "I live in Antwerp and my phone number is 03/230 30 46."
pipeline = Pipeline(
    [
        "english",
        "contact-info",
        "phones.app",
    ]
)
document = pipeline(text)
print(document.results(APP_ID))

results:

[
    {
        "phone_nr": "+3232303046",
        "country_code": 32,
        "country": "Belgium",
        "location": "Antwerp"
    }
]

License

In both cases you will need to acquirer a license file at https://www.wowool.com

Non-Commercial

This library is licensed under the GNU AGPLv3 for non-commercial use.  
For commercial use, a separate license must be purchased.  

Commercial license Terms

1. Grants the right to use this library in proprietary software.  
2. Requires a valid license key  
3. Redistribution in SaaS requires a commercial license.  

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wowool_phones-2.1.4-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file wowool_phones-2.1.4-py3-none-any.whl.

File metadata

  • Download URL: wowool_phones-2.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for wowool_phones-2.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fa926ed762f97589e92ab65d8f1f9a2c622255e3d7be8668be15a1515c2fce09
MD5 5a7997f85ad4b95e26f34c5b2055556d
BLAKE2b-256 c25704ab6e3bf0e8ebde324c2e90794fa725480ef63a69b97d8b790f53a7e24f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1.4 This release

1 file

2.1.2

1 file

2.1.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page