Sunday, December 30, 2012

nlp - Can an algorithm detect sarcasm - Stack Overflow



...sentences are written by users. Its a simulated conversation between 2 people.



Detecting the sarcasm is close to impossible with a single phrase, but with context it might be a little more doable. Let's assume that you can parse the sentence and interpret its literal meaning (not a trivial task, but that problem has been solved at least somewhat).


You now have context from:



  1. All the phrases in the conversation.

  2. The response of the other speaker.


Cross-Referenced Phrases


To leverage #1, you might cross reference all phrases with each other. Are any of them directly contradictory?


Example:


Speaker 1: I LOVE Justin Bieber. Do you?

Speaker 2: Totally! I love him.

Speaker 1: What's your favorite thing about him?

Speaker 2: His awesome music!

Speaker 1: Really? What's your favorite song?

Speaker 2: Come on, you know I hate his music.


We know have two contradictory phrases, "I love him!" and "I hate his music". There's at least a chance sarcasm has occurred.


Question or Response from Other Speaker(s)


Approach #2 could be more effective (or useless...perhaps the sarcasm is known but unspoken between the two parties).


Example:


Speaker 1: Justin Bieber is in town. I am SO going to see him.

Speaker 2: Ha.


Another example:


Speaker 1: I LOVE Justin Bieber. Do you?

Speaker 2: I have a giant poster of him above my bed.

Speaker 1: Yeah right.


Getting even more elaborate, you could apply a heuristic to determine how sharply the conversation deviated after a particular phrase.


Speaker 1: I am so totally into Justin Bieber!!! Are you?

Speaker 1 has made an emphatic statement

Speaker 2: Yeah, sure.

Sarcastic. We don't know that, but the other person in the conversation does.


What direction does Speaker 1 take now? do they change the subject? Depending on how sharply the conversation turns, it may indicate how they reacted to the perceived response.


All that said, most of this would require sophisticated processing and I would expect a very low accuracy rate at best. But it's a fascinating question.




Source:


http://stackoverflow.com/questions/14097388/can-an-algorithm-detect-sarcasm






The News fromhttp://buzzbieber.blogspot.com