Skip to content
Code-Switching (Arabic/English)
arabic nlp

Code-Switching (Arabic/English)

Code-switching is when a speaker moves between two languages within one conversation or sentence, such as 'ابغى أعمل booking للـ Saturday'. In conversational AI it means the system must recognise, understand and reply to Arabic and English mixed together, not one language at a time.

In the Gulf and Egypt, mixing is the normal register for business talk. Product names, medical terms, job titles, days of the week and technical words are often said in English inside an Arabic sentence; numbers switch too. Written chat adds a third layer, Arabizi, where Arabic is typed in Latin letters. A system built on the assumption that each message is in one language will misroute the sentence: the speech recogniser trained for Arabic mishears 'appointment', the translation step mangles the mix, or the reply comes back in stiff formal Arabic that nobody speaks.

Handling code-switching well has three parts. Speech recognition must be evaluated on mixed audio, not on clean single-language test sets, since the errors cluster exactly at the switch points. The language model must be prompted and tested to keep the customer's mix rather than normalising it, so a Hejazi speaker who says 'الـ delivery' gets an answer that uses the same word. And the reply should keep proper nouns, medication names and product codes in the script the customer used. A voice agent that pronounces English words with an Arabic voice, or the reverse, will sound wrong even when the words are right.

Nano AI tests its WhatsApp and voice agents against golden-set evaluations that include Najdi, Hijazi, Emirati, Egyptian and Arabizi inputs, with mixed Arabic-English sentences deliberately included, before an agent goes live. The simplest vendor test you can run yourself: send five real messages from your own inbox, the messy ones with English words and Latin letters in them, and check whether the answers are correct and whether they sound like your customers.

Chat on WhatsApp