一个类似于ben cumberbatch的名字生成器
benerator_cumberp的Python项目详细描述
benerator cumberpy是一个用python编写的名称生成器,它生成类似于“benedict cumberbatch”的词对。已经有这样的发电机了。然而,他们创造了新词,如“boobiedook cumberfinkle”。
Benerator Cumberpy将创造一对现存的英语词汇来满足某些标准。例如“利益协调”或“仁慈的黄瓜”。有超过4.8亿种可能的组合。该脚本在python 2和3中都可以工作。
安装并运行Benerator Cumberpy
确保安装了python,并(可选)创建一个virtualenv。
要安装benerator cumberpy,请运行pip install benedict_cumberpy
要运行benedict cumberpy,请打开终端并运行hello-ben。你的控制台会打印一个句子,比如“你好,我的名字是布朗泽利克证书”。
为了增加趣味性,请通过管道将hello ben的输出传递到cowsay(win:cowsay for windows,linux:apt install cowsay或发行版使用的任何其他内容,osx:如果安装了自制程序brew install cowsay)。
示例:
$ hello-ben | cowsay -f stegosaurus ____________________________________ / Hello there, my name is Beetleweed \ \ Correctioner. / ------------------------------------ \ . . \ / `. .' " \ .---. < > < > .---. \ | \ \ - ~ ~ - / / | _____ ..-~ ~-..-~ | | \~~~\.' `./~~~/ --------- \__/ \__/ .' O \ / / \ " (_____, `._.' | } \/~~~/ `----. / } | / \__/ `-. | / | / `. ,~~| ~-.__| /_ - ~ ^| /- _ `..-' | / | / ~-. `-. _ _ _ |_____| |_____| ~ - . _ _ _ _ _>
您还可以在python脚本中使用benerator cumberpy。benerate_name函数将只返回名称+姓氏对。
例如:
# your_script.pyfrombenerator_cumberpyimporthellofrombenerator_cumberpyimportbenerate_nameprint("You know who you can always count on? "+str(benerate_name())+"!")hello()
$ python your_script.py You know who you can always count on? Bestselling Corridors! Hello there, my name is Belial Cobalt.
这些词是从哪里来的?
我找到了一个要使用的英语单词列表–this one。然后我根据以下条件制作了两个列表first_names.txt和last_names.txt:
名字(最终结果:16692个字):
- 以“B”开头
- 至少有6个字母长
- 不是本尼迪克特
姓氏(最终结果:28786个字):
- 以“C”或“K”开头
- 至少有6个字母长
- 不以“ch”开头
- 不是cumberbatch,尽管它不在数据集中