Detection of Sarcasm in News Headlines Using NLP and Machine Learning
摘要
Sarcasm detection in written text, particularly in short, context-limited formats such as news headlines, poses a considerable challenge in natural language processing). Sarcasm often conveys sentiments directly opposing to the literal meaning, hindering the accuracy of traditional sentiment analysis models. This challenge holds relevance in fields such as social media analysis, news aggregation, and conversational agents, where discerning true sentiment is crucial for effective content processing and user interaction. This paper introduces a deep learning-based sarcasm detection model specifically designed to classify sarcastic and non-sarcastic news headlines. The model is trained on a dataset of over 26,000 news headlines sourced from Kaggle, labelled as sarcastic or non-sarcastic. To learn the patterns of sarcasm in news headlines, a long short-term memory neural network was used after preprocessing the text data. To enhance model performance, techniques such as dropout and L2 regularization were implemented to reduce overfitting, and early stopping was used to stop training when validation loss stopped reducing. The trained model achieved an accuracy of 84.82% and an area under the curve score of 0.93 on the test dataset, demonstrating its effectiveness in detecting sarcasm in news headlines. Analysis of misclassified examples revealed common characteristics in sentences where the model struggled, often related to ambiguous language or subtle sarcasm lacking explicit contextual cues. Further analysis, incorporating linguistic and sentiment features, revealed insights into the distinctions between sarcastic and non-sarcastic news headlines, such as headline length and sentiment polarity. The findings from this research have implications for enhancing sentiment analysis models and conversational agents that rely on detecting sarcastic language. Future work can explore the integration of more advanced models, such as transformers, to better capture the context and nuances of sarcasm in text.