笑话生成器

(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.

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脚,但这就是爸爸的笑话。

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 catfishdoor way doorwaylife time lifetimeshare holder shareholderframe work frameworkcup board cupboardfire wood firewoodmess age messagepass age passagework shop workshoppercent age percentagebed room bedroomcar pet carpetrail way railwaycover age coverageclass room classroomland lord landlordsea lion sea lionsea son seasonblue whale blue whalebirth day birthdayrain forest rain forestbath room bathroomweek 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.taodudu.cc/news/show-2467643.html

相关文章:

  • 英语六级翻译整理【未更新完】
  • html5 jq切换效果,jquery中实现标签切换效果的代码
  • IELTS4-15 LISTENING (Fill in the blanks)
  • 新视野大学英语第三版 读写(2020.12.05)
  • 我对计算机的看法英语作文,我对创新的看法英语作文7篇作文
  • 英语思维方式
  • 多线程学习-基础( 十)一个synchronized(){/*代码块*/}简单案例分析
  • goap git上的v sploreg/goap
  • The Happy Prince
  • 大学英语综合教程三 Unit 1 课文内容英译中 中英翻译
  • 862人文英语4
  • 关于AI的目标导向型行动计划
  • 线性代数-矩阵方程应用:配平化学方程式
  • MATLAB如何配平化学方程,【如何配平化学方程式】作业帮
  • 化学方程式配平器
  • g++ 安装python_Python趣用—配平化学方程式!
  • 方程思想应用于化学方程式配平
  • python 化学反应_有意思的Python:用python配平化学方程式
  • python化学公式配平_PYTHON趣用—配平化学方程式-阿里云开发者社区
  • python化学公式配平_最简单易懂的化学方程式的配平方法
  • python化学公式配平_配平化学方程式的C++代码实现
  • python 化学_Python趣用—配平化学方程式!
  • C++实现化学方程式配平
  • matlab 化学方程式配平
  • python化学公式配平_如何用矩阵知识配平化学方程式?
  • python化学公式配平_Python趣用—配平化学方程式
  • python化学公式配平_用Python配平化学方程式的方法
  • 化学方程式配平
  • 白盒测试-判定条件覆盖
  • 白盒测试-条件覆盖

笑话生成器_爸爸笑话发生器相关推荐

  1. 使用 Flutter 制作一个简单的笑话生成器应用程序

    在本教程中,我将向您展示如何使用 Flutter 制作一个简单的笑话生成器应用程序 对于这个项目,我们将从 RESTful API 获取数据 API的链接: 随机笑话 对于这个项目,我不会关注应用程序 ...

  2. 【JavaScript】笑话生成器

    根据MDN网站学习记录笔记 笑话生成器 一.项目目标 二.项目流程 三.效果展示 四.总结 4.1 向html中添加JavaScript的方法 4.2 变量 4.3 有用的字符串方法 indexOf( ...

  3. Java找对象笑话_找对象相亲的笑话几则,爱情笑话

    原标题:找对象相亲的笑话几则,爱情笑话 找对象相亲的笑话几则,爱情笑话 今天小编一来就听到关系比较好的同事妹纸在说昨天相亲遇到的奇葩.听完以后小编只能感慨,这其实是个相亲笑话吧?妹纸的相亲对象居然带着 ...

  4. 电子音调发生器c语言编程,单片机课程设计(论文)_电子音调发生器.doc

    单片机课程设计(论文)_电子音调发生器 电子音调发生器 姓 名 XXX 所在学院 电子信息工程学院 专业班级 通信XXXX 学 号 XXXXX 指导教师 XXXXXX 日 期 2011 年 12月 1 ...

  5. emqx http not found 怎么回事_幽默笑话:行倒是行,但两个大男人这么说话算怎么回事...

    原标题:幽默笑话:行倒是行,但两个大男人这么说话算怎么回事 1. 今天陪女儿午睡的时候快递给我打电话.我怕吵醒宝宝就压低声音说:"你谁啊?"结果快递也压低声音说:"有你的 ...

  6. html+css+JavaScript的简单笑话生成器

    ** 在JavaScript MDN上面看到的一个挺简单的小案例 注意:尽量不要把js文件放到head里面,会监听不到事件 ** // html<body><div><l ...

  7. Java找对象笑话_找对象相亲的笑话7则,爱情笑话

    1.选 择姑娘和小伙子经婚姻介绍所安排,在公园里见了面.两人谈了没一会儿,姑娘便起身告 辞.小伙子对姑娘很中意,见她要走,心里很急,连忙追问原因. 姑娘:"你虽然相貌堂堂,可是腹中空空.&q ...

  8. 夫妻笑话_最新笑话_逗牙搞笑网

    妻子怒斥丈夫:"你为什么偷看我的日记?" "这--"丈夫张口结舌,半天才说,"你是怎么知道的?" 妻子声色俱厉地说:"因为我刚看了 ...

  9. 短期python培训班_【短笑话】2020短笑话大全-ZOL笑话频道

    1.一首现代诗<头发> :我的枕头上好多头发, 我的被子上好多头发, 我家地板也都是头发. 唯独我头上没有头发. 2.很多人对"车技"的理解就是:能加塞.敢开很快.说白 ...

  10. 随机数发生器怎么用_用随机数发生器射击自己的脚

    随机数发生器怎么用 这将不是解释随机数生成器毕竟不是那么随机的文章之一. 因此,您中的那些人希望获得有关如何破解老虎机,继续前进的指南,在这里什么也看不到. 相反,它是有关一个不太常见的锁争用问题的帖 ...

最新文章

  1. asp.net mvc @RenderBody()的问题
  2. C++的沉迷与爱恋——侯捷
  3. UltraISO 制作ESXi 的 USB 安装盘
  4. Flink当中使用kafka Consumer
  5. 能取代top命令的htop
  6. session实现购物系统的简例和application实现统计页面访问次数的简例
  7. Apache OpenNLP
  8. [转用 jsfl 扩展你的 flash
  9. 蒋江伟:代码是我们最重要的资产!
  10. STM32F103代码远程升级(六)基于小米IoT开发者平台远程升级代码的实现
  11. bootice添加黑苹果引导_联想小新13Pro黑苹果系统bigsur教程(OC引导)
  12. 2048小游戏(Java)源码解析及源代码打包
  13. 朝花夕拾 —— 重温《花田半亩》
  14. 聚观早报 | 通信行程卡正式宣布下线;《三体》首日播放量破1亿
  15. 安卓手机按键精灵Python封装
  16. python工控开发框架_GitHub - hzglitter/isf: ISF(Industrial Security Framework),基于Python的工控漏洞利用框架...
  17. free导致的内存踩踏例子
  18. table_schem是什么意思
  19. oculus vr开发_Oculus IndieCade VR Jam总结
  20. xbox win10测试软件,xbox one在win 10 系统怎么测验

热门文章

  1. mysql订单表和订单详情表_订单详情表,与,订单表 怎么做?
  2. Pillow图像处理
  3. Python360网站翻译
  4. 数据库系统原理练习题
  5. 计算机辅助翻译在翻译实践中的应用,计算机辅助翻译在翻译实践中的应用
  6. vue UEditor集成秀米
  7. 华中科技大学计算机考研信息汇总
  8. 两台电脑之间串口传输文件
  9. 手机服务器连接视频文件夹吗,巧用手机自带功能向电脑传输视频 华为小米苹果均适用...
  10. UNI-APP_uni-app中设置radio和switch的大小