Detection of Anxiety and Depression from Social Media Text Using Natural Language Processing
: The increasing global burden of anxiety and depression necessitates innovative computational approaches for early, non-intrusive detection. Social media platforms offer naturalistic data where individuals voluntarily express psychological states through text. This paper presents a comprehensive Natural Language Processing (NLP) pipeline for detecting linguistic correlates of anxiety and depression from social media text, a task distinct from clinical diagnosis. We systematically compare traditional machine learning models (Logistic Regression, SVM, Random Forest) and deep learning architectures (BiLSTM with Attention, fine-tuned BERT) across three benchmark datasets: SMHD, Dreaddit, and CLPsych 2015. Fine-tuned BERT achieves the highest macro-averaged F1 scores of 0.918, 0.909, and 0.862 respectively, outperforming traditional models by 7.1–17.3%. SHAP analysis identifies negative emotion, past-focused language, and somatic markers as the most predictive features. Cross-dataset validation reveals 15–25% performance degradation, highlighting the need for domain adaptation. Ethical considerations including false-positive risks and the gap between linguistic detection and clinical validity are discussed.