Can an algorithm detect sarcasm

algorithm, nlp

Solution

Looks like there are studies that attempted just that, but they have yet to come up with a well working algorithm.

From González-Ibáñez, R. et al. "Identifying sarcasm in Twitter: a closer look"

Sarcasm and irony are well-studied phenomena in linguistics, psychology and cognitive science[...]. But in the text mining literature, automatic detection of sarcasm is considered a difficult problem [...] and has been addressed in only a few studies. [...] The work most closely related to ours is that of Davidov et al. (2010), whose objective was to identify sarcastic and non-sarcastic utterances in Twitter and in Amazon product reviews. In this paper, we consider the somewhat harder problem of distinguishing sarcastic tweets from non- sarcastic tweets

They conclude:

Perhaps unsurprisingly, neither the human judges nor the machine learning techniques perform very well. [...] Our results suggest that lexical features alone are not sufficient for identifying sarcasm and that pragmatic and contextual features merit further study

Here is another recent, relevant paper: Reyes, A. "From humor recognition to irony detection: The figurative language of social media"

Problem

I was asked to write an algorithm to detect sarcasm but I came across a flaw (or what seems like one) in the logic. For example if a person says A: I love Justin Beiber. Do you like him to? B: Yeah. Sure. I absolutely love him. Now this may be considered sarcasm or not and the only way to know seems to be to know if B is serious or not. (I wasn't supposed to be in depth. We were given a bunch of phrases and just were told that if these were in the sentence then it was sarcastic but I got interested?) Is there any way to work around this? Or are computers absolutely stuck when it comes to sarcasm? (I suppose it depends on the tone of the speaker but my input is text)

Original source