Code Monkey home page Code Monkey logo

chinesename's Introduction

中文取名

PyPI - Python Version 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)
'骆留'

更新记录

v0.1.1(2023年07月24日)

  • 修复安装失败的问题

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"'的问题

chinesename's People

Contributors

mouday avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chinesename's Issues

名字库需经筛选

名字库里的东西啥文字组合都有,什么“女士”,“合婚”,"离世","锄草","私处","哀子"等等之类无法用在名字里面的词组太多太多,望改进!

python2下安装失败

(venv) myp:170818_test_all $ pip install chinesename
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting chinesename
  Downloading http://mirrors.aliyun.com/pypi/packages/7f/9b/c527e661ca3530bfbc65b4702ca055d58e2d3e11039631627b7ea01a45fe/chinesename-0.0.9.tar.gz (150kB)
    100% |████████████████████████████████| 153kB 2.1MB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/4w/rwy1x5nj16d2t2tbtcs385pc0000gn/T/pip-install-9NGiPN/chinesename/setup.py", line 16, in <module>
        md_to_rst("README.md", "README.rst")
      File "/private/var/folders/4w/rwy1x5nj16d2t2tbtcs385pc0000gn/T/pip-install-9NGiPN/chinesename/setup.py", line 10, in md_to_rst
        files={'input_files[]':open(from_file,'rb')})
    IOError: [Errno 2] No such file or directory: 'README.md'

打开文件是好像少了编码

出现了编码问题:
'gbk' codec can't decode byte 0x80 in position 2: illegal multibyte sequence
是不是打开文件的时候少了编码转换

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.