{"id":19862778,"url":"https://github.com/pyunits/pyunit-phone","last_synced_at":"2025-05-02T04:30:52.675Z","repository":{"id":57458195,"uuid":"275535464","full_name":"pyunits/pyunit-phone","owner":"pyunits","description":"实体提取电话号码，包括电话号码的有效消息：电话类型、电话区号、运营商等","archived":false,"fork":false,"pushed_at":"2020-06-28T10:15:46.000Z","size":1342,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-06T22:37:43.496Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyunits.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-28T07:55:05.000Z","updated_at":"2024-07-26T01:35:26.000Z","dependencies_parsed_at":"2022-09-09T23:02:23.569Z","dependency_job_id":null,"html_url":"https://github.com/pyunits/pyunit-phone","commit_stats":null,"previous_names":["pyunit/pyunit-phone"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyunits%2Fpyunit-phone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyunits%2Fpyunit-phone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyunits%2Fpyunit-phone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyunits%2Fpyunit-phone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyunits","download_url":"https://codeload.github.com/pyunits/pyunit-phone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250818605,"owners_count":21492355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T15:12:39.582Z","updated_at":"2025-05-02T04:30:51.360Z","avatar_url":"https://github.com/pyunits.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **PyUnit-phone** [![](https://gitee.com/tyoui/logo/raw/master/logo/photolog.png)][1]\n\n## 实体提取电话号码，包括电话号码的有效消息：电话类型、电话区号、运营商等\n[![](https://img.shields.io/badge/Python-3.7-green.svg)](https://pypi.org/project/pyunit-address/)\n\n## 安装\n    pip install pyunit-phone\n\n\n## 使用\n```python\nfrom pyunit_phone import Phone\n\nphone = Phone()\n\n\ndef check_up():\n    data = \"\"\"\n    我的电话是15180865874,\n    他的电话是0851-12456789,\n    骚扰电话：075523675665,\n    01051369070 18716521010 \n    \"\"\"\n    assert phone.extract(data) == \\\n           [{\n               'city': '贵阳',\n               'operators': '移动',\n               'province': '贵州',\n               'type': '移动手机卡',\n               'value': '15180865874'\n           },\n               {\n                   'city': '万州',\n                   'operators': '移动',\n                   'province': '重庆',\n                   'type': '移动手机卡',\n                   'value': '18716521010'\n               },\n               {\n                   'city': '贵阳',\n                   'operators': '电信',\n                   'province': '贵州',\n                   'type': '固定电话',\n                   'value': '0851-12456789'\n               },\n               {\n                   'city': '深圳',\n                   'operators': '电信',\n                   'province': '广东',\n                   'type': '固定电话',\n                   'value': '075523675665'\n               },\n               {\n                   'city': '北京',\n                   'operators': '电信',\n                   'province': '北京',\n                   'type': '固定电话',\n                   'value': '01051369070'\n               }\n           ]\n\n\nif __name__ == '__main__':\n    check_up()\n```\n\n## Docker部署\n    docker pull jtyoui/pyunit-phone\n    docker run -d -P jtyoui/pyunit-phone\n\n### 车牌号规则提取\n|**参数名**|**类型**|**是否可以为空**|**说明**|\n|------|------|-------|--------|\n|data|string|YES|输入话带有电话的句子|\n\n### 请求示例\n\u003e #### Python3 Requests测试\n```python\nimport requests\n\nurl = \"http://IP:端口/pyunit/phone\"\ndata = {\n    'data': '我的电话是15180865874',\n}\nheaders = {'Content-Type': \"application/x-www-form-urlencoded\"}\nresponse = requests.post(url, data=data, headers=headers).json()\nprint(response)\n``` \n\n\u003e #### 返回结果\n```json\n{\n    \"code\":200,\n    \"result\":[\n        {\n            \"city\":\"贵阳\",\n            \"operators\":\"移动\",\n            \"province\":\"贵州\",\n            \"type\":\"移动手机卡\",\n            \"value\":\"15180864978\"\n        }\n    ]\n}\n```\n\n***\n[1]: https://blog.jtyoui.com","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyunits%2Fpyunit-phone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyunits%2Fpyunit-phone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyunits%2Fpyunit-phone/lists"}