I am currently working on an Android AI app.

I am aware of AI models to generate random sentences. However, is there an AI model for generating sarcastic sentences?

  • 1
    $\begingroup$ Recognizing and interpreting sarcasm is often a difficult task even for humans to comprehend; since you can learn only the things you can recognize I don't see valid ways to accomplish your task. $\endgroup$
    – Lovecraft
    Commented Jan 17, 2017 at 9:03
  • $\begingroup$ Well, if you dive in and take a closer look, we see that ironic statements are the most likely to be sarcastic. So, instead; is there any way to produce random ironic statements? $\endgroup$ Commented Jan 17, 2017 at 9:11
  • $\begingroup$ You can use Generative models such as NB (Naive Bayes) and use probability using a big corpus for generating random sentences with n grams $\endgroup$ Commented Jan 17, 2017 at 10:39
  • $\begingroup$ I recommend researching the concept of the "backhanded compliment" and the comedy of Don Rickles, widely regarded as the exemplar of the form, for inspiration. (And please keep us apprised of your progress. Having a sarcastic computer assistant is something of a dream of mine.) $\endgroup$
    – DukeZhou
    Commented Jan 19, 2017 at 21:53
  • $\begingroup$ @DukeZhou My team is developing AI for Android here: play.google.com/store/apps/details?id=com.multiverse.jarvis That's where we want to implement the algorithm. $\endgroup$ Commented Jan 20, 2017 at 2:41

3 Answers 3


You could also build a database of sarcastic sentences, especially from, for example historic plays. And then train your software to recognize patterns of those sentences.

E.g. grammatical constructions/order, length (or circomstances building up to the sarcasm).

And use that database as starting point, with feedback to learn, or you could use the above method to improve your effective output.

Another approach would be to use a similar but reverse approach; study those databases and build an equivalent output based on the coherence, and then extrapolate the output-generation procedure. (In combination with other methods)


A simple form of sarcasm involves a direct reversal of the literal meaning of the statement, eg "Great weather we're having" (during a thunderstorm), "just what I needed" (when something goes wrong).

The problem with doing this in random sentences is that you may have no context to establish the reversal of the literal meaning.

You could possibly construct them by using a template along the lines of "Just what I needed - (random bad thing happened) today"

Or, when an outcome of a process is calculated, if it is not the desired outcome, instead of returning "mission unsuccessful" or "mission not yet complete", the AI could say "you're having a great day, aren't you? - mission unsuccessful" or "great work, genius - mission not yet complete".

Most random sentences will not be suitable for sarcasm, so it could only be applied in specific circumstances.

It is not clear from your question what the context is for these random sentences, and therefore it is not clear whether that context would be suitable for sarcasm at all.


Have a look at the paper A Modular Architecture for Unsupervised Sarcasm Generation (2019) by Mishra et al.

In the abstract, the authors write

In this paper, we propose a novel framework for sarcasm generation; the system takes a literal negative opinion as input and translates it into a sarcastic version. Our framework does not require any paired data for training.

Here's the reference implementation.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .