PyUnit-phone 
实体提取电话号码,包括电话号码的有效消息:电话类型、电话区号、运营商等
安装
pip install pyunit-phone
使用
from pyunit_phone import Phone
phone = Phone()
def check_up():
data = """
我的电话是15180865874,
他的电话是0851-12456789,
骚扰电话:075523675665,
01051369070 18716521010
"""
assert phone.extract(data) == \
[{
'city': '贵阳',
'operators': '移动',
'province': '贵州',
'type': '移动手机卡',
'value': '15180865874'
},
{
'city': '万州',
'operators': '移动',
'province': '重庆',
'type': '移动手机卡',
'value': '18716521010'
},
{
'city': '贵阳',
'operators': '电信',
'province': '贵州',
'type': '固定电话',
'value': '0851-12456789'
},
{
'city': '深圳',
'operators': '电信',
'province': '广东',
'type': '固定电话',
'value': '075523675665'
},
{
'city': '北京',
'operators': '电信',
'province': '北京',
'type': '固定电话',
'value': '01051369070'
}
]
if __name__ == '__main__':
check_up()
Docker部署
docker pull jtyoui/pyunit-phone
docker run -d -P jtyoui/pyunit-phone
车牌号规则提取
| 参数名 | 类型 | 是否可以为空 | 说明 |
|---|---|---|---|
| data | string | YES | 输入话带有电话的句子 |
请求示例
Python3 Requests测试
import requests
url = "http://IP:端口/pyunit/phone"
data = {
'data': '我的电话是15180865874',
}
headers = {'Content-Type': "application/x-www-form-urlencoded"}
response = requests.post(url, data=data, headers=headers).json()
print(response)
返回结果
{
"code":200,
"result":[
{
"city":"贵阳",
"operators":"移动",
"province":"贵州",
"type":"移动手机卡",
"value":"15180864978"
}
]
}
Metadata
Release files for pyunit-phone 2020.6.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyunit_phone-2020.6.28.tar.gz | 862.2 kB | Without provenance | Details for pyunit_phone-2020.6.28.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyunit_phone-2020.6.28-py3-none-any.whl | Python 3 | none | any | Details for pyunit_phone-2020.6.28-py3-none-any.whl |
Total release size: 1.7 MB
Release files / pyunit_phone-2020.6.28.tar.gz
| Download URL | pyunit_phone-2020.6.28.tar.gz |
|---|---|
| Size | 862.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f6d95e58ed09bef38838521688e4ed09bdaf8cbabb5656af652585267eac6f9
|
|
BLAKE2b-256 checksum How to use checksums |
a3d20d61b1603adda9786b9e7c2a402bc1f4257d3408085195403d8cdc3be0f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / pyunit_phone-2020.6.28-py3-none-any.whl
| Download URL | pyunit_phone-2020.6.28-py3-none-any.whl |
|---|---|
| Size | 865.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16a835629186b4642542a36b3bb6873551fb0ed463268837304934f832ea6a62
|
|
BLAKE2b-256 checksum How to use checksums |
f94e421ec54d2f509046f286a0a5ecf76e3a7a031419a3dc5abdaed8152ebacb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Security for pyunit-phone 2020.6.28
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.