笑话生成器_爸爸笑话发生器

笑话生成器

(If you’re just here for the generated jokes, scroll down to the bottom!)

(如果您只是在这里生成笑话,请向下滚动到底部!)

I thought: what is super easy to build, yet would still get an approving chuckle if someone found it on my github page? Obviously, a Dad Joke generator.

我以为:什么是超级容易构建的,但是如果有人在我的github页面上找到它,仍然会发出欢笑吗? 显然,是爸爸的笑话发生器。

The first thing I did, was think: how exactly do dad jokes work? Let’s make up a few random dad jokes (these are pretty good, right?):

我做的第一件事是想:爸爸的笑话到底是如何工作的? 让我们弥补一些随机的父亲笑话(这些都很好,对吧?):

What do you call a greedy animal living in the sea?
A selfish.Which australian animal is known for it’s southern hospitality?
A koalabamaWhat do you call a freezing, chicken-like creature?
A cold turkey.

Alright, so let’s try to create three types of jokes that follow this pattern.

好吧,让我们尝试创建遵循这种模式的三种笑话。

第1部分:数据集 (Part 1: The dataset)

I first tried to create a dataset of words and their definitions. My first instinct was to take a dictionary, but dictionary results are much too technical and, frankly, confusing. Look at this example for fish:

我首先尝试创建单词及其定义的数据集。 我的第一个本能是拿一本字典,但是字典的结果太技术性了,坦率地说,令人困惑。 看一下这个鱼的例子:

fishany of various cold-blooded, aquatic vertebrates, having gills, commonly fins, and typically an elongated body covered with scales.(loosely) any of various other aquatic animals.the flesh of fishes used as food.(Informal) a person.a long strip of wood, iron, etc., used to strengthen a mast, joint, etc.

捕捞各种冷血,水生脊椎动物中的任何一种,具有g,通常为鳍,并且通常是被鳞片覆盖的细长体。(疏松地)其他各种水生动物中的任何一种。 (非正式)一个人。 用来加固桅杆,接头等的长条木头,铁等。

Alright, so how about wikipedia?

好了,那么维基百科呢?

Fish are gill-bearing aquatic craniate animals that lack limbs with digits

是g的水生cr动物,四肢没有手指

Okay, so then my “selfish” joke would become something like:

好吧,这样我的“自私”笑话就会变成:

What is greedy and are gill-bearing aquatic craniate animals that lack limbs with digits?
A sel-fish

That’s still a bit too technical for me. So where could I find descriptions of words that even a child would understand? Well, by using a children’s dictionary of course!

对我来说,这仍然有点技术性。 那么我在哪里可以找到甚至是孩子都能理解的单词描述呢? 好吧,当然要使用儿童词典 !

Fish: an animal that lives in water and has fins for swimming and gills for breathing

:生活在水中的动物,有鳍,可以游泳,g可以呼吸

That’s just perfect! That would turn my joke into:

太完美了! 那会把我的笑话变成:

What is greedy and an animal that lives in water and has fins for swimming and gills for breathing?
A sel-fish

Alright, that’s good enough. I created a dataset of words by scraping about 2000 words from that children’s dictionary to generate something like this:

好吧,这已经足够了。 我通过从该儿童字典中抓取大约2000个单词来生成单词的数据集,以生成如下内容:

length:noun:the distance from one end of a thing to the other.
good:adjective:having qualities that are desired.
dog:noun:a furry animal with four legs, a pointed nose, and a tail.
prisoner:noun:a person who is held in a jail or prison while on trial or after being sentenced for a crime.
Image for post
What do you call a greedy animal living in the sea?
您怎么称呼生活在海中的贪婪的动物?

第2部分:捉到一条小鱼 (Part 2: Catching a sel-fish)

Okay, so now that we have a dataset, the first type of joke was pretty simple: looking at all possible pairs of our words, find words that end or start with the other word.

好的,现在我们有了数据集,第一个笑话类型非常简单:查看所有可能的单词对,找到以另一个单词开头或结尾的单词。

for word1,desc1 in words:
for word2,desc2 in words:
if word2.startswith(word2):
print(f"What do you call a kind of {word1} that is {desc2}?")
print(f"a {word1+word2}")

Which generated something like this:

生成如下内容:

What do you call a kind of leg that is a group of people within a government that has the power to make or change laws?
A legislature

This wasn’t really working for me, and I also suddenly realized that joke 1 and joke 2 actually followed the same pattern: overlap between the words (whether whole or partial). So instead I wrote something that combined both.

这对我来说并不是真正的工作,我也突然意识到笑话1和笑话2实际上遵循相同的模式:单词之间重叠(无论是整体还是局部)。 因此,我写了一些结合了两者的东西。

第3部分:去koalabama (Part 3: Going to koalabama)

Alright, so both for “koalabama” and for “selfish”, the key is that they have overlapping parts of the words. The only difference is that for selfish, the word “fish” is entire part of the word “selfish”, whereas “koala” and “alabama” both have characters that are not in the other word.

好吧,所以对于“ koalabama”和“自私”来说,关键是它们的单词具有重叠部分。 唯一的区别是,为了自私,“鱼”一词是“自私”一词的整个部分,而“考拉”和“阿拉巴马”都具有另一个词中没有的字符。

Regardless, I rewrote the logic a little bit to something like this:

无论如何,我将逻辑改写成这样的东西:

for word1,desc1 in words:
for word2,desc2 in words:
if overlap(word1, word2):
print(f"What do you call a kind of {word1} that is {desc2}?")
print(f"a {combine(word1, word2)}")

Which yielded this:

结果如下:

What do you call a kind of energy that is a tiny section of a chromosome?
A genenergyWhat do you call a kind of tail that is a small item; a particular?
A detailWhat do you call a kind of anniversary that is a polite and honorable man?
A gentlemanniversaryWhat do you call a kind of era that is a play in which all or most of the words are sung and the music is played by an orchestra?
An opera

Alright, that’s working! the jokes are pretty lame, but that’s what dad jokes are supposed to be.

好吧,那很好! 这些笑话很la脚,但这就是爸爸的笑话。

Image for post
What do you call a freezing, chicken-like creature?
你怎么称呼像鸡的冰冻生物?

第四部分:去火鸡 (Part 4: Going cold turkey)

So that's two of our first jokes tackled, let's tackle the third one. The funny thing about a “cold turkey” is that, aside from being “cold” and a “turkey”, it’s also something else entirely. So what we’re looking for is a set of words which together have another, third meaning.

这是我们解决的第一个笑话,其中两个是我们解决的第三个笑话。 关于“冷火鸡”的有趣之处在于,除了“冷”和“火鸡”外,它还完全是另外一回事。 因此,我们正在寻找的是一组具有另一种第三种含义的单词。

Given our limited dataset, let’s see what words we can combine to find a third word that is also in the data:

给定有限的数据集,让我们看看可以组合哪些词以找到数据中的第三个词:

cat fish catfish
door way doorway
life time lifetime
share holder shareholder
frame work framework
cup board cupboard
fire wood firewood
mess age message
pass age passage
work shop workshop
percent age percentage
bed room bedroom
car pet carpet
rail way railway
cover age coverage
class room classroom
land lord landlord
sea lion sea lion
sea son season
blue whale blue whale
birth day birthday
rain forest rain forest
bath room bathroom
week end weekend

Okay, not so many combinations there, but we can create jokes with them, and increase the size of the dataset later. This is the pseudocode that I used to create the next jokes:

好的,那里没有太多组合,但是我们可以用它们创建笑话,并在以后增加数据集的大小。 这是我用来创建下一个笑话的伪代码:

for word1,desc1 in words:
for word2,desc2 in words:
for mix in [word1+word2, word1+"-"+word2, word1+" "+word2]:
if mix in words:
print(f"What do you call {combined_desc(desc1, desc2)}?")
print(f"a {mix}")

Which resulted in:

结果是:

What do you call a small, furry mammal with whiskers, short ears, and a long tail that lives in water and has fins for swimming and gills for breathing?
A catfishWhat do you call an opening through which one enters or leaves a room or building and a road or path leading from one place to another?
A doorwayWhat do you call the state of being that can never be turned back?
A lifetime

The catfish one is funny to me, but the others are not. Still, it works pretty well.

fish鱼对我很有趣,而其他人则不那么有趣。 尽管如此,它仍然运行良好。

第五部分:强迫的笑声 (Part 5: Forced chuckles)

Alright, so putting everything together, let’s generate a bunch of dad jokes:

好了,将所有内容放在一起,让我们产生一堆爸爸笑话:

What do you call a kind of infant that is a soft, light gray metal that is one of the chemical elements?
A tinfant (tin+infant)What do you call a kind of attendance that is a white or yellow oily substance found in some parts of animals or plants?
A fattendance (fat+attendance)What do you call the color of a clear sky which lives in the water?
A blue whale (blue+whale)What do you call a kind of airplane that is to put in good condition again after damage has been done; fix?
A repairplane (repair+airplane)What do you call a kind of mountain that is measure; quantity?
An amountain (amount+mountain)What do you call the solid part of the earth's surface and a person who rules?
A landlord (land+lord)What do you call a kind of plaintiff that is an act of complaining?
A complaintiff (complaint+plaintiff)What do you call an automobile and a tame animal people keep in their homes as a companion or for pleasure?
A carpet (car+pet)What do you call a kind of intervention that is the season of the year between autumn and spring?
A wintervention (winter+intervention)What do you call a kind of cancer that is great value; importance?
A significancer (significance+cancer)What do you call a kind of spectrum that is the state or condition of being thought of with honor or admiration; such admiration itself?
A respectrum (respect+spectrum)

I mean, they’re not as good as my own jokes, but they’re pretty close ;)Next steps could include: — making use of the part-of-speech of a word, such as noun or verb. — expanding the dataset with more words. — setting up a simple website that shows random dad jokes. — applying NLP to turn sentences like “What do you call an automobile and a tame animal people keep in their homes as a companion or for pleasure?” into “What do you call an automobile which people keep in their homes as a companion or for pleasure?”

我的意思是,他们还不如我自己的笑话,但他们非常接近;)接下来的步骤可能包括: -利用部分的词性的单词,如名词或动词。 —用更多的单词扩展数据集 。 —建立一个显示随机父亲笑话的简单网站 。 -用NLP来转述诸如“您如何称呼汽车和驯服的动物,人们作为伴侣或为了娱乐而留在家中?”这样的句子 变成“您所说的人们作为伴侣或出于娱乐目的而在家中保管的汽车?”

You can find the code (and all 1710 generated jokes) here: https://github.com/paulluuk/DadJokes

您可以在这里找到代码(以及所有1710个生成的笑话): https : //github.com/paulluuk/DadJokes

翻译自: https://medium.com/swlh/the-dad-joke-generator-dcdabb53d0e3

笑话生成器

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/389023.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

机器学习实践二 -多分类和神经网络

本次练习的任务是使用逻辑归回和神经网络进行识别手写数字(form 0 to 9, 自动手写数字问题已经应用非常广泛,比如邮编识别。 使用逻辑回归进行多分类分类 练习2 中的logistic 回归实现了二分类分类问题,现在将进行多分类,one vs…

Hadoop 倒排索引

倒排索引是文档检索系统中最常用的数据结构,被广泛地应用于全文搜索引擎。它主要是用来存储某个单词(或词组)在一个文档或一组文档中存储位置的映射,即提供了一种根据内容来查找文档的方式。由于不是根据文档来确定文档所包含的内…

koa2异常处理_读 koa2 源码后的一些思考与实践

koa2的特点优势什么是 koa2Nodejs官方api支持的都是callback形式的异步编程模型。问题:callback嵌套问题koa2 是由 Express原班人马打造的,是现在比较流行的基于Node.js平台的web开发框架,Koa 把 Express 中内置的 router、view 等功能都移除…

上凸包和下凸包_使用凸包聚类

上凸包和下凸包I recently came across the article titled High-dimensional data clustering by using local affine/convex hulls by HakanCevikalp in Pattern Recognition Letters. It proposes a novel algorithm to cluster high-dimensional data using local affine/c…

幸运三角形 南阳acm491(dfs)

幸运三角形 时间限制:1000 ms | 内存限制:65535 KB 难度:3描述话说有这么一个图形,只有两种符号组成(‘’或者‘-’),图形的最上层有n个符号,往下个数依次减一,形成倒置…

决策树有框架吗_决策框架

决策树有框架吗In a previous post, I mentioned that thinking exhaustively is exhausting! Volatility and uncertainty are ever present and must be factored into our decision making — yet, we often don’t have the time or data to properly account for it.在上一…

8 一点就消失_消失的莉莉安(26)

文|明鸢Hi,中午好,我是暖叔今天是免费连载《消失的莉莉安》第26章消失的莉莉安▶▶往期链接:▼ 向下滑动阅读1:“消失的莉莉安(1)”2: 消失的莉莉安(2)3:“消失的莉莉安(3)”4:“消失的莉莉安…

mysql那本书适合初学者_3本书适合初学者

mysql那本书适合初学者为什么要书籍? (Why Books?) The internet is a treasure-trove of information on a variety of topics. Whether you want to learn guitar through Youtube videos or how to change a tire when you are stuck on the side of the road, …

语音对话系统的设计要点与多轮对话的重要性

这是阿拉灯神丁Vicky的第 008 篇文章就从最近短视频平台的大妈与机器人快宝的聊天说起吧。某银行内,一位阿姨因等待办理业务的时间太长,与快宝机器人展开了一场来自灵魂的对话。对于银行工作人员的不满,大妈向快宝说道:“你们的工…

c读取txt文件内容并建立一个链表_C++链表实现学生信息管理系统

可以增删查改&#xff0c;使用链表存储&#xff0c;支持排序以及文件存储及数据读取&#xff0c;基本可以应付期末大作业&#xff08;狗头&#xff09; 界面为源代码为一个main.cpp和三个头文件&#xff0c;具体为 main.cpp#include <iostream> #include <fstream>…

阎焱多少身价_2020年,数据科学家的身价是多少?

阎焱多少身价Photo by Christine Roy on Unsplash克里斯汀罗伊 ( Christine Roy) 摄于Unsplash Although we find ourselves in unprecedented times of uncertainty, current events have shown just how valuable the fields of Data Science and Computer Science truly are…

单据打印_Excel多功能进销存套表,自动库存单据,查询打印一键操作

Hello大家好&#xff0c;我是帮帮。今天跟大家分享一张Excel多功能进销存管理套表&#xff0c;自动库存&#xff0c;单据打印&#xff0c;查询统算一键操作。为了让大家能更稳定的下载模板&#xff0c;我们又开通了全新下载方式(见文章末尾)&#xff0c;以便大家可以轻松获得免…

卡尔曼滤波滤波方程_了解卡尔曼滤波器及其方程

卡尔曼滤波滤波方程Before getting into what a Kalman filter is or what it does, let’s first do an exercise. Open the google maps application on your phone and check your device’s current location.在了解什么是卡尔曼滤波器或其功能之前&#xff0c;我们先做一个…

Candidate sampling:NCE loss和negative sample

在工作中用到了类似于negative sample的方法&#xff0c;才发现我其实并不了解candidate sampling。于是看了一些相关资料&#xff0c;在此简单总结一些相关内容。 主要内容来自tensorflow的candidate_sampling和卡耐基梅隆大学一个学生写的一份notesNotes on Noise Contrastiv…

golang key map 所有_Map的底层实现 为什么遍历Map总是乱序的

Golang中Map的底层结构其实提到Map&#xff0c;一般想到的底层实现就是哈希表&#xff0c;哈希表的结构主要是Hashcode 数组。存储kv时&#xff0c;首先将k通过hashcode后对数组长度取余&#xff0c;决定需要放入的数组的index当数组对应的index已有元素时&#xff0c;此时产生…

朴素贝叶斯分类器 文本分类_构建灾难响应的文本分类器

朴素贝叶斯分类器 文本分类背景 (Background) Following a disaster, typically you will get millions and millions of communications, either direct or via social media, right at the time when disaster response organizations have the least capacity to filter and…

第二轮冲次会议第六次

今天早上八点我们进行了站立会议 此次站立会议我们开了30分钟 参加会议的人员&#xff1a; 黄睿麒 侯熙磊 会议内容&#xff1a;我们今天讨论了如何分离界面&#xff0c;是在显示上进行限制从而达到不同引用展现不同便签信息&#xff0c;还是单独开一个界面从而实现显示不同界面…

markdown 链接跳转到标题_我是如何使用 Vim 高效率写 Markdown 的

本文仅适合于对vim有一定了解的人阅读&#xff0c;没有了解的人可以看看文中的视频我使用 neovim 代替 vim &#xff0c;有些插件是 neovim 独占&#xff0c; neovim 和 vim 的区别请自行 google系统: Manjaro(Linux)前言之前我一直使用的是 vscode 和 typora 作为 markdown 编…

Seaborn:Python

Seaborn is a data visualization library built on top of matplotlib and closely integrated with pandas data structures in Python. Visualization is the central part of Seaborn which helps in exploration and understanding of data.Seaborn是建立在matplotlib之上…

福大软工 · 第十次作业 - 项目测评(团队)

写在前面 本次作业测试报告链接林燊大哥第一部分 调研&#xff0c;评测 一、评测 软件的bug&#xff0c;功能评测&#xff0c;黑箱测试 1.下载并使用&#xff0c;描述最简单直观的个人第一次上手体验 IOS端 UI界面简单明了&#xff0c;是我喜欢的极简风格。课程模块界面简洁优雅…