Skip to main content

中文取名

Build Status PyPI PyPI - Downloads

说明

项目包含《百家姓》姓氏504个,常用于名字的汉字2812个 名字汉字中包含大部分《楚辞》、《诗经》词汇

pypi地址: https://pypi.python.org/pypi/chinesename

安装模块

pip install chinesename

代码示例:

from chinesename import ChineseName  # 导包

cn = ChineseName()  # 实例化

cn.getName()  # 获取一个姓名
'广袁'

cn.getNames(10)  # 获取多个姓名
['笪递', '慎彭徨', '席具', '锺谦', '任西', '公羊狱', '华桑', '利节', '燕角', '任彪']

cn.getNameGenerator(10)  # 获取生成器
<generator object ChineseName.getNameGenerator at 0x1045cfa40>

cn.getLastName()  # 获取姓氏
'舒'

cn.getFirstName()  # 获取名字
'崔'

cn.getName(lastname="彭")  # 设置姓氏
'彭圭'

cn.getName(char_count=2)  # 设置名字长度
'倪吏渚'

cn.getName(sex="boy")  # 设置性别 (boy | girl)
'骆留'

更新记录

2018年1月22日 增加姓名生成器函数,getNameGenerator()

2018年3月19日 修复导入lastnames 和 firstname 文件失败的问题,将两文件内容直接写到chinesename中,并删除两文件

2018年6月20日 修复资源文件导入问题,增加性别参数,区分男孩姓名和女孩姓名 感谢 JoffreyN 提出的建议 古语云:男楚辞,女诗经。名可以从诗经、楚辞里面取 在原有基础上进行了扩展 遗留问题:取词不准确,需要进一步优化

2018年7月23日 修复文件open时引发的编码问题,增加参数:encoding="utf-8"

2018年11月23日 修复pyhton2下安装报错'IOError: [Errno 2] No such file or directory: "README.md"'的问题

Release files for chinesename 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chinesename 0.1.1
File Size Uploaded
chinesename-0.1.1.tar.gz 151.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chinesename 0.1.1
File Interpreter ABI Platform
chinesename-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 303.9 kB

Release files / chinesename-0.1.1.tar.gz

Download URL chinesename-0.1.1.tar.gz
Size 151.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a5411aa88f2757969c1b73d6e73d72d0ae6d9ea6d4ad06a1a5910ced5c159029
BLAKE2b-256 checksum
How to use checksums
21283573253abdc04a1ed6018187f2b615f4fcc29e6d3233323ef11c415d2575
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.0

Release files / chinesename-0.1.1-py2.py3-none-any.whl

Download URL chinesename-0.1.1-py2.py3-none-any.whl
Size 152.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c956d27e8a2cbf153fdd6a078a5381c931783ee206917d3922ee9d8dde0a89ea
BLAKE2b-256 checksum
How to use checksums
561d48286f4d21e7742be1ae4aa93bb028a46db26e59e6f9279d7af563c40c2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

3 release files

0.0.9

3 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

3 release files

0.0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page