Identifying Code-switching in Arabizi
Paper · 2022 · Safaa Shehadi and Shuly Wintner
Summary
Arabizi is dialectal Arabic written in Latin letters. It is common on social media, where writers often mix it with English, French, or Arabic script. Standard language identifiers cannot recognise it, so large resources for studying code-switching in Arabizi have been missing. The authors gathered raw text from Arabic-related subreddits. They also collected Twitter timelines of users found through Egyptian and Lebanese seed words. A subset was annotated by hand with word-level language tags. The tag scheme includes a special label for words that could belong to more than one mental lexicon, such as proper names and cognates. Classifiers trained on these annotations tag individual words. Their outputs are then combined into multi-bit sentence tags that record which languages appear in a sentence. Applied to the raw corpus, this pipeline produced about 887K sentences containing Arabizi, of which roughly 446K show code-switching with English or French. The data, annotations and classifiers are public, and they give a basis for corpus-scale research on code-switching and on shared words as possible triggers.
Key points
- Raw data comes from two sources:
- Reddit: r/arab, r/arabs, r/egypt, r/jordan, r/lebanon and r/syria, totalling about 3.58M sentences and 59.6M words.
- Twitter: about 2.47M sentences from 1090 users (936 Egyptian, 154 Lebanese).
- Spacy, LangDetect, langid and FastText were tested on 100 Arabizi sentences from Tobaili (2016). None of them recognised Arabizi or even Arabic; LangDetect, for example, chose Somali 43 times.
- Sentence tags derived from word-level predictions reached 0.78 exact accuracy on the 6-bit tag. This clearly beats direct sentence classification. Arabic was identified perfectly in both approaches, thanks to its distinct script.
- The automatically labelled corpus contains:
- 886,827 sentences with at least one Arabizi token;
- 546,883 sentences that are mostly Arabizi;
- 443,014 sentences with Arabizi–English code-switching;
- 3,078 sentences with Arabizi–French code-switching.
- In a manual check of 100 sentences predicted as Arabizi–English code-switched, 77 were correct. Typical errors were informal English spellings ("da", "ya"), Arabic-origin place names, and tokens mixing letters and digits.
Interesting ideas
- I1. The tag scheme gives words that belong to several lexicons at once (names, cognates) their own "shared" label instead of forcing a single language, which makes the ambiguity explicit and available for later study.
- I2. Building sentence-level labels from word-level predictions worked much better than training a separate sentence classifier, and every sentence label can be traced back to the tokens behind it.
- I3. Before building their own tool, the authors ran existing tools on a small sample with known labels and exposed systematic failure modes such as the default to Somali.
- I4. Data was collected by snowballing: seed words found users, and then all posts by those users were taken. Seeds that collided with other languages or with common names (mazboot, baddi, balki) were dropped after inspection.
- I5. Character runs were shortened to two letters ("youuuu" becomes "youu"), which reduces sparsity while still showing that a word was stretched for emphasis.
For Mova
How these ideas could serve Mova, our small open language model — its files, stages and tests:
- I1 (tokens): The tagger could mark loanwords, foreign names and cognates as shared-origin rather than guessing, so downstream steps can see and explain that uncertainty.
- I2 (learn): Sentence-level judgments (for example, whether a sentence is in-domain or worth keeping as silver data) could be composed from token-level decisions, so each one stays explainable.
- I3 (learn): A small gold sample with known answers can act as a negative control, showing when an off-the-shelf witness component falls into a default guess instead of actually working.
- I4 (learn): Domain text could be gathered the same way, with an explicit audit step that removes seeds which pull in off-target material.
- I5 (tokens): Informal input could be normalised the same way before lemmatisation, keeping a flag for the elongation so the frames stage could later use the emphasis cue.
Institutions
Fields, topics and concepts
📚 Shelves 5The field of science this work belongs to (OpenAlex fields).Computer Science · 16,667 worksArtificial Intelligence · 16,194 worksArts and Humanities · 16,039 worksLanguage and Linguistics · 15,891 worksHuman-Computer Interaction · 141 works
🧭 Topics 2Research subjects and languages the work is about.Semitic languages · 2,908 worksMultilingual & cross-lingual NLP · 828 works
Cite
Cite as Safaa Shehadi and Shuly Wintner. 2022. Identifying Code-switching in Arabizi. Proceedings of the Seventh Arabic Natural Language Processing Workshop (WANLP).
@inproceedings{shehadi2022identifying,
title = {{Identifying Code-switching in Arabizi}},
author = {Safaa Shehadi and Shuly Wintner},
booktitle = {Proceedings of the Seventh Arabic Natural Language Processing Workshop (WANLP)},
year = {2022},
doi = {10.18653/v1/2022.wanlp-1.18},
url = {https://doi.org/10.18653/v1/2022.wanlp-1.18}
}References
- Wafia Adouane, Nasredine Semmar, and Richard Johansson. 2016. Romanized Berber and Romanized Arabic automatic language identification using machine learning. In Proceedings of the Third Workshop on NLP for Similar Languages, Varieties and Dialects (VarDial3), pages 53–61, Osaka, Japan.
- The COLING 2016 Organizing Committee. find
- Gustavo Aguilar, Fahad AlGhamdi, Victor Soto, Mona Diab, Julia Hirschberg, and Thamar Solorio. 2018. Named entity recognition on code-switched data: Overview of the CALCS 2018 shared task. In Proceedings of the Third Workshop on Computational Approaches to Linguistic Code-Switching, pages 138– 147. find
- Mohamed Al-Badrashiny, Ramy Eskander, Nizar Habash, and Owen Rambow. 2014. Automatic transliteration of Romanized dialectal Arabic. In Proceedings of the Eighteenth Conference on Computational Natural Language Learning, pages 30–38, Ann Arbor, Michigan. Association for Computational Linguistics.
- Gaétan Baert, Souhir Gahbiche, Guillaume Gadek, and Alexandre Pauchet. 2020. Arabizi language models for sentiment analysis. In Proceedings of the 28th International Conference on Computational Linguistics, pages 592–603, Barcelona, Spain (Online). International Committee on Computational Linguistics.
- Steven Bird, Ewan Klein, and Edward Loper. 2009. Natural Language Processing with Python. O’Reilly Media, Sebastopol, CA. find
- Mirjam Broersma. 2009. Triggered codeswitching between cognate languages. Bilingualism: Language and Cognition, 12(4):447–462. ↗
- Mirjam Broersma and Kees De Bot. 2006. Triggered codeswitching: A corpus-based evaluation of the original triggering hypothesis and a new alternative. Bilingualism: Language and cognition, 9(1):1–13. ↗
- Michael G. Clyne. 2003. Dynamics of language contact: English and immigrant languages. Cambridge approaches to language contact. Cambridge University Press, Cambridge. find
- Ryan Cotterell, Adithya Renduchintala, Naomi Saphra, and Chris Callison-Burch. 2014. An Algerian Arabic-French code-switched corpus. In Proceedings of the First Workshop on Free/Open-Source Arabic Corpora and Corpora Processing Tools. Association for Computational Linguistics. find
- Kareem Darwish. 2014. Arabizi detection and conversion to Arabic. In Proceedings of the EMNLP 2014 Workshop on Arabic Natural Language Processing (ANLP), pages 217–224, Doha, Qatar. Association for Computational Linguistics. ↗
- Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, pages 4171–4186. Association for Computational Linguistics.
- A. Seza Doğruöz, Sunayana Sitaram, Barbara E. Bullock, and Almeida Jacqueline Toribio. 2021. A survey of code-switching: Linguistic and social perspectives for language technologies. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 1654–1666. Association for Computational Linguistics.
- François Grosjean. 1998. Studying bilinguals: Methodological and conceptual issues. Bilingualism: Language and Cognition, 1(2):131 – 149. ↗
- Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural computation, 9(8):1735– 1780. ↗
- Matthew Honnibal, Ines Montani, Sofie Van Lan-deghem, and Adriane Boyd. 2020. spaCy: Industrial-strength Natural Language Processing in Python. find
- Zhiheng Huang, Wei Xu, and Kai Yu. 2015. Bidirectional LSTM-CRF models for sequence tagging. CoRR, abs/1508.01991. ↗
- Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. 2017. Bag of tricks for efficient text classification. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 427–431, Valencia, Spain. Association for Computational Linguistics. find
- John Lafferty, Andrew McCallum, and Fernando Pereira. 2001. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. In Proceedings of the 18th International Conference on Machine Learning (ICML-01), pages 282–289, San Francisco. Morgan Kaufmann. find
- Marco Lui and Timothy Baldwin. 2011. Cross-domain feature selection for language identification. In Proceedings of 5th International Joint Conference on Natural Language Processing, pages 553–561, Chiang Mai, Thailand. Asian Federation of Natural Language Processing. find
- Marco Lui and Timothy Baldwin. 2012. Langid.Py: An off-the-shelf language identification tool. In Proceedings of the ACL 2012 System Demonstrations, page 25–30, USA. Association for Computational Linguistics.
- Abir Masmoudi, Nizar Habash, Mariem Ellouze, Yannick Estève, and Lamia Hadrich Belguith. 2015. Arabic transliteration of Romanized Tunisian dialect text: A preliminary investigation. In Computational Linguistics and Intelligent Text Processing, pages 608– 619, Cham. Springer International Publishing. find
- Ossama Obeid, Nasser Zalmout, Salam Khalifa, Dima Taji, Mai Oudah, Bashar Alhafni, Go Inoue, Fadhl Eryani, Alexander Erdmann, and Nizar Habash. 2020. CAMeL tools: An open source python toolkit for Arabic natural language processing. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 7022–7032, Marseille, France. European Language Resources Association.
- Ella Rabinovich, Masih Sultani, and Suzanne Stevenson. 2019. CodeSwitch-Reddit: Exploration of written multilingual discourse in online discussion forums. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4776– 4786, Hong Kong, China. Association for Computational Linguistics. ↗
- Ella Rabinovich, Yulia Tsvetkov, and Shuly Wintner. 2018. Native language cognate effects on second language lexical choice. Transactions of the Association for Computational Linguistics, 6:329–342. ↗
- Younes Samih and Wolfgang Maier. 2016. An Arabic-Moroccan Darija code-switched corpus. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC’16), pages 4170–4175, Portorož, Slovenia. European Language Resources Association (ELRA).
- Djamé Seddah, Farah Essaidi, Amal Fethi, Matthieu Futeral, Benjamin Muller, Pedro Javier Ortiz Suárez, Benoît Sagot, and Abhishek Srivastava. 2020. Building a user-generated content North-African Arabizi treebank: Tackling hell. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1139–1150, Online. Association for Computational Linguistics. find
- Ali Shazal, Aiza Usman, and Nizar Habash. 2020. A unified model for Arabizi detection and transliteration using sequence-to-sequence models. In Proceedings of the Fifth Arabic Natural Language Processing Workshop, pages 167–177, Barcelona, Spain (Online). Association for Computational Linguistics.
- Thamar Solorio and Yang Liu. 2008. Learning to predict code-switching points. In Proceedings of the 2008 Conference on Empirical Methods in Natural Language Processing, pages 973–981, Honolulu, Hawaii. Association for Computational Linguistics.
- Victor Soto, Nishmar Cestero, and Julia Hirschberg. 2018. The role of cognate words, POS tags and entrainment in code-switching. In Proceedings of Interspeech 2018, the 19th Annual Conference of the International Speech Communication Association, pages 1938–1942. ISCA. find
- Victor Soto and Julia Hirschberg. 2019. Improving code-switched language modeling performance using cognate features. In Proceedings of Interspeech 2019, the 20th Annual Conference of the International Speech Communication Association, pages 3725–3729. ISCA. find
- Taha Tobaili. 2016. Arabizi identification in Twitter data. In Proceedings of the ACL 2016 Student Research Workshop, pages 51–57, Berlin, Germany. Association for Computational Linguistics.
- Samia Touileb and Jeremy Barnes. 2021. The interplay between language similarity and script on a novel multi-layer Algerian dialect corpus. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 3700–3712, Online. Association for Computational Linguistics. ↗
- Jihene Younes, Hadhemi Achour, Emna Souissi, and Ahmed Ferchichi. 2020. A deep learning approach for the Romanized Tunisian dialect identification. The International Arab Journal of Information Technology, 17(6):935–946. ↗
- Jihene Younes, Hadhemi Achour, Emna Souissi, and Ahmed Ferchichi. 2022. Romanized Tunisian dialect transliteration using sequence labelling techniques. J. King Saud Univ. Comput. Inf. Sci., 34(3):982–992. find
- Sunayana Sitaram, Khyathi Raghavi Chandu, Sai Krishna Rallabandi, and Alan W. Black. 2019. A survey of code-switched speech and language processing. ↗
- Thamar Solorio, Elizabeth Blair, Suraj Maharjan, Steven Bethard, Mona Diab, Mahmoud Ghoneim, Abdelati Hawwari, Julia AlGhamdi, Fa-hadand Hirschberg, Alison Chang, et al. 2014. Overview for the first shared task on language identification in code-switched data. In Proceedings of the First Workshop on Computational Approaches to Code Switching, pages 62–72.
- Thamar Solorio, Shuguang Chen, Alan W. Black, Mona Diab, Sunayana Sitaram, Victor Soto, Emre Yilmaz, and Anirudh Srinivasan, editors. 2021. Proceedings of the Fifth Workshop on Computational Approaches to Linguistic Code-Switching. Association for Computational Linguistics, Online. find
Updated
This page in Markdown → https://md.research.elamur.ai/free/en/papers/shehadi-2022-identifying-code-switching-arabizi/