From 9a756c9f4d24ed404f264715d7a58fe0295cb367 Mon Sep 17 00:00:00 2001 From: Phoenix Gao Date: Mon, 6 Jul 2015 11:21:21 +0800 Subject: [PATCH 1/3] Correct Chinese names The first part of a Chinese name is the family name --- src/Faker/Provider/zh_CN/Person.php | 89 ++++++++++++++++++----------- 1 file changed, 57 insertions(+), 32 deletions(-) diff --git a/src/Faker/Provider/zh_CN/Person.php b/src/Faker/Provider/zh_CN/Person.php index d1d1c5cacb..6a51adeeec 100644 --- a/src/Faker/Provider/zh_CN/Person.php +++ b/src/Faker/Provider/zh_CN/Person.php @@ -5,45 +5,70 @@ class Person extends \Faker\Provider\Person { protected static $maleNameFormats = array( - '{{firstNameMale}}{{lastName}}', + '{{lastName}}{{firstNameMale}}', ); protected static $femaleNameFormats = array( - '{{firstNameFemale}}{{lastName}}', + '{{lastName}}{{firstNameFemale}}', ); - protected static $firstNameMale = array( - '任', '彭', '杨', '林', '毛', '胡', '陈', '雷', '龙', - // below are unknown gender firstnames - '丁', '万', '严', '于', '何', '余', '侯', '傅', '冯', '刘', '卢', '史', '叶', - '吕', '吴', '周', '唐', '夏', '姚', '姜', '孔', '孙', '宋', '崔', '廖', - '张', '徐', '方', '曹', '曾', '朱', '李', '杜', '梁', '武', '段', '江', - '汪', '沈', '洪', '潘', '熊', '王', '田', '白', '秦', '程', '罗', '苏', - '范', '莫', '萧', '董', '蒋', '蔡', '薛', '袁', '覃', '许', '谢', '谭', - '贺', '贾', '赖', '赵', '邓', '邱', '邵', '邹', '郝', '郭', '金', '钟', - '钱', '阎', '陆', '陶', '韦', '韩', '顾', '马', '高', '魏', '黄', '黎', - '龚', + protected static $lastName = array( + // These are the top 300 lastnames. + '李','王','张','刘','陈','杨','赵','黄','周','吴', + '徐','孙','胡','朱','高','林','何','郭','马','罗', + '梁','宋','郑','谢','韩','唐','冯','于','董','萧', + '程','曹','袁','邓','许','傅','沉','曾','彭','吕', + '苏','卢','蒋','蔡','贾','丁','林','薛','叶','阎', + '余','潘','杜','戴','夏','钟','汪','田','任','姜', + '范','方','石','姚','谭','廖','邹','熊','金','陆', + '郝','孔','白','崔','康','毛','邱','秦','江','史', + '顾','侯','邵','孟','龙','万','段','雷','钱','汤', + '尹','黎','易','常','武','乔','贺','赖','龚','文', + '庞','樊','兰','殷','施','陶','洪','翟','安','颜', + '倪','严','牛','温','芦','季','俞','章','鲁','葛', + '伍','韦','申','尤','毕','聂','丛','焦','向','柳', + '邢','路','岳','齐','沿','梅','莫','庄','辛','管', + '祝','左','涂','谷','祁','时','舒','耿','牟','卜', + '路','詹','关','苗','凌','费','纪','靳','盛','童', + '欧','甄','项','曲','成','游','阳','裴','席','卫', + '查','屈','鲍','位','覃','霍','翁','隋','植','甘', + '景','薄','单','包','司','柏','宁','柯','阮','桂', + '闵','欧阳','解','强','柴','华','车','冉','房','边', + '辜','吉','饶','刁','瞿','戚','丘','古','米','池', + '滕','晋','苑','邬','臧','畅','宫','来','嵺','苟', + '全','褚','廉','简','娄','盖','符','奚','木','穆', + '党','燕','郎','邸','冀','谈','姬','屠','连','郜', + '晏','栾','郁','商','蒙','计','喻','揭','窦','迟', + '宇','敖','糜','鄢','冷','卓','花','仇','艾','蓝', + '都','巩','稽','井','练','仲','乐','虞','卞','封', + '竺','冼','原','官','衣','楚','佟','栗','匡','宗', + '应','台','巫','鞠','僧','桑','荆','谌','银','扬', + '明','沙','薄','伏','岑','习','胥','保','和','蔺', ); - protected static $firstNameFemale = array( - '孟', '尹', '戴', '石', '郑', - // below are unknown gender firstnames - '丁', '万', '严', '于', '何', '余', '侯', '傅', '冯', '刘', '卢', '史', '叶', - '吕', '吴', '周', '唐', '夏', '姚', '姜', '孔', '孙', '宋', '崔', '廖', - '张', '徐', '方', '曹', '曾', '朱', '李', '杜', '梁', '武', '段', '江', - '汪', '沈', '洪', '潘', '熊', '王', '田', '白', '秦', '程', '罗', '苏', - '范', '莫', '萧', '董', '蒋', '蔡', '薛', '袁', '覃', '许', '谢', '谭', - '贺', '贾', '赖', '赵', '邓', '邱', '邵', '邹', '郝', '郭', '金', '钟', - '钱', '阎', '陆', '陶', '韦', '韩', '顾', '马', '高', '魏', '黄', '黎', - '龚', + protected static $firstNameMale = array( + '伟','强','磊','洋','勇','军','杰','涛','超','明', + '刚','平','辉','鹏','华','飞','鑫','波','斌','宇', + '浩','凯','健','俊','帆','帅','旭','宁','龙','林', + '欢','阳','建华','亮','成','畅','建','峰','建国','建军', + '晨','瑞','志强','兵','雷','东','欣','博','彬','坤', + '全安','荣','岩','杨','文','利','楠','建平','嘉俊','晧', + '建明','子安','新华','鹏程','学明','博涛','捷','文彬','楼','鹰', + '松','伦','超','钟','瑜','振国','洪','毅','昱然','哲', + '翔','翼','祥','国庆','哲彦','正诚','正豪','正平','正业','志诚', + '志新','志勇','志明','志强','志文','致远','智明','智勇','智敏','智渊', ); - - protected static $lastName = array( - '伟','芳','娜','敏','静','秀英','丽','强','磊','洋','艳','勇','军','杰','娟','涛','超','明','霞','秀兰','刚','平','燕','辉', - '玲','桂英','丹','萍','鹏','华','红','玉兰','飞','桂兰','英','梅','鑫','波','斌','莉','宇','浩','凯','秀珍','健','俊','帆', - '雪','帅','慧','旭','宁','婷','玉梅','龙','林','玉珍','凤英','晶','欢','玉英','颖','红梅','佳','倩','阳','建华','亮','成', - '琴','兰英','畅','建','云','洁','峰','建国','建军','柳','淑珍','春梅','海燕','晨','冬梅','秀荣','瑞','桂珍','莹','秀云','桂荣', - '志强','秀梅','丽娟','婷婷','玉华','兵','雷','东','琳','雪梅','淑兰','丽丽','玉','秀芳','欣','淑英','桂芳','博','丽华','丹丹', - '彬','桂香','坤','想','淑华','荣','秀华','桂芝','岩','杨','小红','金凤','文','利','楠','红霞','建平','瑜','桂花','璐','凤兰' + + protected static $firstNameFemale = array( + '芳','娜','敏','静','敏静','秀英','丽','洋','艳','娟', + '文娟','君','文君','珺','霞','明霞','秀兰','燕','芬','桂芬', + '玲','桂英','丹','萍','华','红','玉兰','桂兰','英','梅', + '莉','秀珍','雪','依琳','旭','宁','婷','馨予','玉珍','凤英', + '晶','欢','玉英','颖','红梅','佳','倩','琴','兰英','云', + '洁','爱华','淑珍','春梅','海燕','晨','冬梅','秀荣','瑞','桂珍', + '莹','秀云','桂荣','秀梅','丽娟','婷婷','玉华','琳','雪梅','淑兰', + '丽丽','玉','秀芳','欣','淑英','桂芳','丽华','丹丹','桂香','淑华', + '秀华','桂芝','小红','金凤','文','利','楠','红霞','瑜','桂花', + '璐','凤兰','腊梅','瑶','嘉','怡','冰冰','玉梅','慧','婕', ); } From 04668e4a2156a4dda00a2b0c3c522af9becadfb6 Mon Sep 17 00:00:00 2001 From: Phoenix Gao Date: Mon, 6 Jul 2015 18:10:00 +0800 Subject: [PATCH 2/3] Add data source --- src/Faker/Provider/zh_CN/Person.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Faker/Provider/zh_CN/Person.php b/src/Faker/Provider/zh_CN/Person.php index 6a51adeeec..349406d577 100644 --- a/src/Faker/Provider/zh_CN/Person.php +++ b/src/Faker/Provider/zh_CN/Person.php @@ -13,7 +13,10 @@ class Person extends \Faker\Provider\Person ); protected static $lastName = array( - // These are the top 300 lastnames. + // According to http://baike.baidu.com/view/6109935.htm, + // these are the top 300 lastnames from the 6th Chinese national census of population, + // containing 299 single-character surname and 1 double-character surname '欧阳', + // so you can get random names including double-character surname but not too many. '李','王','张','刘','陈','杨','赵','黄','周','吴', '徐','孙','胡','朱','高','林','何','郭','马','罗', '梁','宋','郑','谢','韩','唐','冯','于','董','萧', From 7f056f4c0e242d6b63ba29d61c2e512dc33a2621 Mon Sep 17 00:00:00 2001 From: Phoenix Gao Date: Tue, 7 Jul 2015 00:25:59 +0800 Subject: [PATCH 3/3] update comment format --- src/Faker/Provider/zh_CN/Person.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Faker/Provider/zh_CN/Person.php b/src/Faker/Provider/zh_CN/Person.php index 349406d577..17d48de429 100644 --- a/src/Faker/Provider/zh_CN/Person.php +++ b/src/Faker/Provider/zh_CN/Person.php @@ -12,11 +12,13 @@ class Person extends \Faker\Provider\Person '{{lastName}}{{firstNameFemale}}', ); + /** + * According to http://baike.baidu.com/view/6109935.htm, + * these are the top 300 lastnames from the 6th Chinese national census of population, + * containing 299 single-character surname and 1 double-character surname '欧阳', + * so you can get random names including double-character surname but not too many. + */ protected static $lastName = array( - // According to http://baike.baidu.com/view/6109935.htm, - // these are the top 300 lastnames from the 6th Chinese national census of population, - // containing 299 single-character surname and 1 double-character surname '欧阳', - // so you can get random names including double-character surname but not too many. '李','王','张','刘','陈','杨','赵','黄','周','吴', '徐','孙','胡','朱','高','林','何','郭','马','罗', '梁','宋','郑','谢','韩','唐','冯','于','董','萧',