Sarcasm is really about the tone in which it is said, text doesn't hold vocal tone, also how feasible the statement is to being true can also determine if its sarcasm...
If the inputs are typed by users theres two ways you could do it.
One is based on what they write using internet lingo.
For example:
User might type:
"Yeah. Sure. I absolutely love him. /sarcasm"
You could do look ups for such keywords like /sarcasm [/sarcasm] etc
Alternatively you could use statistical odds:
"Yeah, and I'm the president of USA".... statistical odds of it being factually correct are so low it could be flagged as sarcasm.