تشخیص خودکار جنسیت نویسنده متن فارسی با استفاده از مدل پارس‌برت و ویژگی‌های زبانی

نوع مقاله : مقاله پژوهشی

نویسندگان

1 استادیار، گروه ریاضی، دانشکدة آمار، ریاضی و رایانه، دانشگاه علامه طباطبائی، تهران، ایران.

2 دکتری زبان‌شناسی همگانی، گروه زبان و ادبیات انگلیسی، دانشکده زبان و ادبیات، دانشگاه بوعلی‌سینا، همدان، ایران

چکیده

متون نوشتاری دربردارنده اطلاعات زبانی ارزشمندی هستند که می‌توان از آن‌ها برای تعیین جنسیت نویسنده بهره برد. دراین‌بین، استفاده از الگوریتم‌های یادگیری عمیق در پردازش متون زبان طبیعی، شناسایی الگوهای پنهان در داده‌ها را آسان کرده است. در این پژوهش با هدف شناسایی جنسیت نویسنده در زبان فارسی با تنظیم دقیق پارامترهای مدل پارس‌برت، سامانه‌ای برای این زبان طراحی شد. به این منظور، باتکیه‌بر ویژگی‌های زبانی متمایزکننده جنسیتی، ابتدا پیکره‌ای شاملِ 5000 سندِ برچسب‌گذاری‌شده تهیه‌ شد. سپس سامانه‌ای مبتنی‌بر ویژگی‌های زبانی و تعبیه‌سازی برداری طراحی‌ شد. این سامانه با روش اعتبارسنجی متقابل 10-تایی ارزیابی شد. برپایة یافته‌ها، معیار-اف در سامانة طراحی‌شده، معادل 5/76 درصد تعیین شد. همچنین مشخص شد مدل پیشنهادی در مقایسه با دسته‌بندی‌های رایج یادگیری ماشین و در مقایسه با مدل حافظة طولانی کوتاه‌مدت، عملکرد مطلوب‌تری دارد. افزون‌براین، مقایسة عملکرد سامانه بر پیکرة تهیه‌شده در این پژوهش با پیکره‌های پیشین، بهبود عملکرد سامانه را نشان داد. بنابراین، بهره‌گیری از روش‌های نوین همچون مدل پارس‌برت و استفاده از دادگان مناسب، از دستاوردهای اصلی این پژوهش محسوب می‌شود. 

کلیدواژه‌ها

موضوعات


عنوان مقاله [English]

Automatic Author Gender Identification From Persian Text Using ParseBert and Linguistic Features

نویسندگان [English]

  • Mohammad Bahrani 1
  • Seyedeh Sareh Sadeghi 2
1 Assistant Professor, Department of Mathematics, Faculty of Statistics, Mathematics and Computer Science, Allameh Tabatabaei University, Tehran, Iran.
2 Department of linguistics, Faculty of Language and humanities, Bu-Ali Sina University, Hamedan, Iran.
چکیده [English]

The sentences that people use during writing contain valuable information that can be used to identify the author's gender. Meanwhile, the use of deep learning algorithms in natural language processing helps identify hidden patterns in the text. In this research, an attempt is made to design a system for the Persian language that identifies the author's gender by fine-tuning the parameters of the ParsBERT model. For this purpose, first, a corpus of 5,000 documents labeled with gender tags is prepared, and then the author's gender identification system is designed and evaluated using 10-fold cross-validation. Experimental results show that the F-measure of the gender identification task is 76.5%. The proposed method is also compared with classic machine learning methods. It also achieves better results compared with the LSTM model. The results obtained from comparing the corpus prepared in this research with the corpus prepared in previous research for gender identification show an improvement in the system's performance. Thus, the use of new deep learning methods, such as the ParsBERT model, and appropriate data are among the main achievements of this research.
Introduction
Automatic gender classification has become a pivotal research area within computational linguistics due to its wide-ranging applications, including the enhancement of user-friendly digital environments and the improvement of security in online interactions. Since Koppel et al. (2002) pioneered automatic gender identification, technological advancements have increased interest in developing systems that infer demographic attributes, such as gender and age, as well as affective characteristics such as sentiment, from text. For Persian, a language with limited NLP resources, developing such systems is crucial for creating safer and more interactive online spaces, especially given that users can conceal their identities on social media platforms. This study stands out by introducing a gender-labeled emotional corpus and employing ParsBERT, a transformer-based model specifically designed for Persian, to capture subtle linguistic patterns that distinguish between male and female writing styles. The research examines whether ParsBERT can accurately identify the gender of authors in Persian texts and whether the use of an emotionally labeled corpus can enhance classification performance compared with other datasets. The hypotheses of this study are that linguistic features, such as emotional adjectives and adverbs, differ significantly between genders and that deep learning models, such as ParsBERT, outperform traditional machine learning methods.
Theoretical Background
The study is grounded in several decades of research on gender differences in language use. Lakoff (1975) argued that women tend to use specific linguistic patterns, such as confirmatory phrases (e.g., “isn’t it?”), which may reflect social dynamics. Tannen (1994) expanded on this perspective by identifying collaborative speech styles among women, emphasizing empathy, in contrast to competitive styles among men, which focus more on information transfer. Holmes (2013) highlighted the influence of social, cultural, and situational factors, cautioning against overgeneralizing gender differences. Brown and Levinson (1987) associated linguistic politeness strategies with social power dynamics. Recent studies, such as Brody (2013), have explored multifaceted factors, including age and ethnicity, while Chai et al. (2016) have examined online communication. Women have been reported to use more descriptive and emotional vocabulary, such as adjectives (“beautiful,” “amazing”) and intensifiers (“very,” “truly”), while men have been reported to favor functional, direct language (Newman et al., 2008). These differences provide a basis for feature selection in automated gender identification, while acknowledging the complexity of syntactic, semantic, and contextual linguistic patterns.
Related Work
Previous research on gender identification has covered various languages and methodological approaches. Cheng et al. (2011) achieved 85.1% accuracy in English using statistical features and classifiers, including Naive Bayes, Support Vector Machines (SVM), and Decision Trees. In Arabic, Alsmearat et al. (2017) employed bag-of-words representations and morphological features, while Rangel et al. (2019) found that SVM and neural networks were effective. Sboev et al. (2018) used convolutional and LSTM networks for Russian texts, which outperformed traditional methods. In Persian, Moradi and Bahrani (2015) reported 73.8% accuracy using psycholinguistic and stylistic features with traditional classifiers. Sajedi and Taslimi (2019) achieved 89.5% accuracy using Bayesian Random Forests on blog data. Zarifi and Naghavi (2022) reported an accuracy of 81.09% using conceptual vectorization, while Hekmatianzadehpour and Jalali Bidgoli (2019) obtained 85.7% accuracy by incorporating punctuation and n-grams. These studies highlight the potential of combining linguistic features with machine learning approaches, but they also underscore the relatively limited attention given to Persian-specific systems, which is the gap addressed by this research.
Methodology
The methodology focuses on constructing a gender-labeled emotional corpus and applying ParsBERT in conjunction with traditional classifiers. The corpus, adapted from Sadeghi et al. (2021), includes 23,000 Persian sentences categorized into five emotion categories (anger, sadness, joy, fear, and surprise), of which 5,000 documents (2,500 for each gender) were manually labeled according to gender. Preprocessing involves normalization, stemming, and stop-word removal to address Persian-specific challenges, such as inconsistent spacing and orthographic variations (Ghayoomi et al., 2009). For text representation, Word2Vec and bag-of-words approaches are employed, with 100-dimensional vectors representing the average word embeddings of each document. Classification models include Naive Bayes, SVM, Decision Trees (J48), LSTM, and ParsBERT. ParsBERT, a BERT-based model developed for Persian, is fine-tuned with a batch size of 32, a learning rate of 10⁻⁴, and a feed-forward layer with softmax activation for binary classification (female vs. male). It employs 12 hidden layers, 12 attention heads, and a 768-dimensional hidden representation, and is optimized using the Adam optimizer (Kingma & Ba, 2014). Performance is evaluated using 10-fold cross-validation with precision, recall, and F1-score as evaluation metrics.
Evaluation
ParsBERT achieved the highest performance, with an accuracy of 77%, a recall of 76%, and an F1-score of 76.5%, surpassing traditional classifiers and the LSTM model. Its superior performance can be attributed to its transformer-based architecture, which is capable of capturing deep semantic relationships and subtle stylistic differences, such as pronoun usage, sentence length, and emotional tone, that are not readily captured by TF-IDF or Word2Vec embeddings. A comparison with the corpus developed by Moradi and Bahrani (2015), which comprises conversational texts, reviews, and narratives, indicates that the model performs better on the emotional corpus. This improvement may be attributed to the corpus’s emphasis on emotionally charged texts, which may provide more salient gender-related linguistic patterns.
The error analysis revealed three main types of errors: neutral texts that are difficult to distinguish based on gender, texts in which one gender adopts stylistic patterns associated with the other gender, and errors arising from model limitations resulting from the relatively small size of the dataset. Increasing the size and diversity of the corpus may help reduce these errors and consequently improve overall classification performance.
Conclusion
This study contributes to the advancement of automatic gender identification in Persian by introducing a gender-labeled emotional corpus and leveraging the deep-learning capabilities of ParsBERT. The achieved accuracy of 77% demonstrates the effectiveness of transformer-based models in capturing nuanced linguistic differences in comparison with traditional methods. The emotional corpus may further enhance classification performance by providing linguistically rich, emotionally charged texts that highlight gender-specific language patterns. The publicly available corpus provides a valuable resource for future research in Persian NLP. More broadly, this study contributes to the development of NLP resources for low-resource languages and may support more effective human–machine interactions in digital environments.
Future research could focus on developing larger and more diverse corpora and investigating more advanced transformer-based architectures to further improve classification accuracy and generalizability, while addressing the remaining challenges in Persian NLP.
Ethical Considerations
Not applicable
Funding
Not applicable
Conflict of interest
The authors declare no conflict of interest

کلیدواژه‌ها [English]

  • automatic author gender identification
  • gender tagged corpus
  • ParseBert model
  • speech gender differences
  • text embedding
حکمتیان ‌زاده‌پور، سیامک؛ جلالی بیدگلی، امیر (1398، اردیبهشت). تشخیص خودکار جنسیت نویسنده نظرات نوشته‌شده به زبان فارسی. سومین همایش ملی دانش و فناوری مهندسی برق، کامپیوتر و مکانیک ایران.
ساجدی، هدیه؛ تسلیمی، مهناز (۱۳۹۸). تشخیص جنسیت نویسندگان از روی متون با استفاده از جنگل تصادفی بیز. پردازش علائم و داده‌ها، ۱۶(۱)، ۱۴۳-۱۵۶.
مرادی، مهدی؛ بحرانی، محمد (1394). تشخیص خودکار جنسیت نویسنده در متون فارسی. پردازش علائم و داده‌ها، 12(4)، 83-94.