Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Programming a sense of humor

  1. May 4, 2016 #1
    I've been developing an artificially intelligent software for a few years now. Its main goal is to have human like conversations with others. I've realized that humor is a very important part of conversation. After doing some research I may have found a definition for it -
    "something that is unexpected and does not pose a threat".

    Does anyone have any insight into this area of research?
    Any tips or ideas of any sort to steer me in the right direction would be really great.

    Thanks in advance
     
  2. jcsd
  3. May 4, 2016 #2

    jedishrfu

    Staff: Mentor

  4. May 4, 2016 #3

    Fervent Freyja

    User Avatar
    Gold Member

    This reminds me of Russell's essay, "The Professors guide to laughter", in which he points out that humor cannot be placed into one particular formula for all people, since people and cultures can be so very different in how they function and what they find humorous can vary considerably. Although he states there are many formulas for humor, he saw that they have one thing in common, "Every formula treats what is living as if it were mechanical, and is therefore by his own rule itself a fitting object of laughter."
     
  5. May 4, 2016 #4
    Interesting. It's not a very easy topic indeed. Like you said, it varies by culture, so besides some things we all find universally funny, some other things people might disagree on. Randomness could also be a source of humor, that might be slightly easier to program. The problem is not an unsolvable one, it just requires some knowledge about the real world. The more knowledge you have the more jokes you will understand. The less knowledge you have the more likely you will mistake them for regular statements. Now with that said, what knowledge of the real world is actually needed is still something I have not yet pinpointed. I suppose it depends on what type of jokes are being made. Food jokes? Learn about food first, something along those lines.
     
  6. May 5, 2016 #5

    Fervent Freyja

    User Avatar
    Gold Member

    Well, what makes something funny to a person depends upon their entire body of knowledge or the perception of the circumstances leading up to and surrounding that joke. There are many aspects that would have to be placed into context other than words or even body language. I find things funny and make jokes that few people seem to get. Some people seem to need to share their humor with other people, while some get pleasure out of joking with themselves. I don't find typical jokes very funny, but can sometimes sense that someone is joking. You are right, that is a large task, but probably could be done with universal aspects of human nature(gender jokes). Some animals also have a sense of humor.

    One word can be considered a joke if placed into context of past, current, and future events surrounding a collective, not individualistic, body of knowledge. If you have a program running that can collect the common knowledge of a certain group, then having that program respond against that knowledge could be considered funny. Throwing people off can get their attention. For instance, I occasionally tease my 4 year old daughter about bits of knowledge or words, "Put on your goat" elicits her to respond, "Mamaaaaa, coat not goat!". I also make up something that I know is very contradictory to what she knows, which incites her to form good arguments against me. I figure if she can oppose me, then she will do so to anyone else. She's catching on now though and realizes that I'm joking. I will have to adapt my strategy here.
     
  7. May 5, 2016 #6

    Svein

    User Avatar
    Science Advisor

  8. May 5, 2016 #7

    jedishrfu

    Staff: Mentor

  9. May 5, 2016 #8
    It always hit me how apeish laughter is, a remnant of our ancient primate past. In that sense its function I think is to alert others when the socially defined reality is changing in some way, such as when something or someone is being revealled as absurd, when previously esteemed, or vice versa.

    I think I heard the funniest joke, people all over the world got was that Sherlock Holmes and Watson were sleeping in the desert, when Sherlock awakes to ask Watson what he deduces looking at the starry sky. Watson launches into this well informed series of deductions ending with the conclusion alien life is probable, to which Sherlock responds "No you idiot, it means someone stole our tent!"

    What was certain becomes uncertain, what appeared to be was not, laugh to alert the others, that they may know.
     
  10. May 5, 2016 #9
    I've been reading all of your posts so far in an effort to develop a simple and computationally efficient algorithm. The software has a pretty good understanding of what people usually say such as "how are you?" and "good morning". My idea so far is that when the software identifies a normal phrase with a small alteration to it, it will consider it funny. For example - "bad morning", "how are I?". All obvious in what they mean to say but slightly different.
    Avoiding deep branching searches is a major problem in making a software practical however.
     
  11. May 6, 2016 #10
    This question kinda stuck in my mind. On further thought, funny very often presents a peice of information with one assumed meaning, then provides a new piece of information that shifts the semantic meaning, or provides new context, of the first information. Thats really ubiquitous in jokes. I can think of a million examples. (Unfortunately most are dirty) The challenge is to have a computational map of symbols to meanings with probabilities, and know the information that will shift a meaning to a less probable meaning.
     
  12. May 6, 2016 #11
    That might have just given me an idea. Specify certain words or phrases that are known to shift meaning, for different categories of sayings such as greetings, farewells etc...and have the software keep an eye out for those.
     
  13. May 6, 2016 #12
    Right... Here's one, light: As in beer->(stout, lager, light) becomes light as in physics->(light, matter, energy)

    The great physicists of yore were out having beer in the afterlife, when Boyle hollered for another at the waitress as she was walking away. "Dont do that" Newton scolded him. "If you wait for her to be walking toward to when you call for another, her existing momentum and velocity will add to her acceleration toward you to take your order, making less time between your order and beer"

    This caused some debate between the physicists as to whether it mattered, but being people of science, they agreed to test it, quietly timing the results between each order, and the direction of the waitress as they made it. When they were done, all the results confirmed Newton's, except for one physicist's orders... Not only were they served faster than all the others, but the speed was the same whether the waitress had been moving away or toward them when made. Perplexed, they asked the physicist with the orders what he thought the reason was for the anomoly.

    "Very simple gentlemen" Einstein replied, with a twinkle in his eye. "Its LIGHT beer I ordered"

    ***
    Gawd thats awful, and you have to have know the history of relativity to get it, but I just totally sythesized that joke using that idea I totally think you could do it.
     
  14. May 7, 2016 #13

    Mark44

    Staff: Mentor

    I believe it's very difficult to program a computer to generate humorous responses, as a lot of humor depends on multiple meanings for words. For example,

    A dog walks into a bar, and says, "I'm looking for the man who shot my paw!"​

    Just to understand this joke, the software needs to understand the dual meanings of the word "paw."

    Or, in this one, the software needs to understand the idiomatic expression "long face":

    A horse walks into a bar. The bartender says, "Why the long face?"​

    Or, the software needs to understand unusual meanings of words:

    Q: What's brown and sticky?
    A: A stick.​
     
  15. May 7, 2016 #14
    The problem is not realizing whether or not a statement is a pun or whether or not it has words used in ways that are unusual but make sense, it's that the software needs real world information for example that horses have - long faces. So I believe a software for humor could be made, however the amount of jokes it understand would probably be proportional to it's knowledge of the real world and the slangs people use etc...
     
  16. May 7, 2016 #15

    Mark44

    Staff: Mentor

    It's not just the knowledge that a horse has a long face, but that there's another meaning for "long face." So is it that the horse has a long face (literally, because it's a horse) or it that the horse is sad, the other meaning of having a long face.

    Humans can deal with these ambiguities, but computers and their software have a much harder time with ambiguous statements.
    Another one to consider:
    A beaver walks into a drinking establishment, and says, "Is the bartender here?"
    Even some humans have a hard time with this one... The joke works better if it is spoken than when it is read.
     
  17. May 7, 2016 #16
    They can do it though. In the case of your last joke, its about about a map of words to phonemes thats reversable. So "bartender here" and "bar tender here" map to the same phonemes, just with different emphasis on syllables (BARtender vs BARTENder). Once you've identified slippery points like this you construct the joke around them. Surely a computer could help.

    What I think is interesting is that many jokes do this with the meaning of situations, not just words... So there really is some kind of universal thing at play.
     
  18. May 7, 2016 #17
    If we can define something funny as being unexpected then it would still hold true for the jokes mentioned. For example the beaver joke

    A beaver walks into a drinking establishment, and says, "Is the bartender here?"

    What's unexpected about these types of jokes is the double meanings to it. It's funny because you don't expect most statements to have double meanings, at least not ones so different from each other.

    As for the long face joke about the horse. The software would basically learn from people that horses have unusually long faces, it would not derive such a conclusion from analyzing geometry because in that case practically everything is long in comparison.
     
  19. May 8, 2016 #18

    Mark44

    Staff: Mentor

    With this logic, the software wouldn't get the joke. After the program "learned" that horses have long faces (relative to human faces), it would still be scratching its head (if software can scratch its head) wondering what was so funny about the length of horses' faces.
     
  20. May 8, 2016 #19

    Svein

    User Avatar
    Science Advisor

    “Some logics get nervous breakdowns. Overloaded phone system behaves like frightened child. Mike did not have upsets, acquired sense of humor instead. Low one. If he were a man, you wouldn't dare stoop over. His idea of thigh-slapper would be to dump you out of bed — or put itch powder in pressure suit.”
    Robert A. Heinlein, The Moon is a Harsh Mistress

    (Mike is a computer)
     
  21. May 8, 2016 #20
    It would be funny because the pun would give an unexpected double meaning to the statement made, the horse having a long face by itself wouldn't be the source.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Programming a sense of humor
  1. C++ program (Replies: 2)

  2. Programming Languages (Replies: 1)

  3. Arduino program (Replies: 8)

  4. Programming Language (Replies: 2)

Loading...