test-mingzi


Nametest-mingzi JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
Summary这是一个用来生成随机中文姓名的包。This is a library for developers to use to generate random Chinese names.
upload_time2024-04-20 06:43:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3.5
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## mingzi
这是一个用来生成随机中文姓名的包。

This is a library for developers to use to generate random Chinese names.

本包全部使用python标准模块,不依赖于标准Python发行版之外的模块或包。

This package uses all standard python modules and does not rely on modules or packages outside the standard Python distribution.


## Project Origin

几个月以前,作者在对一个中学的数据库进行测试时,需要用到大量的随机中文姓名,发现似乎缺少能很好地满足这一需求的包,因而开始了这个项目。

A few months ago, the author was testing a high school database with a large number of random Chinese names, and found that there seemed to be a lack of packages that could meet this need well, so started the project.

## Installation

```{python}
pip install mingzi
```


## Quick Start

```{python}
from mingzi.mingzi import *
mingzi()
>>> ['崔依梅']
mingzi()
>>> ['崔曦']
```


## Batch Production

您可以通过控制```volume```参数来控制输出的随机姓名的数量,从而批量得到多个姓名。

You can get multiple names in batches by controlling the ```volume``` parameter to control the number of random names that are output.

```{python}
mingzi(volume=5)
>>> [['温悠', '女'], ['李嘉茵', '女'], ['孟虚', '男'], ['王俊', '男'], ['周伦', '男']]
```


## Output Gender Information

像世界上大多数其他国家一样,你可以从我们中国人的姓名大致知道其性别。为了满足开发中的实际需要,你可以通过 ```show_gender``` 参数来控制是否输出姓名的性别信息。

Like in most other countries in the world, you can roughly know our Chinese person's gender from their name. In order to meet the practical needs of development, you can use the ```show_gender``` parameter to control whether to output the gender information of the name.

```{python}
mingzi(volume=5, show_gender=True)
>>> [['范若翰', '男'], ['邓铭锵', '男'], ['刘贝韵', '女'], ['施喆', '男'], ['陈楚悦', '女']]
```


## Proportion of Female Names

你可以通过 ```female_rate``` 参数来控制生成女性姓名的概率,进而控制最终姓名列表中女性姓名所占的比例,这一参数默认为0.49,即为中国目前(2024年)人口女性比例。

You can control the probability of generating female names by the ```female_rate``` parameter, and then control the proportion of female names in the final name list. This parameter defaults to 0.49, which is the proportion of women in China's current (2024) population.

```{python}
mingzi(volume=10, female_rate=0.8, show_gender=True)
>>> [['徐育', '女'], ['蔡裳', '女'], ['徐筱', '女'], ['张濯', '男'], ['章松芬', '女'], ['杨熙岩', '男'], ['陈楚菱', '女'], ['阳笛', '女'], ['陈贝韵', '女'], ['杨邦', '男']]
```

显而易见,如果这一参数为0,那么就只输出男性姓名。

Obviously, if this parameter is 0, then only the male name is printed.

```{python}
mingzi(volume=10, female_rate=0, show_gender=True)
>>> [['黄云诺', '男'], ['林祯卓', '男'], ['余东', '男'], ['刘书', '男'], ['陈茂彦', '男'], ['王柒', '男'], ['梁明泉', '男'], ['张秦齐', '男'], ['杨信霖', '男'], ['唐澈', '男']]
```

反过来说,如果这一参数为1,那么就只输出女性姓名。

Conversely, if this parameter is 1, only the female name is printed.

```{python}
mingzi(volume=10, female_rate=1, show_gender=True)
>>> [['梁偌瑾', '女'], ['徐莉菲', '女'], ['胡丹', '女'], ['张楚悦', '女'], ['刘若娜', '女'], ['祝楚', '女'], ['李梓琪', '女'], ['孟嘉茵', '女'], ['刘嘉茵', '女'], ['蔡雯', '女']]
```


## Probability of Different Surnames

中国人的姓名由姓氏和名字组成,中国人的姓氏对应于欧美姓名中的“last name”,不同的姓氏在人口中占有不同的比例。你以笔者的姓氏,“李姓”为例,这个比例大概在百分之七左右,在设计这个包的时候,这一点得到了妥善的考虑:不同的姓氏在输出数据中占有的不同的比例,具体参考于当前的人口统计数据。

Chinese names consist of surnames and first names, Chinese surnames correspond to the "last name" in European and American names, and different surnames occupy different proportions in the population. If you take the author's last name, "李" for example, the percentage is around seven percent, which was properly taken into account when designing the package: different surnames account for different percentages in the output data, specific to the current demographic data.

如果你是国人的话,你能从如下测试数据中很容易地发现,这和我们的日常经验是相符的。

If you are a Chinese, you can easily see from the following test data, which is consistent with our daily experience.

```{python}
mingzi(volume=100)
>>> ['刘灏风', '叶松', '宋恬', '赵秦齐', '何怡芬', '余伟', '唐平', '吴忆狄', '黄书', '于琪纯', '傅娴', '罗菲', '徐宇', '张风', '李雁楚', '童虞', '李虚', '陈稹', '宋语', '陈拾', '刘彰', '潘任', '孙晨纶', '汤元', '江永茂', '张生', '贾昭美', '韦科', '吴哲', '王盛', '徐娅', '朱诗', '胡鑫', '姜翠', '魏谚', '梁泽商', '王嘉茵', '孙拾', '秦艳', '傅娴', '刘菁', '周蒙', '韦曦', '李痴', '吴偌瑾', '谢雄', '李宇军', '胡佳禾', '程丽', '史鸣哲', '陈若翰', '锺宁', '史自昊', '罗书琴', '潘觅', '孙璥', '陈泽商', '舒莉', '薛聪', '张锋玮', '杨熙岩', '王泰骞', '孙娥', '楼函', '魏妮', '向珅南', '高蓝', '吴若娜', '李茂', '马群', '陈君', '王青熙', '易新菱', '叶令', '王舞', '王茂彦', '李纹窈', '陈旭平', '李万信', '孔松樱', '苗松芬', '田希嫣', '张奕', '李林', '蓝慕巧', '李觅蕴', '孔希嫣', '罗州', '马行', '汤宇', '苏晴茹', '陈阳', '杨梓琪', '陈赫', '王霄', '郭霆', '刘雅妙', '刘秦恒', '王纹窈', '马峰']

```

然而,你可以通过```alt_surname```参数来人为控制输出中姓氏的组成,这是个参数是一个默认为空的列表。如果此列表非空,那么输出的姓名的姓氏仅仅从这个列表中给出,而且每个备选项出现的概率均等。

However, you can artificially control the composition of the surname in the output with the ```alt_surname``` parameter, which is a list that defaults to empty. If the list is not empty, then the last name of the output name is given only from this list, and each alternative appears with equal probability.

以下将输出10个姓氏为“李”的姓名。

The following will output 10 names with the last name "李".

```{python}
mingzi(mingzi(volume=10, alt_surname=["李"]))
>>> ['李朋', '李松樱', '李绿', '李林灏', '李纹珊', '李媛倚', '李璇兰', '李薇', '李忆狄', '李鹃']
```

以下将输出100个姓氏为“李”,或者“张”,或者“王”的姓名,其中每个姓氏出现的概率为33%。

The following will output 100 names with the surname "李", "张", or "王", each of which has a 33% probability of occurrence.

```{python}
mingzi(volume=25, alt_surname=["李","张","王"])
>>> ['王清媛', '李茂', '张媛倚', '王荷菲', '李玫', '王馥', '张澈', '张瑾', '王咏', '王好', '李奕宗', '王豆', '李晴茹', '张苑', '王雅惠', '李舒志', '张冰', '李豆', '李楚悦', '张听', '李羽', '张滨义', '张荷菲', '李熙岩', '张林灏']
```


## Complex Surname

少数中国人的姓氏由两个汉字组成,也就是“复姓”,复姓人口在中国占有的比例很少,只有大概千分之一,然而你可以通过调整```com_rate```参数的大小,来调整这一比例,来提高输出数据中复姓姓名的比例,这在某些情形,你比如说为一个武侠游戏生成测试数据和素材,是很有必要的。

A few Chinese surnames are composed of two Chinese characters, namely "compound surname". The proportion of compound surname population in China is very small, only about one thousand. However, you can adjust this proportion by adjusting the size of ```com_rate``` parameter, so as to increase the proportion of compound surname in output data. It is necessary for you to generate test data and material for, say, a martial arts game.

```{python}
mingzi(volume=10, com_rate=0.9)
>>> ['申屠素卿', '单于怡芬', '呼延莎', '刘清滢', '姚玥', '公良雁楚', '吴嘉茵', '夏侯凌', '公羊冰', '巫马昶']

```


## Single Names

绝大多数中国人的名字是单字名或者双字名,此包也仅仅生成这两种类型的名字。你可以通过 ```single_rate``` 来控制输出的姓名中单字名的比例,这个变量的缺省值为0.14,即为目前统计数据显示的中国单字名在全部人口中所占的比例。

The vast majority of Chinese names are single-word or double-word names, and this package generates only those two types of names. You can control the proportion of single names in the output by ```single_rate```. The default value of this variable is 0.14, which is the proportion of Chinese single names in the total population as shown in the current statistics.

```{python}
mingzi(volume=10, single_rate=0.7)
>>> ['魏炫灿', '康文芝', '赵贻', '张南', '杜靖', '罗茵', '杨凯', '周燕', '谷浦宇', '陈君']

```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "test-mingzi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Aliyacs Souna <17818403529@139.com>",
    "download_url": "https://files.pythonhosted.org/packages/29/95/06b4c6f3e005a080160c0c28ed687dfc2edf31b6143ce687660fe4a29ded/test_mingzi-1.1.1.tar.gz",
    "platform": null,
    "description": "## mingzi\n\u8fd9\u662f\u4e00\u4e2a\u7528\u6765\u751f\u6210\u968f\u673a\u4e2d\u6587\u59d3\u540d\u7684\u5305\u3002\n\nThis is a library for developers to use to generate random Chinese names.\n\n\u672c\u5305\u5168\u90e8\u4f7f\u7528python\u6807\u51c6\u6a21\u5757\uff0c\u4e0d\u4f9d\u8d56\u4e8e\u6807\u51c6Python\u53d1\u884c\u7248\u4e4b\u5916\u7684\u6a21\u5757\u6216\u5305\u3002\n\nThis package uses all standard python modules and does not rely on modules or packages outside the standard Python distribution.\n\n\n## Project Origin\n\n\u51e0\u4e2a\u6708\u4ee5\u524d\uff0c\u4f5c\u8005\u5728\u5bf9\u4e00\u4e2a\u4e2d\u5b66\u7684\u6570\u636e\u5e93\u8fdb\u884c\u6d4b\u8bd5\u65f6\uff0c\u9700\u8981\u7528\u5230\u5927\u91cf\u7684\u968f\u673a\u4e2d\u6587\u59d3\u540d\uff0c\u53d1\u73b0\u4f3c\u4e4e\u7f3a\u5c11\u80fd\u5f88\u597d\u5730\u6ee1\u8db3\u8fd9\u4e00\u9700\u6c42\u7684\u5305\uff0c\u56e0\u800c\u5f00\u59cb\u4e86\u8fd9\u4e2a\u9879\u76ee\u3002\n\nA few months ago, the author was testing a high school database with a large number of random Chinese names, and found that there seemed to be a lack of packages that could meet this need well, so started the project.\n\n## Installation\n\n```{python}\npip install mingzi\n```\n\n\n## Quick Start\n\n```{python}\nfrom mingzi.mingzi import *\nmingzi()\n>>> ['\u5d14\u4f9d\u6885']\nmingzi()\n>>> ['\u5d14\u66e6']\n```\n\n\n## Batch Production\n\n\u60a8\u53ef\u4ee5\u901a\u8fc7\u63a7\u5236```volume```\u53c2\u6570\u6765\u63a7\u5236\u8f93\u51fa\u7684\u968f\u673a\u59d3\u540d\u7684\u6570\u91cf\uff0c\u4ece\u800c\u6279\u91cf\u5f97\u5230\u591a\u4e2a\u59d3\u540d\u3002\n\nYou can get multiple names in batches by controlling the ```volume``` parameter to control the number of random names that are output.\n\n```{python}\nmingzi(volume=5)\n>>> [['\u6e29\u60a0', '\u5973'], ['\u674e\u5609\u8335', '\u5973'], ['\u5b5f\u865a', '\u7537'], ['\u738b\u4fca', '\u7537'], ['\u5468\u4f26', '\u7537']]\n```\n\n\n## Output Gender Information\n\n\u50cf\u4e16\u754c\u4e0a\u5927\u591a\u6570\u5176\u4ed6\u56fd\u5bb6\u4e00\u6837\uff0c\u4f60\u53ef\u4ee5\u4ece\u6211\u4eec\u4e2d\u56fd\u4eba\u7684\u59d3\u540d\u5927\u81f4\u77e5\u9053\u5176\u6027\u522b\u3002\u4e3a\u4e86\u6ee1\u8db3\u5f00\u53d1\u4e2d\u7684\u5b9e\u9645\u9700\u8981\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7 ```show_gender``` \u53c2\u6570\u6765\u63a7\u5236\u662f\u5426\u8f93\u51fa\u59d3\u540d\u7684\u6027\u522b\u4fe1\u606f\u3002\n\nLike in most other countries in the world, you can roughly know our Chinese person's gender from their name. In order to meet the practical needs of development, you can use the ```show_gender``` parameter to control whether to output the gender information of the name.\n\n```{python}\nmingzi(volume=5, show_gender=True)\n>>> [['\u8303\u82e5\u7ff0', '\u7537'], ['\u9093\u94ed\u9535', '\u7537'], ['\u5218\u8d1d\u97f5', '\u5973'], ['\u65bd\u5586', '\u7537'], ['\u9648\u695a\u60a6', '\u5973']]\n```\n\n\n## Proportion of Female Names\n\n\u4f60\u53ef\u4ee5\u901a\u8fc7 ```female_rate``` \u53c2\u6570\u6765\u63a7\u5236\u751f\u6210\u5973\u6027\u59d3\u540d\u7684\u6982\u7387\uff0c\u8fdb\u800c\u63a7\u5236\u6700\u7ec8\u59d3\u540d\u5217\u8868\u4e2d\u5973\u6027\u59d3\u540d\u6240\u5360\u7684\u6bd4\u4f8b\uff0c\u8fd9\u4e00\u53c2\u6570\u9ed8\u8ba4\u4e3a0.49\uff0c\u5373\u4e3a\u4e2d\u56fd\u76ee\u524d(2024\u5e74)\u4eba\u53e3\u5973\u6027\u6bd4\u4f8b\u3002\n\nYou can control the probability of generating female names by the ```female_rate``` parameter, and then control the proportion of female names in the final name list. This parameter defaults to 0.49, which is the proportion of women in China's current (2024) population.\n\n```{python}\nmingzi(volume=10, female_rate=0.8, show_gender=True)\n>>> [['\u5f90\u80b2', '\u5973'], ['\u8521\u88f3', '\u5973'], ['\u5f90\u7b71', '\u5973'], ['\u5f20\u6fef', '\u7537'], ['\u7ae0\u677e\u82ac', '\u5973'], ['\u6768\u7199\u5ca9', '\u7537'], ['\u9648\u695a\u83f1', '\u5973'], ['\u9633\u7b1b', '\u5973'], ['\u9648\u8d1d\u97f5', '\u5973'], ['\u6768\u90a6', '\u7537']]\n```\n\n\u663e\u800c\u6613\u89c1\uff0c\u5982\u679c\u8fd9\u4e00\u53c2\u6570\u4e3a0\uff0c\u90a3\u4e48\u5c31\u53ea\u8f93\u51fa\u7537\u6027\u59d3\u540d\u3002\n\nObviously, if this parameter is 0, then only the male name is printed.\n\n```{python}\nmingzi(volume=10, female_rate=0, show_gender=True)\n>>> [['\u9ec4\u4e91\u8bfa', '\u7537'], ['\u6797\u796f\u5353', '\u7537'], ['\u4f59\u4e1c', '\u7537'], ['\u5218\u4e66', '\u7537'], ['\u9648\u8302\u5f66', '\u7537'], ['\u738b\u67d2', '\u7537'], ['\u6881\u660e\u6cc9', '\u7537'], ['\u5f20\u79e6\u9f50', '\u7537'], ['\u6768\u4fe1\u9716', '\u7537'], ['\u5510\u6f88', '\u7537']]\n```\n\n\u53cd\u8fc7\u6765\u8bf4\uff0c\u5982\u679c\u8fd9\u4e00\u53c2\u6570\u4e3a1\uff0c\u90a3\u4e48\u5c31\u53ea\u8f93\u51fa\u5973\u6027\u59d3\u540d\u3002\n\nConversely, if this parameter is 1, only the female name is printed.\n\n```{python}\nmingzi(volume=10, female_rate=1, show_gender=True)\n>>> [['\u6881\u504c\u747e', '\u5973'], ['\u5f90\u8389\u83f2', '\u5973'], ['\u80e1\u4e39', '\u5973'], ['\u5f20\u695a\u60a6', '\u5973'], ['\u5218\u82e5\u5a1c', '\u5973'], ['\u795d\u695a', '\u5973'], ['\u674e\u6893\u742a', '\u5973'], ['\u5b5f\u5609\u8335', '\u5973'], ['\u5218\u5609\u8335', '\u5973'], ['\u8521\u96ef', '\u5973']]\n```\n\n\n## Probability of Different Surnames\n\n\u4e2d\u56fd\u4eba\u7684\u59d3\u540d\u7531\u59d3\u6c0f\u548c\u540d\u5b57\u7ec4\u6210\uff0c\u4e2d\u56fd\u4eba\u7684\u59d3\u6c0f\u5bf9\u5e94\u4e8e\u6b27\u7f8e\u59d3\u540d\u4e2d\u7684\u201clast name\u201d\uff0c\u4e0d\u540c\u7684\u59d3\u6c0f\u5728\u4eba\u53e3\u4e2d\u5360\u6709\u4e0d\u540c\u7684\u6bd4\u4f8b\u3002\u4f60\u4ee5\u7b14\u8005\u7684\u59d3\u6c0f\uff0c\u201c\u674e\u59d3\u201d\u4e3a\u4f8b\uff0c\u8fd9\u4e2a\u6bd4\u4f8b\u5927\u6982\u5728\u767e\u5206\u4e4b\u4e03\u5de6\u53f3\uff0c\u5728\u8bbe\u8ba1\u8fd9\u4e2a\u5305\u7684\u65f6\u5019\uff0c\u8fd9\u4e00\u70b9\u5f97\u5230\u4e86\u59a5\u5584\u7684\u8003\u8651\uff1a\u4e0d\u540c\u7684\u59d3\u6c0f\u5728\u8f93\u51fa\u6570\u636e\u4e2d\u5360\u6709\u7684\u4e0d\u540c\u7684\u6bd4\u4f8b\uff0c\u5177\u4f53\u53c2\u8003\u4e8e\u5f53\u524d\u7684\u4eba\u53e3\u7edf\u8ba1\u6570\u636e\u3002\n\nChinese names consist of surnames and first names, Chinese surnames correspond to the \"last name\" in European and American names, and different surnames occupy different proportions in the population. If you take the author's last name, \"\u674e\" for example, the percentage is around seven percent, which was properly taken into account when designing the package: different surnames account for different percentages in the output data, specific to the current demographic data.\n\n\u5982\u679c\u4f60\u662f\u56fd\u4eba\u7684\u8bdd\uff0c\u4f60\u80fd\u4ece\u5982\u4e0b\u6d4b\u8bd5\u6570\u636e\u4e2d\u5f88\u5bb9\u6613\u5730\u53d1\u73b0\uff0c\u8fd9\u548c\u6211\u4eec\u7684\u65e5\u5e38\u7ecf\u9a8c\u662f\u76f8\u7b26\u7684\u3002\n\nIf you are a Chinese, you can easily see from the following test data, which is consistent with our daily experience.\n\n```{python}\nmingzi(volume=100)\n>>> ['\u5218\u704f\u98ce', '\u53f6\u677e', '\u5b8b\u606c', '\u8d75\u79e6\u9f50', '\u4f55\u6021\u82ac', '\u4f59\u4f1f', '\u5510\u5e73', '\u5434\u5fc6\u72c4', '\u9ec4\u4e66', '\u4e8e\u742a\u7eaf', '\u5085\u5a34', '\u7f57\u83f2', '\u5f90\u5b87', '\u5f20\u98ce', '\u674e\u96c1\u695a', '\u7ae5\u865e', '\u674e\u865a', '\u9648\u7a39', '\u5b8b\u8bed', '\u9648\u62fe', '\u5218\u5f70', '\u6f58\u4efb', '\u5b59\u6668\u7eb6', '\u6c64\u5143', '\u6c5f\u6c38\u8302', '\u5f20\u751f', '\u8d3e\u662d\u7f8e', '\u97e6\u79d1', '\u5434\u54f2', '\u738b\u76db', '\u5f90\u5a05', '\u6731\u8bd7', '\u80e1\u946b', '\u59dc\u7fe0', '\u9b4f\u8c1a', '\u6881\u6cfd\u5546', '\u738b\u5609\u8335', '\u5b59\u62fe', '\u79e6\u8273', '\u5085\u5a34', '\u5218\u83c1', '\u5468\u8499', '\u97e6\u66e6', '\u674e\u75f4', '\u5434\u504c\u747e', '\u8c22\u96c4', '\u674e\u5b87\u519b', '\u80e1\u4f73\u79be', '\u7a0b\u4e3d', '\u53f2\u9e23\u54f2', '\u9648\u82e5\u7ff0', '\u953a\u5b81', '\u53f2\u81ea\u660a', '\u7f57\u4e66\u7434', '\u6f58\u89c5', '\u5b59\u74a5', '\u9648\u6cfd\u5546', '\u8212\u8389', '\u859b\u806a', '\u5f20\u950b\u73ae', '\u6768\u7199\u5ca9', '\u738b\u6cf0\u9a9e', '\u5b59\u5a25', '\u697c\u51fd', '\u9b4f\u59ae', '\u5411\u73c5\u5357', '\u9ad8\u84dd', '\u5434\u82e5\u5a1c', '\u674e\u8302', '\u9a6c\u7fa4', '\u9648\u541b', '\u738b\u9752\u7199', '\u6613\u65b0\u83f1', '\u53f6\u4ee4', '\u738b\u821e', '\u738b\u8302\u5f66', '\u674e\u7eb9\u7a88', '\u9648\u65ed\u5e73', '\u674e\u4e07\u4fe1', '\u5b54\u677e\u6a31', '\u82d7\u677e\u82ac', '\u7530\u5e0c\u5ae3', '\u5f20\u5955', '\u674e\u6797', '\u84dd\u6155\u5de7', '\u674e\u89c5\u8574', '\u5b54\u5e0c\u5ae3', '\u7f57\u5dde', '\u9a6c\u884c', '\u6c64\u5b87', '\u82cf\u6674\u8339', '\u9648\u9633', '\u6768\u6893\u742a', '\u9648\u8d6b', '\u738b\u9704', '\u90ed\u9706', '\u5218\u96c5\u5999', '\u5218\u79e6\u6052', '\u738b\u7eb9\u7a88', '\u9a6c\u5cf0']\n\n```\n\n\u7136\u800c\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7```alt_surname```\u53c2\u6570\u6765\u4eba\u4e3a\u63a7\u5236\u8f93\u51fa\u4e2d\u59d3\u6c0f\u7684\u7ec4\u6210\uff0c\u8fd9\u662f\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u9ed8\u8ba4\u4e3a\u7a7a\u7684\u5217\u8868\u3002\u5982\u679c\u6b64\u5217\u8868\u975e\u7a7a\uff0c\u90a3\u4e48\u8f93\u51fa\u7684\u59d3\u540d\u7684\u59d3\u6c0f\u4ec5\u4ec5\u4ece\u8fd9\u4e2a\u5217\u8868\u4e2d\u7ed9\u51fa\uff0c\u800c\u4e14\u6bcf\u4e2a\u5907\u9009\u9879\u51fa\u73b0\u7684\u6982\u7387\u5747\u7b49\u3002\n\nHowever, you can artificially control the composition of the surname in the output with the ```alt_surname``` parameter, which is a list that defaults to empty. If the list is not empty, then the last name of the output name is given only from this list, and each alternative appears with equal probability.\n\n\u4ee5\u4e0b\u5c06\u8f93\u51fa10\u4e2a\u59d3\u6c0f\u4e3a\u201c\u674e\u201d\u7684\u59d3\u540d\u3002\n\nThe following will output 10 names with the last name \"\u674e\".\n\n```{python}\nmingzi(mingzi(volume=10, alt_surname=[\"\u674e\"]))\n>>> ['\u674e\u670b', '\u674e\u677e\u6a31', '\u674e\u7eff', '\u674e\u6797\u704f', '\u674e\u7eb9\u73ca', '\u674e\u5a9b\u501a', '\u674e\u7487\u5170', '\u674e\u8587', '\u674e\u5fc6\u72c4', '\u674e\u9e43']\n```\n\n\u4ee5\u4e0b\u5c06\u8f93\u51fa100\u4e2a\u59d3\u6c0f\u4e3a\u201c\u674e\u201d\uff0c\u6216\u8005\u201c\u5f20\u201d\uff0c\u6216\u8005\u201c\u738b\u201d\u7684\u59d3\u540d\uff0c\u5176\u4e2d\u6bcf\u4e2a\u59d3\u6c0f\u51fa\u73b0\u7684\u6982\u7387\u4e3a33%\u3002\n\nThe following will output 100 names with the surname \"\u674e\", \"\u5f20\", or \"\u738b\", each of which has a 33% probability of occurrence.\n\n```{python}\nmingzi(volume=25, alt_surname=[\"\u674e\",\"\u5f20\",\"\u738b\"])\n>>> ['\u738b\u6e05\u5a9b', '\u674e\u8302', '\u5f20\u5a9b\u501a', '\u738b\u8377\u83f2', '\u674e\u73ab', '\u738b\u99a5', '\u5f20\u6f88', '\u5f20\u747e', '\u738b\u548f', '\u738b\u597d', '\u674e\u5955\u5b97', '\u738b\u8c46', '\u674e\u6674\u8339', '\u5f20\u82d1', '\u738b\u96c5\u60e0', '\u674e\u8212\u5fd7', '\u5f20\u51b0', '\u674e\u8c46', '\u674e\u695a\u60a6', '\u5f20\u542c', '\u674e\u7fbd', '\u5f20\u6ee8\u4e49', '\u5f20\u8377\u83f2', '\u674e\u7199\u5ca9', '\u5f20\u6797\u704f']\n```\n\n\n## Complex Surname\n\n\u5c11\u6570\u4e2d\u56fd\u4eba\u7684\u59d3\u6c0f\u7531\u4e24\u4e2a\u6c49\u5b57\u7ec4\u6210\uff0c\u4e5f\u5c31\u662f\u201c\u590d\u59d3\u201d\uff0c\u590d\u59d3\u4eba\u53e3\u5728\u4e2d\u56fd\u5360\u6709\u7684\u6bd4\u4f8b\u5f88\u5c11\uff0c\u53ea\u6709\u5927\u6982\u5343\u5206\u4e4b\u4e00\uff0c\u7136\u800c\u4f60\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574```com_rate```\u53c2\u6570\u7684\u5927\u5c0f\uff0c\u6765\u8c03\u6574\u8fd9\u4e00\u6bd4\u4f8b\uff0c\u6765\u63d0\u9ad8\u8f93\u51fa\u6570\u636e\u4e2d\u590d\u59d3\u59d3\u540d\u7684\u6bd4\u4f8b\uff0c\u8fd9\u5728\u67d0\u4e9b\u60c5\u5f62\uff0c\u4f60\u6bd4\u5982\u8bf4\u4e3a\u4e00\u4e2a\u6b66\u4fa0\u6e38\u620f\u751f\u6210\u6d4b\u8bd5\u6570\u636e\u548c\u7d20\u6750\uff0c\u662f\u5f88\u6709\u5fc5\u8981\u7684\u3002\n\nA few Chinese surnames are composed of two Chinese characters, namely \"compound surname\". The proportion of compound surname population in China is very small, only about one thousand. However, you can adjust this proportion by adjusting the size of ```com_rate``` parameter, so as to increase the proportion of compound surname in output data. It is necessary for you to generate test data and material for, say, a martial arts game.\n\n```{python}\nmingzi(volume=10, com_rate=0.9)\n>>> ['\u7533\u5c60\u7d20\u537f', '\u5355\u4e8e\u6021\u82ac', '\u547c\u5ef6\u838e', '\u5218\u6e05\u6ee2', '\u59da\u73a5', '\u516c\u826f\u96c1\u695a', '\u5434\u5609\u8335', '\u590f\u4faf\u51cc', '\u516c\u7f8a\u51b0', '\u5deb\u9a6c\u6636']\n\n```\n\n\n## Single Names\n\n\u7edd\u5927\u591a\u6570\u4e2d\u56fd\u4eba\u7684\u540d\u5b57\u662f\u5355\u5b57\u540d\u6216\u8005\u53cc\u5b57\u540d\uff0c\u6b64\u5305\u4e5f\u4ec5\u4ec5\u751f\u6210\u8fd9\u4e24\u79cd\u7c7b\u578b\u7684\u540d\u5b57\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7 ```single_rate``` \u6765\u63a7\u5236\u8f93\u51fa\u7684\u59d3\u540d\u4e2d\u5355\u5b57\u540d\u7684\u6bd4\u4f8b\uff0c\u8fd9\u4e2a\u53d8\u91cf\u7684\u7f3a\u7701\u503c\u4e3a0.14\uff0c\u5373\u4e3a\u76ee\u524d\u7edf\u8ba1\u6570\u636e\u663e\u793a\u7684\u4e2d\u56fd\u5355\u5b57\u540d\u5728\u5168\u90e8\u4eba\u53e3\u4e2d\u6240\u5360\u7684\u6bd4\u4f8b\u3002\n\nThe vast majority of Chinese names are single-word or double-word names, and this package generates only those two types of names. You can control the proportion of single names in the output by ```single_rate```. The default value of this variable is 0.14, which is the proportion of Chinese single names in the total population as shown in the current statistics.\n\n```{python}\nmingzi(volume=10, single_rate=0.7)\n>>> ['\u9b4f\u70ab\u707f', '\u5eb7\u6587\u829d', '\u8d75\u8d3b', '\u5f20\u5357', '\u675c\u9756', '\u7f57\u8335', '\u6768\u51ef', '\u5468\u71d5', '\u8c37\u6d66\u5b87', '\u9648\u541b']\n\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "\u8fd9\u662f\u4e00\u4e2a\u7528\u6765\u751f\u6210\u968f\u673a\u4e2d\u6587\u59d3\u540d\u7684\u5305\u3002This is a library for developers to use to generate random Chinese names.",
    "version": "1.1.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8022f9a84271c79a307719dcfe3fbf0a01e8a2241883274b42fcfdecfad206e0",
                "md5": "e4c0cf661f252ddbca4f60c0dc3b7547",
                "sha256": "e9cd6853373786f189d5f360990119d3c0483be7c2f2e7ebadc33a25e0d12ebb"
            },
            "downloads": -1,
            "filename": "test_mingzi-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e4c0cf661f252ddbca4f60c0dc3b7547",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 13088,
            "upload_time": "2024-04-20T06:43:12",
            "upload_time_iso_8601": "2024-04-20T06:43:12.546936Z",
            "url": "https://files.pythonhosted.org/packages/80/22/f9a84271c79a307719dcfe3fbf0a01e8a2241883274b42fcfdecfad206e0/test_mingzi-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "299506b4c6f3e005a080160c0c28ed687dfc2edf31b6143ce687660fe4a29ded",
                "md5": "c1cfb53e169204d9367a1a66f5d473aa",
                "sha256": "ad9209638972976979a8755dd6e696099531423cc1c126bfdbd6f61c8ca39be2"
            },
            "downloads": -1,
            "filename": "test_mingzi-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c1cfb53e169204d9367a1a66f5d473aa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 12591,
            "upload_time": "2024-04-20T06:43:20",
            "upload_time_iso_8601": "2024-04-20T06:43:20.420813Z",
            "url": "https://files.pythonhosted.org/packages/29/95/06b4c6f3e005a080160c0c28ed687dfc2edf31b6143ce687660fe4a29ded/test_mingzi-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-20 06:43:20",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "test-mingzi"
}
        
Elapsed time: 0.23231s