The User-Aware A rabic Gender Rewriter (2023)

Abstract: We introduce the User-Aware Arabic Gender Rewriter, a user-centric web-based system for Arabic gender rewriting in contexts involving two users. The system takes either Arabic or English sentences as input, and provides users with the ability to specify their desired first and/or second person target genders. The system outputs gender rewritten alternatives of the Arabic sentences (provided directly or as translation outputs) to match the target users’ gender preferences.

## introduction gender stereotypes, both negative and positive, are manifest in most of the world's languages @xcite and are further propagated and amplified by nlp systems @xcite (see figure 1 ). this is because nlp systems rely on human-created language corpora that mirror the societal biases and inequalities of the world we live in @xcite . for instance, figure 2(a ) presents part of a cooking recipe published on an arabic popular cooking website targeting female readers, foot_0 whereas figure @xcite shows part of an article on career advice that is published on harvard business review in arabic targeting male readers. 2 however, even if overt gender biases are removed from datasets before using them to build nlp models, some commercial nlp systems have solved this problem by generating more than one genderspecific output when the system encounters ambiguous scenarios. for instance, google translate generates both feminine and masculine translations when translating gender-neutral english sentences (e.g., i am a doctor) to a limited number of languages, such as spanish @xcite . however, this approach does not work well in multi-user contexts (first and second persons, with independent grammatical gender preferences), particularly when dealing with gender-marking morphologically rich languages. one example of this phenomenon is the arabic machine translation of the sentence i am a doctor and you are a nurse. figure 1 shows that google translate outputs the arabic translation âna tbyb wânt mmrdℏ 3 'i am a [male] doctor and you are a [female] nurse', whereas a more suitable output would include all four possible arabic translations of the input sentence. one approach to mitigate the ambiguity is to provide the users with the ability to specify their desired target gender preferences so that nlp systems would generate personalized unbiased outputs. to this end, we build on the work of @xcite where they formally introduced the task of gender rewriting and developed a user-3 arabic hsb transliteration @xcite . centric gender rewriting model for arabic. 4 we introduce the user-aware arabic gender rewriter, a user-centric web-based system for arabic gender rewriting in contexts involving two users. 5 our system takes either arabic or english sentences as input, and provides users with the ability to specify their desired first and/or second person grammatical target genders. the system outputs gender rewritten alternatives of the arabic input sentences (or their arabic translations in case of english input) to match the target users' gender preferences. to the best of our knowledge, this is the first openaccess web-based arabic gender rewriting system. our goal behind creating an easy-to-use webbased multi-user arabic gender rewriting tool is to enable users to rewrite any arabic text based on their grammatical gender preferences that are consistent with their social identities. this reduces the gender bias that is caused by user-unaware nlp systems and increases the inclusiveness of arabic nlp applications, leading to a better user experience. we envision a future in which websites such as those in figure 2 could use automatic gender rewriting that fits the private preferences of their readers, or that is adjusted with simple website controls comparable to selecting different languages. the rest of this paper is organized as follows. we discuss related work and arabic linguistic facts in §2 and §3, respectively. we describe the design and implementation of the web-based arabic gender rewriter in §4 and conclude in §5. research has shown that nlp systems embed and amplify gender bias in a variety of core tasks such as machine translation (mt) @xcite @xcite @xcite @xcite @xcite @xcite @xcite and dialogue systems @xcite @xcite @xcite . most existing solutions to mitigate gender bias in nlp systems either focus on debiasing pretrained representations used in downstream tasks @xcite @xcite or on training systems on gender-balanced corpora @xcite @xcite @xcite . more recently, text rewriting models were introduced to mitigate gender bias by either neutralizing the outputs of nlp systems or changing their grammatical genders to match provided users' gender preferences. @xcite and @xcite presented rule-based and neural rewriting models to generate gender-neutral sentences in english. for morphologically rich languages and specifically arabic, @xcite and @xcite , introduced gender identification and rewriting models to rewrite firstperson-singular arabic sentences based on the target user gender requirements. the task of gender rewriting was formally introduced by @xcite where they developed a new approach for arabic gender rewriting in contexts involving two users (i and/or you) -first and second grammatical persons with independent grammatical gender preferences, and showed improvements over both @xcite and @xcite systems. the tool we introduce in this work uses the best gender rewriting model developed by alhafni et al. (2022b). 4 it is worth noting that our tool is similar to the recently introduced fairslator @xcite , a human-in-the-loop web-based tool for detecting and correcting gender bias in the output of mt systems translating from english to french, german, czech, or irish. 6 however, our work is different from theirs in the following ways: ## arabic linguistic background arabic has a rich morphological system that inflects for gender, number, person, case, state, aspect, mood and voice, in addition to numerous attachable clitics (prepositions, particles, pronouns) @xcite . arabic nouns, adjectives, and verbs inflect for gender: masculine (m) and feminine (f), and for number: singular (s), dual (d) and plural (p). grammatical gender and number are commonly expressed using inflectional suffixes that represent some number and gender combination. pronominal clitics also express gender and number combinations, e.g., tbyb+km 'your [masculine plural] doctor [feminine singular]. gender and number participate in the morpho-syntactic agreement within specific constructions such as nouns and their adjectives and verbs and their subjects. in practice, gender-specific words that are candidates for gender rewriting account for 10% of all words in all sentences and 17% of all words in gender-specific sentences. these statistics are calculated from the arabic parallel gender corpus (apgc) v2.1 @xcite , which we use to train our models. the arabic gender rewriter ‫"ﺔ‬ ‫ٮ‬ @xmath0 ‫اﻟﺤ‬ ‫اﻟﺼيﻎ‬ ‫"ﻞ‬ ‫ﺗﻌﺪٮ‬ ‫ﺎم‬ ; ‫ﻧﻄ‬ target speaker ‫ﻣﺘكﻠﻢ/ة‬ input text ‫اﻷﺻﲇ‬ ‫اﻟﻨﺺ‬ target listener ‫ﺎﻃﺐ/ة‬ 1 ‫ﻣﺤ‬ ♀ ♂ ♀ ♂ i am a doctor and you are a nurse ‫ﺮﺗﻚ‬ @xmath1ى‬ ‫ڡ‬ ‫ﺐ‬ 8 ‫ﻣﺎﺗﺮﻋ‬ ‫ﺔ‬ ‫ﻣﻌﺮڡ@xmath2 ‫ﺳڡ‬ ‫ﻋﲆ‬ ♀ ‫ﺪﻣيﻬﺎ‬ / ‫وڡ‬ ‫أﺻﻮﻟﻬﺎ‬ ‫ﻋﲆ‬ ‫ﻨوج‬ 8 ‫ﻋ‬ ‫ﺎ‬ 9 ‫ﺎٮ‬ 9 ‫اﻟٮ‬ ‫ﺳﻠﻄﺔ‬ ♀ ‫ﺣﻀﺮي‬ ♂ ‫ﺪأ‬ ) ‫ﺗٮ‬ ‫أن‬ ‫‪f‬ﻌﲏ‬ ‫ٮ‬ ‫.ﻪ‬ ‫ڡ‬f ‫.ٮ‬ ‫ﺗﺤڡ‬ i ‫@xmath3‬ ‫ﻷن‬ : ‫ﻄﻮة‬ 8 ‫اﻟﺤ‬ ‫ﺗﻠﻚ‬ ‫ﺎذك‬ 8 ‫اﺗﺤ‬ ‫ﺐ‬ 9 ‫ﺳٮ‬ ♂ ‫ﺣﺪد‬ rewritten text ‫اﻟﻤﻌﺪل‬ ‫اﻟﻨﺺ‬ ♀ ‫ﻣﻤﺮﺿﺔ‬ ‫وأﻧﺖ‬ ‫ﺔ‬ ) ‫'ٮ‬ ‫ٮ‬ ) ‫ﻃٮ‬ ‫أﻧﺎ‬ ‫ﺮﺗﻚ‬ @xmath4ى‬ ‫ڡ‬ ‫ﱯ‬ 7 ‫ﻣﺎﺗﺮﻋ‬ ‫ﺔ‬ ‫ﻣﻌﺮڡ@xmath5 ‫اﻟﻌرٮ‬ ‫اﻟﻨﺼﻮص‬ . ‫ى‬ 0 ‫ڡ‬ ‫"ﺔ‬ ‫ﻨﺴٮ‬ @xmath6 ‫ﺳڡ‬ ‫ﻋﲆ‬ ‫.ﺪﻣيﻬﺎ‬ ‫وڡ‬ ‫أﺻﻮﻟﻬﺎ‬ ‫ﻋﲆ‬ ‫ﻨوج‬ 8 ‫ﻋ‬ ‫ﺎ‬ 9 ‫ﺎٮ‬ 9 ‫اﻟٮ‬ ‫ﺳﻠﻄﺔ‬ ‫ﺣﻀﺮي‬ ‫ﺪأ‬ 9 ‫ﺗٮ‬ ‫أن‬ ‫‪f‬ﻌﲏ‬ ‫ٮ‬ ‫.ﻪ‬ ‫ڡ‬f ‫.ٮ‬ ‫ﺗﺤڡ‬ i ‫@xmath7‬ ‫ﻷن‬ ‫ﻄﻮة:‬ 8 ‫اﻟﺤ‬ ‫ﺗﻠﻚ‬ ‫ﺎذك‬ 8 ‫اﺗﺤ‬ ‫ﺐ‬ 9 ‫ﺳٮ‬ ‫ﺣﺪد‬ translate & rewrite / ‫وﻋﺪل‬ ‫ﻢ‬ & ‫ﺗﺮﺣ‬ target speaker ‫ﻣﺘكﻠﻢ/ة‬ gender-identified input ‫اﻟﻤﻮﺳﻢ‬ ‫اﻟﻨﺺ‬ target listener ‫ﺎﻃﺐ/ة‬ 1 ‫ﻣﺤ‬ ♀ ‫ﻣﻤﺮﺿﺔ‬ ‫وأﻧﺖ‬ ♂ ‫'ﺐ‬ ‫ٮ‬ ) ‫ﻃٮ‬ ‫أﻧﺎ‬ ‫ﺮﺗﻚ‬ @xmath8ى‬ ‫ڡ‬ ♂ ‫ﺐ‬ 7 ‫ﻣﺎﺗﺮﻋ‬ ‫ﺔ‬ ‫ﻣﻌﺮڡ@xmath9 ‫ﺳڡ‬ ‫ﻋﲆ‬ ‫ﺪﻣيﻬﺎ‬ / ‫وڡ‬ ‫أﺻﻮﻟﻬﺎ‬ ‫ﻋﲆ‬ ‫ﻨوج‬ 8 ‫ﻋ‬ ‫ﺎ‬ 9 ‫ﺎٮ‬ 9 ‫اﻟٮ‬ ‫ﺳﻠﻄﺔ‬ ‫ﺣﻀﺮي‬ : ‫ﺪﺋى‬ ) ‫ﺗٮ‬ ‫أن‬ ‫‪f‬ﻌﲏ‬ ‫ٮ‬ ‫.ﻪ‬ ‫ڡ‬f ‫.ٮ‬ ‫ﺗﺤڡ‬ i ‫@xmath10‬ ‫ﻷن‬ : ‫ﻄﻮة‬ 8 ‫اﻟﺤ‬ ‫ﺗﻠﻚ‬ ‫ﺎذك‬ 8 ‫اﺗﺤ‬ ‫ﺐ‬ 9 ‫ﺳٮ‬ ‫ﺣﺪدي‬ ♀ ♀ ‫ﻣﻤﺮض‬ ‫وأﻧﺖ‬ ‫ﺔ‬ ) ‫'ٮ‬ ‫ٮ‬ ) ‫ﻃٮ‬ ‫أﻧﺎ‬ ‫ﺮﺗﻚ‬ @xmath11ى‬ ‫ڡ‬ ‫ﺐ‬ 7 ‫ﻣﺎﺗﺮﻋ‬ ‫ﺔ‬ ‫ﻣﻌﺮڡ@xmath12 ‫اﻟﻌرٮ‬ ‫اﻟﻨﺼﻮص‬ . ‫ى‬ 0 ‫ڡ‬ ‫"ﺔ‬ ‫ﻨﺴٮ‬ @xmath13 ‫ﺳڡ‬ ‫ﻋﲆ‬ ‫.ﺪﻣيﻬﺎ‬ ‫وڡ‬ ‫أﺻﻮﻟﻬﺎ‬ ‫ﻋﲆ‬ ‫ﻨوج‬ 8 ‫ﻋ‬ ‫ﺎ‬ 9 ‫ﺎٮ‬ 9 ‫اﻟٮ‬ ‫ﺳﻠﻄﺔ‬ ‫ﺣﻀﺮي‬ ‫ﺪأ‬ 9 ‫ﺗٮ‬ ‫أن‬ ‫‪f‬ﻌﲏ‬ ‫ٮ‬ ‫.ﻪ‬ ‫ڡ‬f ‫.ٮ‬ ‫ﺗﺤڡ‬ i ‫@xmath14‬ ‫ﻷن‬ ‫ﻄﻮة:‬ 8 ‫اﻟﺤ‬ ‫ﺗﻠﻚ‬ ‫ﺎذك‬ 8 ‫اﺗﺤ‬ ‫ﺐ‬ 9 ‫ﺳٮ‬ ‫ﺣﺪد‬ translate & rewrite / ‫وﻋﺪل‬ ‫ﻢ‬ & ‫ﺗﺮﺣ‬ target speaker ‫ﻣﺘكﻠﻢ/ة‬ gender-identified input ‫اﻟﻤﻮﺳﻢ‬ ‫اﻟﻨﺺ‬ target listener ‫ﺎﻃﺐ/ة‬ 1 ‫ﻣﺤ‬ ♀ ‫ﻣﻤﺮﺿﺔ‬ ‫وأﻧﺖ‬ ♂ ‫'ﺐ‬ ‫ٮ‬ ) ‫ﻃٮ‬ ‫أﻧﺎ‬ ‫ﺮﺗﻚ‬ @xmath15ى‬ ‫ڡ‬ ♂ ‫ﺐ‬ 7 ‫ﻣﺎﺗﺮﻋ‬ ‫ﺔ‬ ‫ﻣﻌﺮڡ@xmath16 ‫ﺳڡ‬ ‫ﻋﲆ‬ ‫ﺪﻣيﻬﺎ‬ / ‫وڡ‬ ‫أﺻﻮﻟﻬﺎ‬ ‫ﻋﲆ‬ ‫ﻨوج‬ 8 ‫ﻋ‬ ‫ﺎ‬ 9 ‫ﺎٮ‬ 9 ‫اﻟٮ‬ ‫ﺳﻠﻄﺔ‬ ‫ﺣﻀﺮي‬ : ‫ﺪﺋى‬ ) ‫ﺗٮ‬ ‫أن‬ ‫‪f‬ﻌﲏ‬ ‫ٮ‬ ‫.ﻪ‬ ‫ڡ‬f ‫.ٮ‬ ‫ﺗﺤڡ‬ i ‫@xmath17‬ ‫ﻷن‬ : ‫ﻄﻮة‬ 8 ‫اﻟﺤ‬ ‫ﺗﻠﻚ‬ ‫ﺎذك‬ 8 ‫اﺗﺤ‬ ‫ﺐ‬ 9 ‫ﺳٮ‬ ‫ﺣﺪدي‬ ♀ ♂ ‫ﻣﻤﺮﺿﺔ‬ ‫وأﻧﺖ‬ ‫'ﺐ‬ ‫ٮ‬ ) ‫ﻃٮ‬ ‫أﻧﺎ‬ ‫ﺮﺗﻚ‬ @xmath18ى‬ ‫ڡ‬ ‫ﱯ‬ 7 ‫ﻣﺎﺗﺮﻋ‬ ‫ﺔ‬ ‫ﻣﻌﺮڡ@xmath19 ‫اﻟﻌرٮ‬ ‫اﻟﻨﺼﻮص‬ . ‫ى‬ 0 ‫ڡ‬ ‫"ﺔ‬ ‫ﻨﺴٮ‬ @xmath20 ‫ﺳڡ‬ ‫ﻋﲆ‬ ‫.ﺪﻣيﻬﺎ‬ ‫وڡ‬ ‫أﺻﻮﻟﻬﺎ‬ ‫ﻋﲆ‬ ‫ﻨوج‬ 8 ‫ﻋ‬ ‫ﺎ‬ 9 ‫ﺎٮ‬ 9 ‫اﻟٮ‬ ‫ﺳﻠﻄﺔ‬ ‫ﺣﻀﺮي‬ ‫ﺪأ‬ 9 ‫ﺗٮ‬ ‫أن‬ ‫‪f‬ﻌﲏ‬ ‫ٮ‬ ‫.ﻪ‬ ‫ڡ‬f ‫.ٮ‬ ‫ﺗﺤڡ‬ i ‫@xmath21‬ ‫ﻷن‬ ‫ﻄﻮة:‬ 8 ‫اﻟﺤ‬ ‫ﺗﻠﻚ‬ ‫ﺎذك‬ 8 ‫اﺗﺤ‬ ‫ﺐ‬ 9 ‫ﺳٮ‬ ‫ﺣﺪد‬ translate & rewrite / ‫وﻋﺪل‬ ‫ﻢ‬ & ‫ﺗﺮﺣ‬ target speaker ‫ﻣﺘكﻠﻢ/ة‬ gender-identified input ‫اﻟﻤﻮﺳﻢ‬ ‫اﻟﻨﺺ‬ target listener ‫ﺎﻃﺐ/ة‬ 1 ‫ﻣﺤ‬ ♀ ‫ﻣﻤﺮﺿﺔ‬ ‫وأﻧﺖ‬ ♂ ‫'ﺐ‬ ‫ٮ‬ ) ‫ﻃٮ‬ ‫أﻧﺎ‬ ‫ﺮﺗﻚ‬ @xmath22ى‬ ‫ڡ‬ ♂ ‫ﺐ‬ 7 ‫ﻣﺎﺗﺮﻋ‬ ‫ﺔ‬ ‫ﻣﻌﺮڡ@xmath23 ‫ﺳڡ‬ ‫ﻋﲆ‬ ‫ﺪﻣيﻬﺎ‬ / ‫وڡ‬ ‫أﺻﻮﻟﻬﺎ‬ ‫ﻋﲆ‬ ‫ﻨوج‬ 8 ‫ﻋ‬ ‫ﺎ‬ 9 ‫ﺎٮ‬ 9 ‫اﻟٮ‬ ‫ﺳﻠﻄﺔ‬ ‫ﺣﻀﺮي‬ : ‫ﺪﺋى‬ ) ‫ﺗٮ‬ ‫أن‬ ‫‪f‬ﻌﲏ‬ ‫ٮ‬ ‫.ﻪ‬ ‫ڡ‬f ‫.ٮ‬ ‫ﺗﺤڡ‬ i ‫@xmath24‬ ‫ﻷن‬ : ‫ﻄﻮة‬ 8 ‫اﻟﺤ‬ ‫ﺗﻠﻚ‬ ‫ﺎذك‬ 8 ‫اﺗﺤ‬ ‫ﺐ‬ 9 ‫ﺳٮ‬ ‫ﺣﺪدي‬ ♀ ♀ ‫ﻣﻤﺮض‬ ‫وأﻧﺖ‬ ‫ﺔ‬ ) ‫'ٮ‬ ‫ٮ‬ ) ‫ﻃٮ‬ ‫أﻧﺎ‬ ‫ﺮﺗﻚ‬ @xmath25ى‬ ‫ڡ‬ ‫ﺐ‬ 7 ‫ﻣﺎﺗﺮﻋ‬ ‫ﺔ‬ ‫ﻣﻌﺮڡ@xmath26 ‫ﺳڡ‬ ‫ﻋﲆ‬ ‫ﺪﻣيﻬﺎ‬ / ‫وڡ‬ ‫أﺻﻮﻟﻬﺎ‬ ‫ﻋﲆ‬ ‫ﻨوج‬ 8 ‫ﻋ‬ ‫ﺎ‬ 9 ‫ﺎٮ‬ 9 ‫اﻟٮ‬ ‫ﺳﻠﻄﺔ‬ ‫ﺣﻀﺮي‬ : ‫ﺪﺋى‬ ) ‫ﺗٮ‬ ‫أن‬ ‫‪f‬ﻌﲏ‬ ‫ٮ‬ ‫.ﻪ‬ ‫ڡ‬f ‫.ٮ‬ ‫ﺗﺤڡ‬ i ‫@xmath27‬ ‫ﻷن‬ : ‫ﻄﻮة‬ 8 ‫اﻟﺤ‬ ‫ﺗﻠﻚ‬ ‫ﺎذك‬ 8 ‫اﺗﺤ‬ ‫ﺐ‬ 9 ‫ﺳٮ‬ ‫ﺣﺪدي‬ ♀ ♂ ‫ﻣﻤﺮض‬ ‫وأﻧﺖ‬ ‫'ﺐ‬ ‫ٮ‬ ) ‫ﻃٮ‬ ‫أﻧﺎ‬ ‫ﺮﺗﻚ‬ @xmath28ى‬ ‫ڡ‬ ‫ﺐ‬ 7 ‫ﻣﺎﺗﺮﻋ‬ ‫ﺔ‬ ‫ﻣﻌﺮڡ$‬ ‫ﻷن‬ : ‫ﻄﻮة‬ 8 ‫اﻟﺤ‬ ‫ﺗﻠﻚ‬ ‫ﺎذك‬ 8 ‫اﺗﺤ‬ ‫ﺐ‬ 9 ‫ﺳٮ‬ ‫ﺣﺪد‬ 4 design and implementation ## conclusion and future work we introduced the user-aware arabic gender rewriter, a user-centric web-based system for arabic gender rewriting in contexts involving two users. our system takes either arabic or english sentences as input, and provides users with the ability to specify their desired first and/or second persons target genders. the system outputs gender rewritten alternatives of the arabic input sentences (or their arabic translations in case of english input) to match the target users' gender preferences. moreover, the system highlights arabic gender-marking words in both the input and the output to provide a better user-experience. in future work, we plan to continue improving our gender rewriting back-end by adding better gender rewriting models and enhancing inference efficiency, as well as expanding gender identification and rewriting to third person entities. we also plan to improve the interface by enabling users to provide feedback that can be collected and used to enhance the performance of gender rewriting. we will also improve the visualization we use to highlight arabic gender marking words by examining the added value it provides to different end users, from language learners to native text editors.