Understanding Linguistic Accommodation in Code-Switched Human-Machine Dialogues (2020)

Abstract: Code-switching is a ubiquitous phenomenon in multilingual communities. Natural language technologies that wish to communicate like humans must therefore adaptively incorporate code-switching techniques when they are deployed in multilingual settings. To this end, we propose a Hindi-English human-machine dialogue system that elicits code-switching conversations in a controlled setting. It uses different code-switching agent strategies to understand how users respond and accommodate to the agent’s language choice. Through this system, we collect and release a new dataset CommonDost, comprising of 439 human-machine multilingual conversations. We adapt pre-defined metrics to discover linguistic accommodation from users to agents. Finally, we compare these dialogues with Spanish-English dialogues collected in a similar setting, and analyze the impact of linguistic and socio-cultural factors on code-switching patterns across the two language pairs.

## introduction when interlocutors share more than one language, they nearly inevitably engage in codeswitching (cs): shifting from one language to another @xcite @xcite . since most people in the world today are multilingual @xcite , cs is a ubiquitous phenomenon in multilingual communities. it goes beyond simple lexical borrowing to blending of languages at syntactic, grammatical and morphological levels @xcite . code-switching has been studied in linguistics and sociolinguistics for decades @xcite @xcite kya tumhare paas koi dost hai who like to eat mangoes? nahi. mere kisi friend ko aam pasand nahi mere paas bhi 3 dost hai who like to eat apple ins alt alt alt figure 1 : we present a bilingual dialogue system for human-machine conversations in hindi-english (red: hindi, blue: english). we discover that humans positively adopt the agent's code-switching style (alt and ins) and the language choice for keywords (highlighted in bold). advances in dialogue research @xcite @xcite have enabled conversational ai technologies for humanmachine interactions, like alexa and siri. although these technologies are pervasive, they still have limited abilities to accommodate to the user, and they do not account for the ubiquity of multilingual communication. due to the lack of code-switching abilities in existing language technologies, there has been limited work in studying linguistic accommodation in written cs dialogues. with the ultimate goal to enable adaptive codeswitching dialogue agents, in this paper we study user accommodation, i.e., entrainment @xcite in cs human-machine dialogues. our exploratory analysis of user accommodation will facilitate better development of dialogue agents which can eventually accommodate to users in return. to this end, we adopt a collaborative dialogue framework of @xcite , which converses with spanish-english (spanglish) bilinguals. to facilitate a more general analysis, we extend this framework to hindi-english (hinglish), a language pair which is typologically distinct from spanglish and is spoken by millions of people. we begin by providing background on codeswitching ( §2) and linguistic accommodation ( §3) we then introduce our generalized bilingual dialogue system ( §4). in §5, we describe our experimental setup for hinglish data collection and discuss the data statistics. we later provide our exploratory analysis of language accommodation and other socio-linguistic factors affecting the cs patterns in the user utterances ( §6). a case-study comparing code-switching distributions across hinglish and spanglish is presented in §7. finally, we discuss directions for future work in §8. this paper's contributions include: (1) the development of a bilingual collaborative dialogue system easily generalizable to a new cs language pair, (2) a new dataset, commondost, comprising of 439 hindi-english human-machine conversations, (3) adaptation of accommodation metrics and a corresponding analysis of accommodation of language style and choice in cs dialogues, and (4) an exploratory study of linguistic and socio-cultural factors on users' cs patterns across spanglish and hinglish. ## code-switching strategies given that cs is used in very nuanced ways, researchers have been studying how people codeswitch, examining the switch-points of languages syntactically @xcite , prosodically @xcite , lexically (kootstra, 2012), pragmatically @xcite , and so forth. many works have attempted to model code-switching text and speech from a statistical perspective @xcite . recent works and benchmarks such as linguistic codeswitching evaluation (lince) @xcite and gluecos @xcite have provided a unified platform to evaluate cs data for various nlp tasks across various language pairs. our work is in line with these recent efforts to pro-vide nlp capabilities to users with diverse linguistic backgrounds. we extend the human-machine cs dialogue system by @xcite to a new language pair of hindi-english. in order to better understand the style and usage of languages in a code-switched utterance, we cluster and characterize these utterances by a set of predefined cs strategies. previous works have mainly identified two commonly used code-switching (cs) strategies: insertional and alternational, and these strategy distinctions are important in implementations of cs technology @xcite . insertional cs strategy involves one language to be the matrix language (matl) with the other serving as the embedded language (embl). words/phrases from embl are inserted in the sentence while maintaining the grammar and structure of matl @xcite . on the other hand, alternational cs strategy involves alternating between separate independent clauses of the languages, switching from one matl to another. in our work, we focus on the hindi-english language pair. we experiment with 4 cs strategies -(1) en cs is also observed more often in informal and casual settings than formal ones @xcite . we test this hypothesis by inducing informality in the agent's strategies. although recent works @xcite have introduced neural methods to induce informality, we deploy a simple way to moderate formality by adding discourse markers (e.g. "so", "well") at the beginning and ending of sentences. these markers are independent of context and syntax @xcite , and are often associated with informality @xcite . thus, we define four more agent strategies by infusing informality (+ informality) in each of the previously described 4 cs strategies. ## measuring accommodation in dialogue communication accommodation theory posits that people adjust their behaviors or speech styles to their conversational partners' @xcite . linguistic accommodation has proven to reduce interpersonal distance @xcite and is correlated with dialogue success and engagement @xcite . although well-studied in the monolingual dialogues @xcite , it is relatively new in the cs setting. @xcite found rate of code-switching to be accommodated in human-human spanish-english dialogues. choice of language when code-switching can also be adapted in dialogues @xcite . @xcite further discover that part-of-speech of a cs utterance may impact the following language choice. our work adds to this field by studying accommodation of language choice for lexical classes. in terms of quantifying accommodation, we adapt a metric from @xcite to measure accommodation (we refer it to as global accommodation). global accommodation extends the score proposed in @xcite by aggregating a speaker's word usage across an entire dialogue and biases it relatively with other non-partners in the corpus. for two partners a and b, we denote e a,@xmath0. denoting the set of non-partners for the speaker a by n a , we define ratio as for all non-partners @xmath1. the global score for the speaker a is the average of ratio over all the non-partners. the final global score for the dataset is the average of the scores over all the speakers in the dataset. in context of human-machine conversations, we choose the set of non-partners for an agent to be the set of humans that did not interact with this agent. since this metric is defined primarily for lexical accommodation, we redefine different styles as a lexical class to adapt it for measuring stylistic accommodation. @xcite presented another interesting metric which measures accommodation locally across turns within a single dialogue. for two partners a and b, we can formulate this metric as ## bilingual dialogue system our bilingual human-machine dialogue system mainly serves two important purposes: (1) collection of cs data and (2) experimentation of new agent strategies. previous work @xcite developed a rulebased cs dialogue system restricted to a fixed set of prompts. @xcite proposed a more flexible bilingual system for english-spanish as an extension of a monolingual goal-oriented collaborative dialogue framework @xcite , originally designed for the mutualfriends task. this task provides the two conversational partners a and b individually with a knowledge base (kb) of friends, out of which there is exactly one friend common in both kbs. each friend in the kb has several attributes such as hobby, location of work, etc. the goal of the task is to collaboratively find this mutual friend by text conversations between the two partners-which can be human or machine. the modifications made by @xcite for extending this monolingual system to support bilingual spanish-english dialogues were mainly in three components: (1) bilingual readability: supporting instructions and kb available to the users in spanish as well as english, (2) bilingual response generation: procuring parallel spanish sentences using a machine translation (mt) system and applying rule-based transformations for generating code-switched spanglish, (3) bilingual response understanding: translating code-switched spanish-english to monolingual english (using a mt system) and passing it to the pre-existing response understanding system for english. ahn et al. (2020)'s modified spanish-english dialogue system cannot be directly applied across other language pairs due to three key reasons: (1) the dialogue system relies on a robust cs mt system 2 which is more readily available for resourcerich languages like spanish and english. such systems might not be accessible for languages like tagalog and swahili. (2) the linguistic rule-based adaptations for generation are simple in the case of spanish-english as they are typologically closer. on the contrary, linguistically diverse pairs like telugu-english might need further adaptations due to differences in word order and morphology. (3) spanish and english are written using the same script. many other language pairs within which cs is pervasive, like hindi-english, are written in different scripts, and are typically romanized in the cs setting. lack of normalization and robust transliteration models pose challenges to multiple system components for such pairs. in our work, we build a more generalized dialogue system to tackle the challenges stated above. one highlight of this modified system is its simplicity, which helps in adapting to new language pairs easily. we briefly discuss these challenges and our enhancements to various components for our hindi-english dialogue system below. language bias in kb due to social and cultural priors, certain domains and topics in the kb might not be equally represented in both languages. in order to avoid biasing the language usage in the dialogue and promote code-switching, it is necessary to carefully choose equilingual domains. in the case of hinglish, we replace the domain of college majors, which is highly anglicized with respect to hindi, with favourite fruit which is more equally represented in both languages. handling gender-markings third person pronouns and verb forms in hindi are usually gendermarked (eg. karta/karti [he/she does], uska/uski [his/her]). since the spanglish kb does not provide any information about the gender of friends, we consequently notice the dialogues using this system to be gender-skewed. in the common-amigos spanglish data @xcite , the ratio of masculine to feminine word usage was 3.9; whereas for hinglish 3 , this gender-ratio is 27.7. we mitigate this by simply adding a new "gender" attribute to the kb and correspondingly, notice a drastic drop of the gender-ratio to 3.4 for hinglish. dialogue generation the spanglish dialogue system utilizes a mt system 4 to generate parallel spanish-english sentences and leverages rulebased transformations (specific to spanish) to gen-3 tested on a set of 65 pilot dialogues. 4 google translate api in the original implementation. furthermore, the rule-based transformations need appropriate modifications to accommodate the new language pair. for hinglish, we synthesize additional transformations to handle differences in word order and verb conjugations. natural language understanding (nlu) the spanglish dialogue system relies on a robust mt system for converting cs user utterances to english and then exploits an english nlu component for entity extraction. procuring such mt systems foot_2 for other language-pairs is not feasible. this issue is amplified for languages written in non-native script (hinglish) due to lack of normalization in user sentences. we overcome this challenge by building a simple dictionary-based nlu component which can directly understand and extract entities from cs hinglish text. although it cannot handle complex inputs, this simple model still outperforms the translation-based nlu pipeline. ## data we use the modified bilingual dialogue framework ( §4) to collect romanized hindi-english cs data for human-machine dialogues. here, we first describe this data collection process and later discuss statistics for the collected data. ## analysis of hinglish conversations we study the impact of each of the agent strategies (4 cs strategies and their informal counterparts) on the user dialogues using various dialogue-and language-oriented dimensions, as shown in ## comparison of spanglish and hinglish to gain better insights into how linguistic and sociocultural factors influence code-switching patterns, we compare the distributions of the users' usage of various cs strategies in hinglish and spanglish in figure 3 . we observe that en ins --→hi and en ins --→sp are the most dominant cs strategies in hinglish and spanglish respectively. on the other hand, we notice a large difference in the usage of alternational cs strategies in the language pairs. for spanglish, it accounts to roughly 40% while it is merely 10% for hinglish. as attributed by the equivalence constraint, cs points tend to occur only if a syntactic rule is not violated in either of the two languages being mixed @xcite . given this requirement, a pair of languages that have differing word order could have more constraints on where switches can occur. we hypothesize that alternational cs may not work within a verb clause in hindi as it is a verbfinal (sov) language while english is verb-medial (svo). spanish is verb-medial like english, and their word order similarity may facilitate the use of alternational cs. beyond structural differences, sociolinguistic factors may affect cs strategies of speakers. backus (1998) describes a gradient of strategy usage across generations of immigrants. earlier gen-erations of immigrants would progress from simple to complex insertions, and later generations would alternate the two languages, eventually using reverse insertion. as the spanglish dataset includes later generations of immigrants to the us, 90% of hinglish speakers are 1st generation. this would highlight hinglish speakers' affinity towards insertion into the hindi matrix language. additionally, the status of english in the us (for spanglish) and english in india (for hinglish) is different. as found in §6.4, the status of english can vary within regions of india itself, and this can lead to varying uses of cs strategy. attitudes towards language use have been shown to affect code choice in bilingual speakers @xcite . it is likely that attitudes towards cs is not the same in the spanglish and hinglish populations, which can provide further variability in the speakers' language choice. ## conclusion and future work in our work, we proposed a generalized bilingual dialogue system and procured human-machine dialogue data (commondost) for the language pair of hindi-english using this system. adaptation of this dialogue system for newer cs languages could promote collection of more bilingual dialogue data. analysis of the commondost conversations revealed how users positively adopt and accommodate the agent's style of using language in a cs utterance. we also studied how informality and cultural factors independently affect the users' cs patterns. this proves that our findings are extendable across two cs pairs of hinglish and spanglish @xcite . similar analysis can be done for new language pairs (such as arabic-english) and datasets from different domains. another area of potential research would be to compare our findings of the cs patterns and accommodation with human-human cs conversations. finally, we discussed how linguistic and sociopolitical factors affect the distribution of users' cs patterns across the language pairs of hinglish and spanglish. despite their dissimilarities, the similarities across these language pairs is encouraging, as it open avenues to learn about how code-switching functions cross-linguistically. we pave the path for future research on comparisons of multiple cs language pairs.