AI Algorithm for Sarcasm

I am currently working on an Android a.i. app. I am aware of the algorithm how to make random sentences in A.I.

Is there any way or algorithm to make those sentences sarcastic?

• 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. – Lovecraft Jan 17 '17 at 9:03
• 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? – Praharsh Bhatt Jan 17 '17 at 9:11
• You can use Generative models such as NB (Naive Bayes) and use probability using a big corpus for generating random sentences with n grams – ᴀʀᴍᴀɴ Jan 17 '17 at 10:39
• 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.) – DukeZhou Jan 19 '17 at 21:53
• @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. – Praharsh Bhatt Jan 20 '17 at 2:41

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.