The rising prevalence of harassment in Middle Eastern countries is mirrored in literary works from the region. However, extracting data from these texts to understand the typology and frequency of the cases poses a significant challenge due to human cognitive limitations and potential biases. Thus, this study aims to use natural language processing (NLP) approaches to propose a machine learning framework for text mining of sexual harassment content in literary texts. The data source for this study consists of twelve Middle Eastern novels. The proposed framework involves the classification of physical and non-physical types of sexual harassment using a machine-learning model. Lexicon-based sentiment and emotion detection are applied to sentences containing instances of sexual harassment for data labelling and analysis. Finally, a long short-term memory-gated recurrent unit (LSTM-GRU) deep learning model is built to classify the sentiment characteristics that induce sexual harassment. The proposed model achieved an accuracy of 75.8% while outperforming five other algorithms. Additionally, a sentiment classification with three labels—negative, positive, and neutral—was developed using an LSTM-GRU RNN deep learning model. The accuracy of this model was 84.5%. Most statements, even those involving physical sexual harassment, which had greater levels of sexual harassment, had negative sentiments, according to lexicon-based sentiment analysis. This study contributes to the field of text mining by providing a novel approach to identifying instances of sexual harassment in literature in English from the Middle East. The use of machine learning models and sentiment analysis techniques allows for more accurate identification and classification of different types of sexual harassment. Furthermore, this study sheds light on the prevalence of sexual harassment in Middle Eastern countries and highlights the need for further research and action to address this issue.