Skip to main content

A Python package for cleaning and analyzing Chinese phone numbers.

Project description

Chinese Phone Number Parser

A Python package for cleaning, parsing, and analyzing Chinese phone numbers in various formats.

Features

  • Clean and normalize phone numbers from various formats
  • Extract area codes and map them to corresponding cities
  • Detect different phone number formats (mobile, landline, international, etc.)
  • Handle multiple phone numbers in a single string
  • Support for extensions and special number formats
  • Comprehensive analysis of phone number patterns

Installation

pip install chinese-phone-parser

Quick Start

from chinese_phone_parser import PhoneParser

# Parse a single phone number
parser = PhoneParser()
result = parser.parse("+86-010-12345678")
print(result)
# Output: {'normalized': '01012345678', 'type': 'landline', 'area_code': '010', 'city': 'Beijing'}

# Clean and analyze a dataset
import pandas as pd
from chinese_phone_parser import analyze_phone_dataset

df = pd.read_csv('your_data.csv')
result_df = analyze_phone_dataset(df, phone_column='phone_number')

Common Phone Number Formats Handled

  • Mobile Numbers: 13812345678, +86 138 1234 5678
  • Landline Numbers: 010-12345678, 0755-87654321
  • International Format: +86 10 1234 5678, 0086-755-12345678
  • Numbers with Extensions: 010-12345678-123, 0755-87654321 转 456
  • Multiple Numbers: 010-12345678 / 13812345678
  • Toll-Free Numbers: 400-123-4567, 800-123-4567

Documentation

For detailed usage and API documentation, please refer to the documentation.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

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

Source Distribution

chinese_phone_parser-0.1.1.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

chinese_phone_parser-0.1.1-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file chinese_phone_parser-0.1.1.tar.gz.

File metadata

  • Download URL: chinese_phone_parser-0.1.1.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for chinese_phone_parser-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a29b5026be3920ef35d9f35897910e83f42ceeb80e18b49507853d8bacfc5efc
MD5 aea8988a4a3e8a548dac1cad343bef88
BLAKE2b-256 4f9bb7dc58fc782fe84042b1283d14ad7349334d4cb53d0757797836eb7cf368

See more details on using hashes here.

File details

Details for the file chinese_phone_parser-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for chinese_phone_parser-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b90cacc983e82405bd693ddacfc9236232b2c2c23f27a7639380e7dbffc5f7d9
MD5 96169b50feb94cc0f4ccd89f6448da9f
BLAKE2b-256 c723466a99ccbc215492edf72187576a5f9cd706c621494ab855a0c0f259439a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page