仓库地址
PSP2.1 | Personal Software Process Stages | 预估耗时(分钟) | 实际耗时(分钟) |
---|---|---|---|
Planning | 计划 | 30 | 30 |
Estimate | 估计这个任务需要多少时间 | 720 | 720 |
Development | 开发 | 300 | 360 |
Analysis | 需求分析(包括学习新技术) | 180 | 180 |
Design Spec | 生成设计文档 | 10 | 15 |
Design Review | 设计复审 | 10 | 5 |
Coding Standard | 代码规范(为开发制定合适的规范) | 8 | 10 |
Design | 具体设计 | 20 | 25 |
Coding | 具体编码 | 130 | 150 |
Code Review | 代码复审 | 15 | 20 |
Test | 测试(自我测试,修改,提交修改) | 180 | 300 |
Reporting | 报告 | 17 | 30 |
Test Report | 测试报告 | 15 | 15 |
Size Measurement | 计算工作量 | 10 | 15 |
Postmortem & Process Improvement Plan | 事后总结并提出过程改进计划 | 60 | 60 |
合计 | 1705 | 1940 |
- 解题思路
- 首先使用正则表达式找出姓名和手机号码
- 清除字符串中地址以外的字符
- 使用5,7级地址的正则表达式匹配出地址
- 省、市级行政区若由表达式未匹配出,则分别匹配存放省市级行政区名称的列表,以应对后缀可能缺失的问题
设计实现
主要是使用正则表达式匹配字符
姓名、手机号码较为简单,直接使用正则表达式就可以了
地址部分主要是省市级可能会缺少后缀,前两个字符匹配可以解决,其余用正则表达式就可以了
补全就没办法了- 关键代码
pattern = re.compile(r'(?P[^省]+自治区|.*?省|.*?行政区|)(?P[^市]+自治州|.*?地区|.*?行政单位|.+盟|市辖区|.*?市|)(?P[^县]+县|.+?区|.+市|.+旗|.+海域|.+岛)?(?P[^区]+区|.+?镇|.+?街道|.+?乡)?(?P.+?街|.+?路|.+?巷)?(?P\d+?号|\d+.?道)?(?P.*)')
结果输出
[{"姓名":"李四","手机":"13756899511","地址":["福建省","福州市","鼓楼区","鼓西街道","湖滨路","110号","湖滨大厦一层"]},
{"姓名":"张三","手机":"13599622362","地址":["福建省","福州市","闽侯县","上街镇","","","福州大学10#111"]},
{"姓名":"王五","手机":"18960221533","地址":["福建省","福州市","鼓楼区","","五一北路","123号","福州鼓楼医院"]},
{"姓名":"小美","手机":"15822153326","地址":["北京","北京市","东城区","","交道口东大街","1号","北京市东城区人民法院"]},
{"姓名":"小陈","手机":"13965231525","地址":["广东省","东莞市","","凤岗镇","凤平路","13号",""]}]
性能分析
单元测试
小结
我太难了
我太菜了,要跟大佬多学习