https://github.com/nacnudus/pyphone
incomplete python wrapper of libphonenumber
https://github.com/nacnudus/pyphone
Last synced: 2 months ago
JSON representation
incomplete python wrapper of libphonenumber
- Host: GitHub
- URL: https://github.com/nacnudus/pyphone
- Owner: nacnudus
- Created: 2023-07-22T19:35:40.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-22T19:35:51.000Z (almost 2 years ago)
- Last Synced: 2025-01-05T18:28:08.262Z (4 months ago)
- Language: C++
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pyphone
A very incomplete pyphon wrapper of Google's
[libphonenumber](https://github.com/google/libphonenumber/). It isn't even
packaged as a python package.I did this as a quick experiment to see whether it would be quicker than the
pure-python port https://github.com/daviddrysdale/python-phonenumbers. For what
I was doing (extracting phone numbers from website pages of GOV.UK in bulk), it
was exactly the same speed.## Requirements
Install libphonenumber in your system. For example, using Arch Linux:
```sh
sudo
pacman -S libphonenumber
```Install `pybind11`:
```sh
python -m ensurepip
python -m pip install -r requirements.txt
```## Build
```sh
make
```## Usage
```py
import pyphone
pnu = pyphone.PhoneNumberUtil()
pnm = pyphone.PhoneNumberMatcher(
pnu,
'My phone number is 0123456789.',
'GB',
pyphone.PhoneNumberMatcher.Leniency.POSSIBLE
)
match = pyphone.PhoneNumberMatch()
number_format = pyphone.PhoneNumberUtil.PhoneNumberFormat.E164while pnm.HasNext():
pnm.Next(match)
print(pnu.Format(match.number(), number_format))
```