Skip to content

Commit

Permalink
update 1.2.18 优化name的识别结果
Browse files Browse the repository at this point in the history
  • Loading branch information
asseek authored and asseek committed Sep 27, 2021
1 parent 6c57109 commit b189862
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/parse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ var ParseAddress = function () {
maxLen = _ref$maxLen === undefined ? 11 : _ref$maxLen,
firstName = _ref.firstName;

if (!result.name) {
if (!result.name || _utils2.default.strLen(result.name) > 15) {
var list = result.details.split(' ');
var name = {
value: '',
Expand Down
2 changes: 1 addition & 1 deletion dist/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function getAllAreaTestList() {
};
}

var list = [['福建省福州市福清市石竹街道义明综合楼3F,15000000000,asseek', '350181'], ['福建省福清市石竹街道义明综合楼3F,15000000000,asseek', '350181'], ['福州市福清市石竹街道义明综合楼3F,15000000000,asseek', '350181'], ['福清市石竹街道义明综合楼3F,15000000000,asseek', '350181'], ['浙江省温州市乐清柳市镇', '330382'], ['李xx 13512222322 广西壮族自治区 桂林市 恭城瑶族自治县 恭城镇拱辰东路xx-xx号', '450332'], ['李xx 13512222222 恭城 恭城镇拱辰东路08-88号', '450332'], ['四川成都高新区天府大道中段530号东方希望天祥广场a座4302号北京万商天勤(成都)律师事务所', '510191'], '房pp,18263333333,山东省 德州市 乐陵市 市中街道怡然居小区,253600', ['张y,18802222222,黑龙江省 哈尔滨市 道里区 经纬街道经纬七道街,000000', { name: '张y' }], ['深圳市龙华新区民治街道办民乐新村。陆xg15822222222', { name: '陆xg' }], '张l,15222222222,内蒙古自治区 呼和浩特市 和林格尔县 盛乐经济工业园区内蒙古师范大学盛乐校区十三号楼,011500', ['张l,15222222222,和林格尔 盛乐经济工业园区内蒙古师范大学盛乐校区十三号楼,011500', '150123'], '上海市徐汇区 复兴中路1237号 5楼WeWork 200010 柚子', ['龙湖区黄山路潮华雅居10栋000房 肖小姐', { code: '440507', name: '肖小姐' }], ['西安市雁塔区丈八东路晶城秀府7号楼2单元 李飞', { code: '610113', name: '李飞' }], ['湖北省安陆市西亚小铺,文元13377777788', { code: '420982', name: '文元' }], ['福建宁德福鼎太姥山镇岭后路。 丹', { code: '350982', name: '丹' }], ['南京市雨花区小行路58号名城世家花园', '320114'], ['四川省阆中市', '511381'], ['北京市市辖区东城区嘿嘿 嘿嘿 18031491271', { code: '110101', name: '嘿嘿' }], ['福建省福州市福清市台江公寓', '350181'], ['山东省青岛市平度市南村镇亭兰 张13668888888', { code: '370283', name: '张' }], ['佛山市南海区盐步 穗盐路景裕嘉园1期 13609770999 大旋仔', { name: '大旋仔' }], ['广东省 东莞市 东城街道', { details: '', code: '441916' }], ['山东省青岛平度市南村镇', '370283'], ['重庆市县城口县', '500229'], ['上海 上海市 浦东区 asd,大liu, ', '310115'], ['吐鲁番市吐鲁番宾馆', '650400'], ['新疆伊宁市上海城徐汇苑23号楼5单元401室', '654002'], ['重庆忠县', '500233'], ['湖北神农架太阳村10组', '429021'], ['广东省惠来县惠城镇南门西路209号', '445224'], ['江苏省靖江市江阴经济开发区靖江园区五星村里面的江阴经济开发区', { details: '江阴经济开发区靖江园区五星村里面的江阴经济开发区' }], ['北京市密云区花园小区1楼三单元30115801691123 唐娜明收', { mobile: '15801691123' }], ['重庆市永川区南大街街道重庆文理学院', '500118'], ['18112341234 上海奉贤区南桥镇程普路123号上海可通营业部 朱某某', { code: '310120', name: '朱某某' }], ['18112341234 天津大港区大港油田花园路123号 刘某某', { code: '120100', name: '刘某某' }], ['海南省三亚市天涯区海南省三亚市天涯区凤凰镇芒果村', { details: '凤凰镇芒果村', code: '460204' }], ['海南省海南省白沙黎族自治县海南省省直辖县级行政区划白沙黎族自治县海南省白沙黎族自治县牙叉农场老机关九栋107号', { details: '牙叉农场老机关九栋107号' }], ['海南省三亚市天涯区收货人吴艾培手机号码17689751439所在地区海南省三亚市吉阳区国营南新农场详细地址三亚富春山居', { name: '吴艾培', details: '吉阳区国营南新农场 三亚富春山居' }], ['广东省东莞市东莞市塘厦塘镇东莞市印中电子厂林村林东三路16号', { details: '塘厦塘镇东莞市印中电子厂林村林东三路16号' }], ['黑龙江齐齐哈尔市梅里斯区', '230208'], ['江西上饶市广信区华坛山镇', '361104'], ['重庆石柱县南宾街道', '500240']];
var list = [['福建省福州市福清市石竹街道义明综合楼3F,15000000000,asseek', '350181'], ['福建省福清市石竹街道义明综合楼3F,15000000000,asseek', '350181'], ['福州市福清市石竹街道义明综合楼3F,15000000000,asseek', '350181'], ['福清市石竹街道义明综合楼3F,15000000000,asseek', '350181'], ['浙江省温州市乐清柳市镇', '330382'], ['李xx 13512222322 广西壮族自治区 桂林市 恭城瑶族自治县 恭城镇拱辰东路xx-xx号', '450332'], ['李xx 13512222222 恭城 恭城镇拱辰东路08-88号', '450332'], ['四川成都高新区天府大道中段530号东方希望天祥广场a座4302号北京万商天勤(成都)律师事务所', '510191'], '房pp,18263333333,山东省 德州市 乐陵市 市中街道怡然居小区,253600', ['张y,18802222222,黑龙江省 哈尔滨市 道里区 经纬街道经纬七道街,000000', { name: '张y' }], ['深圳市龙华新区民治街道办民乐新村。陆xg15822222222', { name: '陆xg' }], '张l,15222222222,内蒙古自治区 呼和浩特市 和林格尔县 盛乐经济工业园区内蒙古师范大学盛乐校区十三号楼,011500', ['张l,15222222222,和林格尔 盛乐经济工业园区内蒙古师范大学盛乐校区十三号楼,011500', '150123'], '上海市徐汇区 复兴中路1237号 5楼WeWork 200010 柚子', ['龙湖区黄山路潮华雅居10栋000房 肖小姐', { code: '440507', name: '肖小姐' }], ['西安市雁塔区丈八东路晶城秀府7号楼2单元 李飞', { code: '610113', name: '李飞' }], ['湖北省安陆市西亚小铺,文元13377777788', { code: '420982', name: '文元' }], ['福建宁德福鼎太姥山镇岭后路。 丹', { code: '350982', name: '丹' }], ['南京市雨花区小行路58号名城世家花园', '320114'], ['四川省阆中市', '511381'], ['北京市市辖区东城区嘿嘿 嘿嘿 18031491271', { code: '110101', name: '嘿嘿' }], ['福建省福州市福清市台江公寓', '350181'], ['山东省青岛市平度市南村镇亭兰 张13668888888', { code: '370283', name: '张' }], ['佛山市南海区盐步 穗盐路景裕嘉园1期 13609770999 大旋仔', { name: '大旋仔' }], ['广东省 东莞市 东城街道', { details: '', code: '441916' }], ['山东省青岛平度市南村镇', '370283'], ['重庆市县城口县', '500229'], ['上海 上海市 浦东区 asd,大liu, ', '310115'], ['吐鲁番市吐鲁番宾馆', '650400'], ['新疆伊宁市上海城徐汇苑23号楼5单元401室', '654002'], ['重庆忠县', '500233'], ['湖北神农架太阳村10组', '429021'], ['广东省惠来县惠城镇南门西路209号', '445224'], ['江苏省靖江市江阴经济开发区靖江园区五星村里面的江阴经济开发区', { details: '江阴经济开发区靖江园区五星村里面的江阴经济开发区' }], ['北京市密云区花园小区1楼三单元30115801691123 唐娜明收', { mobile: '15801691123' }], ['重庆市永川区南大街街道重庆文理学院', '500118'], ['18112341234 上海奉贤区南桥镇程普路123号上海可通营业部 朱某某', { code: '310120', name: '朱某某' }], ['18112341234 天津大港区大港油田花园路123号 刘某某', { code: '120100', name: '刘某某' }], ['海南省三亚市天涯区海南省三亚市天涯区凤凰镇芒果村', { details: '凤凰镇芒果村', code: '460204' }], ['海南省海南省白沙黎族自治县海南省省直辖县级行政区划白沙黎族自治县海南省白沙黎族自治县牙叉农场老机关九栋107号', { details: '牙叉农场老机关九栋107号' }], ['海南省三亚市天涯区收货人吴艾培手机号码17689751439所在地区海南省三亚市吉阳区国营南新农场详细地址三亚富春山居', { name: '吴艾培', details: '吉阳区国营南新农场 三亚富春山居' }], ['广东省东莞市东莞市塘厦塘镇东莞市印中电子厂林村林东三路16号', { details: '塘厦塘镇东莞市印中电子厂林村林东三路16号' }], ['黑龙江齐齐哈尔市梅里斯区', '230208'], ['江西上饶市广信区华坛山镇', '361104'], ['重庆石柱县南宾街道', '500240'], ['您用安全的包装发到这个地址:江苏省南京市玄武区 珠江路498号 未来城B座946室 杨寅13913018489 里面用纸条备注下旺旺ID 以及硬盘问题 快递麻烦不要到付 不要发顺丰 什么便宜发什么 邮费我们会打您支付宝账户(如果是硬盘本身问题) 硬盘务必包装好 不能有外伤 麻烦了\n' + '请勿发 百世快递,谢谢', { name: '杨寅' }]];

console.time('测试地址解析耗时');
var result1 = addressParseTest(list);
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>address-parse</title>
<script src="js/bundle.js?v=1.2.17"></script>
<script src="js/bundle.js?v=1.2.18"></script>
</head>
<body>
<h1>address parse 地址解析测试</h1>
Expand Down
2 changes: 1 addition & 1 deletion docs/js/bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "address-parse",
"author": "akebe <[email protected]>",
"version": "1.2.17",
"version": "1.2.18",
"description": "cn address parse",
"main": "dist/parse/index.js",
"devDependencies": {
Expand All @@ -22,7 +22,7 @@
"address-parse"
],
"dependencies": {
"address-parse": "^1.2.17"
"address-parse": "^1.2.18"
},
"scripts": {
"build": "babel src -d dist --presets es2015,stage-2",
Expand Down
12 changes: 6 additions & 6 deletions src/parse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ParseAddress {
static ParseArea = new ParseArea();

static Reg = {
...Utils.Reg,
...Utils.Reg
};

constructor(address) {
Expand All @@ -35,7 +35,7 @@ class ParseAddress {
this.result = {
mobile: '',
zip_code: '',
phone: '',
phone: ''
};

this.address = address;
Expand All @@ -62,7 +62,7 @@ class ParseAddress {
details: this.address,
name: '',
code: '',
__type: '',
__type: ''
});
ParseAddress.parseName(result);
results.push(result);
Expand Down Expand Up @@ -127,11 +127,11 @@ class ParseAddress {
* @param firstName 最初切分地址识别到的name
*/
static parseName(result, {maxLen = 11, firstName} = {}) {
if (!result.name) {
if (!result.name || Utils.strLen(result.name) > 15) {
const list = result.details.split(' ');
const name = {
value: '',
index: -1,
index: -1
};
if (list.length > 1) {
let index = 0;
Expand Down Expand Up @@ -173,7 +173,7 @@ class ParseAddress {
export {
ParseAddress,
AREA,
Utils,
Utils
};

export default new ParseAddress();
Expand Down
2 changes: 2 additions & 0 deletions src/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ const list = [
['黑龙江齐齐哈尔市梅里斯区', '230208'],
['江西上饶市广信区华坛山镇', '361104'],
['重庆石柱县南宾街道', '500240'],
['您用安全的包装发到这个地址:江苏省南京市玄武区 珠江路498号 未来城B座946室 杨寅13913018489 里面用纸条备注下旺旺ID 以及硬盘问题 快递麻烦不要到付 不要发顺丰 什么便宜发什么 邮费我们会打您支付宝账户(如果是硬盘本身问题) 硬盘务必包装好 不能有外伤 麻烦了\n' +
'请勿发 百世快递,谢谢',{name:'杨寅'}]
];

console.time('测试地址解析耗时');
Expand Down

0 comments on commit b189862

Please sign in to comment.