pyunits / pyunit-address Goto Github PK
View Code? Open in Web Editor NEW字符串地址查询,支持自定义地址词库,解析地址,地址识别,地址抽取,中文地址.
字符串地址查询,支持自定义地址词库,解析地址,地址识别,地址抽取,中文地址.
作者大神可以试试这个地址,这个是真实的地址不是我编的。。
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 /Users/mars/Desktop/python源码/flaskProject/address.py
[]
4.982679128646851
代码:
import time
import jieba
from pyunit_address import Address, find_address
def all_test():
# string_ = '我家在红花岗,你家在贵州贵阳花溪区,他家在贵州省遵义市花溪区'
# finds = find_address(address, string_)
# for find in finds:
# print()
# print('地址', find)
# print('补全地址', supplement_address(address, find))
# print('纠错地址', correct_address(address, find))
# print('--------------------------')
address = Address(is_max_address=True)
# 添加词库,可以是一个字符串、可以是列表字符串、可以是词库文件,一个词语占一行
address.add_vague_text('红花岗') # 在默认词库上追加地址词库
address.add_vague_text('贵州省-遵义市-遵义县-虾子镇-乐安村') # 添加补全地址
address.add_vague_text(['花溪', '贵州省-遵义市-遵义县-虾子镇-乐安村']) # 加载词库列表,替换默认词库
address.add_vague_text('自定义词库.txt') # 加载词库文件,替换默认词库
af = find_address(address, '我家在贵州遵义红花岗区')
print(af)
# ret = {
# 'Address': text[3] + text[4] + text[5] + text[6],
# 'Area': text[2],
# 'City': text[1],
# 'Province': text[0],
# 'name': text[7],
# 'phone': text[8],
# }
# res = {'message': 'success', 'code': 200, 'data': ''}
# return json.dumps(res, ensure_ascii=False)
if name == 'main':
start = time.time()
all_test()
print(time.time() - start)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.