---
title: "Code-Mixing in Social — paper by Das and Gambäck (2013)"
description: "Code-Mixing in Social Media Text studies how to identify English, Bengali, and Hindi word by word in multilingual Facebook posts."
canonical: "https://research.elamur.ai/free/en/papers/das-2013-code-mixing-social-media-text/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/das-2013-code-mixing-social-media-text/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2013](https://md.research.elamur.ai/free/en/papers/2013/) / Code-Mixing in Social Media Text

# Code-Mixing in Social Media Text

Paper · 2013 · Amitava Das and Björn Gambäck

**Authors:** [Amitava Das](https://md.research.elamur.ai/free/en/authors/amitava-das/) and [Björn Gambäck](https://md.research.elamur.ai/free/en/authors/bjorn-gamback/) · **Year:** 2013 · **Venue:** BIBSYS Brage (BIBSYS (Norway)) · **Licence:** [CC BY-NC-SA 3.0 (ACL Anthology, before 2016)](https://creativecommons.org/licenses/by-nc-sa/3.0/)

[**53** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2395626303) · [Cited by **15** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/das-2013-code-mixing-social-media-text/cited-by/) · [BIBSYS Brage (BIBSYS (Norway))](https://aclanthology.org/volumes/2013.tal-3/) · [licence](https://creativecommons.org/licenses/by-nc-sa/3.0/)

- [Publisher's page](https://aclanthology.org/2013.tal-3.3/)
- [PDF](https://aclanthology.org/2013.tal-3.3.pdf)
- [OpenAlex](https://openalex.org/W2395626303)

Citations: OpenAlex, 2026-10-14.

## Summary

A Facebook post can begin in Bengali, continue in English, and use the same alphabet throughout. A single word can even take its stem from one language and its ending from another. In these cases, identifying the main language of a post leaves much of the work undone. Amitava Das and Björn Gambäck study how to assign language labels word by word in Facebook posts from Indian university groups. They focus on English paired with Bengali or Hindi, both commonly typed in Roman letters in the material they examine. Their data also include posts that reach beyond the expected pair.

The authors collect and annotate posts on formal and informal topics. The labels distinguish ordinary words from names, acronyms, punctuation and emoticons, and they record some combinations of stems and suffixes from different languages. In both corpora, informal material contains a higher share of non-English words than formal material. Within the non-English portion used to measure switching, the largest category consists of words in sentences where languages mix. A system that assigns a language to each sentence would therefore miss much of the variation the authors set out to measure.

The detector combines evidence from short character sequences, dictionaries, and the words surrounding each token. An English resource covers informal spellings, while the Bengali and Hindi dictionaries are converted to Roman letters so their entries can be compared with the posts. When a spelling has no exact dictionary match, the system can use its distance from known forms. A support vector machine learns how to combine these signals. A final rule changes the predicted language of an isolated word when the words immediately before and after it receive the same language label.

On the held-out test sets, the final system reaches word-level F1 scores of 79.07% for English–Hindi and 76.37% for English–Bengali. The English-dictionary baseline scores 38.0% and 35.5%, respectively, under the assumption that any word absent from that dictionary belongs to the expected local language. The authors also get substantially higher scores when they cross-validate on the training data. They interpret the gap as overfitting and regard the held-out performance as insufficient for practical use. The study shows how spelling, vocabulary, and context can work together on this task while documenting cases that challenge the idea of assigning a language to every word.

## Deep dive: Code-Mixing in Social Media Text

Code-Mixing in Social Media Text studies how to identify English, Bengali, and Hindi word by word in multilingual Facebook posts. · about 38 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### What a language label needs to tell us

A document-level language identifier answers a question about a whole text. It may choose the dominant language or estimate how much of the text belongs to each language. Either answer can be useful while leaving the location of every switch unresolved. A reader can see an English phrase in the middle of a Bengali sentence even if most of the surrounding post is Bengali. A system that supplies a label for each word can preserve that distinction and locate the change. That is the level of detail Das and Gambäck seek.

Even a language decision at the sentence level would leave a problem. The authors use *code-mixing* especially for changes inside a sentence. They use *code-switching* more broadly and particularly for changes across sentences. A change at a sentence boundary can leave each sentence internally uniform. A change within a sentence requires a finer analysis because the words on either side may belong to the same grammatical construction. The paper also discusses switches within a word, such as a stem that takes an ending from another language. Cases of this kind give the task a morphological dimension. [Morphology](https://md.research.elamur.ai/free/en/concepts/morphology/)

The distinction matters when language identification precedes other text processing. If the only language label covers the whole post, a later procedure gets the same instruction for the Bengali and English spans. Word-level labels can make different spans available for different treatment. The paper frames this as a prerequisite for processing mixed text and evaluates the labels themselves. Earlier work discussed by the authors also gives a reason to keep the stages distinct. Using a language identifier before a tagging system can be a plausible design even when the later system shows little improvement. [Natural language processing](https://md.research.elamur.ai/free/en/concepts/natural-language-processing/)

#### Why the shared alphabet matters

The Bengali and Hindi in the posts can appear in Roman letters, typed to approximate the way a word sounds. A reader can recognize a language from those spellings, but a program cannot rely on a visible change of writing system to mark where English ends. The same letters do double duty. The authors also describe abbreviated English, repeated letters, phonetic spelling, and spellings that use digits. An unexpected form may therefore be a familiar word written creatively, a word from another language, or a spelling both languages allow.

The ambiguity persists when the spelling is familiar. An established borrowing can enter ordinary use and appear in a dictionary for the receiving language. Another writer may use that same form as an English insertion. The authors discuss *glass* in the sense of a drinking vessel. They report that transliterated versions are accepted in Indian dictionaries, while annotators sometimes treated occurrences as foreign. Historical origin, dictionary membership, and a reader’s interpretation in context can point in different directions. For a detector trained on human labels, that disagreement affects what counts as the right answer.

Names and acronyms present a separate problem. The name of a university can appear inside a sentence in any of the languages under consideration. Its presence alone gives little reason to infer a switch. An ending attached to the name can supply evidence about the language of its grammatical surroundings. A scheme for assigning word-level labels must decide how to preserve that evidence without counting every occurrence of a familiar name as an incursion from another language. Punctuation and emoticons require related decisions about which items should enter a language count at all. [Linguistic annotation](https://md.research.elamur.ai/free/en/concepts/annotation/)

The word itself can also be an imperfect unit for describing the mixture. The paper’s examples include a form built from the Bengali stem *adda* and an English ending. They also include a name with a Hindi ending. These are different situations from an English word standing between Bengali words. In the first cases the evidence is distributed across parts of the token. In the second, the boundaries fall between tokens. A label set can preserve the mixed composition of a word even though the classification procedure still receives the word as one item. That choice gives token boundaries practical significance in the study. [Tokenization](https://md.research.elamur.ai/free/en/concepts/tokenization/)

#### What earlier studies had established

The paper places the task against a change in how researchers understood switching. Language alternation had once been treated as substandard usage. The linguistic work the authors review treats it as part of ordinary bilingual and multilingual communication. Some studies ask whether a switch marks membership in a group. Others ask whether it meets a lexical or conversational need. These are questions about what speakers and writers do with a switch. A language detector tackles the narrower question of where different languages appear.

Studies of text messages, chat, Facebook comments, and email gave the authors reasons to consider the social setting of a post. Several accounts they review emphasize affiliation and solidarity. Studies of Chinese–English mixing in Hong Kong and Macao put greater weight on linguistic motivations. The paper also describes disagreement about where switches tend to occur. Some earlier studies found that switches across sentences were the most common type in their data. The comparison makes the kind of text being sampled important. A university discussion group, a private message, and a blog need not offer the same opportunities for a switch.

Automatic work on speech had already raised questions close to the ones the paper asks about writing. Solorio and Liu studied where Spanish–English speakers might switch within an utterance. Predicting a switch point concerns the location of a change in the sequence. Identifying the languages of words supplies additional information about what is on either side of it. The paper notes that earlier speech studies often worked with artificially generated examples and simplified the number of switches in an utterance. It also identifies naturally occurring Spanish–English material as an exception in that line of work. [Learning to Predict Code-Switching Points](https://md.research.elamur.ai/free/en/papers/solorio-2008-learning-predict-code-switching-points/)

A related line of work addressed grammatical labels for words in mixed speech. Solorio and Liu used a language identifier in part of their tagging study. As Das and Gambäck describe it, adding this preliminary identification did not produce a significant improvement in tagging accuracy. That outcome distinguishes the value of an intermediate label as a research object from its value to a particular system that consumes it. The present study makes word language the object of evaluation. [Part-of-speech tagging](https://md.research.elamur.ai/free/en/topics/part-of-speech-tagging/) · [Solorio and Liu’s study of English–Spanish tagging](https://md.research.elamur.ai/free/en/papers/solorio-2008-part-speech-tagging-english-spanish/)

The authors describe much previous work on text as document classification. Some of it used word-level evidence to estimate which languages were present or their proportions in a document. Evaluation at the document level gives credit for answering those aggregate questions. Even a good estimate of the composition of a post allows the individual labels to be misplaced. That difference in evaluation explains why a document classifier can address multilingual material while leaving the boundary problem open. The paper discusses document-level work by Lui and colleagues in this context. [Lui and colleagues’ study of multilingual documents](https://md.research.elamur.ai/free/en/papers/lui-2014-automatic-detection-language-identification-multilingual/)

There were closer examples in short written texts. Nguyen and Doğruöz studied words in Turkish–Dutch forum posts and compared dictionary evidence with statistical approaches, including one that considered adjacent labels as a sequence. Lignos and Marcus used a ratio of word probabilities for Spanish–English Twitter material that was predominantly monolingual. Carter studied the dominant language of tweets. Voss and colleagues examined tweets involving Romanized Moroccan Arabic, English, and French. Their setting was especially relevant to the problem of distinguishing languages that can appear in the same script, even though the language combination and the way the material was assembled differ from the Facebook study. [Finding Romanized Arabic Dialect in Code-Mixed Tweets](https://md.research.elamur.ai/free/en/papers/voss-2014-finding-romanized-arabic-dialect-code/)

This history locates the paper’s problem within multilingual text processing. Its central question is how to identify words in naturally occurring messages when changes of language are frequent enough to matter inside a post, the spelling often departs from reference forms, and an expected language pair can admit a third language. Existing character profiles, dictionaries, and classification methods supplied starting points. The authors had to determine how to combine them at the scale of a word and define what the resulting labels should mean. [Multilingual & cross-lingual NLP](https://md.research.elamur.ai/free/en/topics/multilingual-nlp/)

### The method, step by step

#### Collect posts and decide what each label means

The authors chose Bengali and Hindi because of their large populations of first-language speakers in India, and English because it is commonly involved in the mixing they wanted to study. For English–Bengali they used campus Facebook groups associated with Jadavpur University. The English–Hindi material came from groups associated with the Indian Institute of Technology Bombay. Both collections included groups devoted to comparatively formal or technical subjects and groups with more informal purposes. The contrast let the authors describe the distribution of switching as well as build a detector.

The data include posts from confession and other socially oriented groups alongside material from placement and technical discussion. Here *formal* refers to the topic or purpose of a group. A placement discussion can still contain abbreviated spellings, personal remarks, and changes of language. The group designation places the text in a category for analysis. It leaves the language of any particular contribution to be established from its words.

Five annotators worked with the material in GATE. Three were native Bengali speakers with knowledge of Hindi, and the other two were native Hindi speakers who did not know Bengali. The Bengali speakers annotated the English–Bengali collection. All five annotated the English–Hindi collection. Four annotators were students and the other was a software professional. The authors describe the instructions as generally straightforward and identify borrowings and certain mixed endings as places where judgments could diverge.

The basic language labels were `en`, `bn`, and `hi` for English, Bengali, and Hindi. Composite labels recorded a word from one language carrying an ending from another. For example, `bn+en_suffix` represents a Bengali base with an English suffix. The sign `+` separates the description of the base from the description of its ending. It records the linguistic composition of a token instead of a switch from one token to its neighbor. The paper gives examples with both Bengali and Hindi stems carrying English endings, as well as categories for the opposite direction.

The scheme also provided separate categories for names and acronyms. Their ordinary forms were treated as independent of language in the mixing calculation. Separate labels could record the language of an attached suffix, so a campus acronym with a Bengali ending could contribute Bengali evidence even though the bare acronym was neutral. This lets the analysis distinguish the identity of an institution from the grammar around its name. Named entities in this setting are names of particular people, places, or institutions. [Named entity recognition](https://md.research.elamur.ai/free/en/concepts/named-entity-recognition/)

Two additional labels covered tokens for which assigning one of the languages would be unhelpful. The `univ` label included punctuation, certain symbols, and emoticons. The `undef` label covered items the annotators could not readily categorize. Later in the method, the dictionary stage also uses `undef` for a token it cannot identify. That procedural use is temporary. A dictionary miss can be an ordinary word with an unusual spelling, and the remaining stages can still assign it a language.

Each corpus was divided into training, development, and test partitions. The training portion supplied examples for learning and for the internal comparisons of feature settings. The development portion supplied errors the authors could inspect while designing the final correction. The test portion was held out for the main evaluation. The distinction matters because a rule discovered by looking at one collection of errors needs to be checked against different data.

#### Count where switching occurs

For the descriptive analysis the authors take English as the base language. They count words identified as Bengali or Hindi as evidence of mixing. This convention makes it possible to summarize several kinds of switching with one denominator. It treats the amount of non-English material in a collection as an operational measure, regardless of whether a reader would identify English as the grammatical base of each individual message.

The first calculation divides the non-English word count by the entire corpus word count. In fraction form it is

```
Nnon-English / Ncorpus
```

`Nnon-English` denotes the count of words treated as non-English in the corpus being described. `Ncorpus` is the corpus word count. The slash means division. The paper reports the resulting fraction as a percentage. This is the measure the authors call *total* in the topic comparison. It weights a longer stretch of non-English text by the number of words it contains.

The other calculations distribute that non-English portion across kinds of switches. A sentence whose language is fully tagged as Bengali or Hindi contributes its words to the across-sentence category. Mixed sentences supply evidence for switching within sentences. Word-internal mixing is identified through the composite suffix tags. The paper does not count tag switching as its own category in this calculation. A tag can be hard to identify from surface language labels alone, and the authors also consider it possible to treat tag insertion as a form of within-sentence switching.

The proportion assigned to switching within words is

```
m𝑤 / n
```

`m𝑤` is the word count assigned to word-internal switching. The subscript `𝑤` associates that count with the within-word category. `n` is the total non-English word count in the particular language-and-topic corpus. The slash expresses that category’s share of the non-English words.

The corresponding proportion for switching inside sentences is

```
mₛ / n
```

`mₛ` is the word count the authors assign to within-sentence switching. The subscript `ₛ` identifies the sentence category, and `n` again denotes the non-English word count. The denominator is the same as in the word-internal calculation.

The share attributed to switching across sentences can be written as the remainder

```
(n − m𝑤 − mₛ) / n
```

`n` is the non-English word count. `m𝑤` and `mₛ` are the counts already assigned to within-word and within-sentence switching. The minus signs subtract those counts, the parentheses group what remains, and the slash divides that remainder by `n`. All three fractions are word based. They measure how much tagged material belongs to a category. A count of the occasions on which someone changes language would answer a different question.

#### Build character profiles and remove weak clues

The first source of evidence is the appearance of the word itself. A character n-gram is a sequence of adjacent written characters of a specified length. A word can contain several such sequences, each retaining a small amount of local spelling information. A spelling that has no exact match in a dictionary can still contain sequences familiar from the training data. This gives the detector a way to use evidence below the level of a whole word. [N-gram](https://md.research.elamur.ai/free/en/concepts/n-gram/)

The paper explains this choice through TextCat. That approach counts sequences in reference material for a language and ranks them by frequency. It also constructs a ranked profile of the text to classify. Comparing the positions of shared sequences provides a measure of how far apart the profiles are. A sequence absent from a reference profile incurs a maximum penalty in the illustrated comparison. Adding these penalties and rank discrepancies gives an overall distance for a candidate language. The character profiles in the Facebook study build on this general way of representing spelling evidence. The full classifier uses character weights as inputs alongside the other features.

A frequent sequence need not be informative. The authors give `TO` as a sequence that occurs often in English and in the Romanized forms of Bengali and Hindi. A profile that retains such a sequence simply because it is frequent can spend space representing a similarity between languages. The authors prune the profiles by comparing relative frequencies. The weight for a particular sequence in a given language is

```
φₐᵢ = fᵢᵃ / mₐ
```

`φₐᵢ` is the relative frequency of the sequence indexed by `i` in the language indexed by `a`. The paper names that sequence `γᵢ` and the language `lₐ`. `fᵢᵃ` is the occurrence count of `γᵢ` in `lₐ`, and `mₐ` is the total number of n-gram occurrences in that language’s material. The superscript `a` on the count marks the language. The equals sign defines the weight as a division of counts.

The comparison between languages is then

```
|φₐᵢ − φᵦᵢ| ≤ θ
```

`φₐᵢ` and `φᵦᵢ` are the weights of the same sequence `i` in languages `lₐ` and `lᵦ`, respectively. The minus sign takes the difference, and the vertical bars take its absolute value so the order of the languages does not affect the comparison. `θ` is the chosen discrimination threshold. The symbol `≤` includes values equal to the threshold. If the condition holds, the difference is considered too small and the sequence is discarded in that comparison.

The text is converted to lower-case, and the Hindi and Bengali forms used in the representation are Romanized. The authors keep whitespace between words when creating n-grams and remove extra whitespace. Retaining a word boundary allows a sequence at the edge of a word to carry information about where its characters occur. Lowercasing reduces duplication between upper-case and lower-case versions. These decisions make the inventory of character sequences more manageable and determine which spelling distinctions reach the detector.

The authors tried sequence lengths from the set `1, 2, 3, 4, 5, 6, 7` on the training portion. In 10-fold cross-validation, they selected 3-grams and 4-grams. In this evaluation procedure, different portions of the training material serve in turn as internal validation data while the other portions are used to fit the classifier. The pruning threshold stayed fixed. The paper writes `θ = 0.2` and also describes its rationale as requiring a presence ratio `> 2%`. The relation between those expressions is left unspecified. The underlying rule is to keep sequences with enough difference in relative frequency to help distinguish languages.

#### Prepare dictionaries that can match informal spelling

Whole-word lookup supplies evidence that a short piece of spelling cannot. A dictionary match connects an entire form with a language. For the English dictionary, the authors use a lexical normalization resource built for Twitter. Such a resource covers informal forms and their relation to conventional spellings. The paper gives `gr8` as an example of the kind of form a conventional edited dictionary might miss.

The authors had no equivalent normalization resource available for Bengali and Hindi. They used the Bengali entries of the Samsad dictionary and used Hindi WordNet as the Hindi source. These resources had to be rendered in Roman letters to match the way the Bengali and Hindi material had been typed. The transliteration method they cite is the Modified Joint Source Channel approach. For the detector, its role is to put the reference entries in a script where a comparison to the input spelling is possible.

Romanization alone leaves plenty of room for variation. The same intended word may be written in several ways. To obtain a clue when there is no exact entry, the authors use minimum edit distance. This measure asks how much a string has to change to reach a candidate spelling. A closer entry supplies stronger evidence of resemblance. The paper describes an experimentally selected threshold of `±3` for approximate matching. In the classifier description, exact dictionary membership and the distance available for an out-of-vocabulary word are separate features.

The authors retain full dictionaries so that less frequent words can still supply evidence. In a longer text, several frequent words may suffice to establish the language. At word level, a list restricted to common words removes the direct evidence for every excluded form. Keeping a larger lexicon, however, leaves entries whose Roman spellings coincide across languages. The authors therefore remove words shared across all the languages, along with shared forms in the language pairs they examine. The paper gives *gun* as a form that occurs with different meanings in all the dictionaries and *din* as an English–Hindi overlap.

The Hindi–Bengali overlap was not analyzed as a separate dictionary pair because the authors describe it as extensive. In the comparisons they do make, removing a shared form means its spelling cannot decide the language by direct lookup. Other evidence can still reach the classifier. A word with no dictionary match receives a provisional `undef` label and can be examined through character sequences, approximate spelling, and context. This treatment lets a dictionary stage pass uncertainty on to the next stage.

#### Combine the evidence for each word

From annotated Facebook posts to word language labels The steps in order.

The authors combine the features in a support vector machine, or SVM. Here the classifier learns from labeled examples to make decisions from numeric descriptions of words. The implementation uses Weka `3.6.10`, with a linear kernel and the default settings. A linear kernel lets the classifier use a weighted combination of the supplied features. Weka trains it with Sequential Minimal Optimization, the optimization procedure identified in the paper. The authors encode training instances in Weka’s Attribute-Relation File Format. [Machine learning](https://md.research.elamur.ai/free/en/concepts/machine-learning/)

The character component gives every retained n-gram a place in the feature vector. For a word being classified, the feature is zero when that n-gram is absent. When it is present, the contribution uses its precomputed weight and its count in the word. The paper’s illustration uses `IN` in *painting*, where that sequence occurs twice. In a compact representation of the feature calculation, the contribution is

```
xᵢ(w) = φᵢw × k
```

`xᵢ(w)` denotes the numeric entry for the n-gram indexed by `i` in the representation of word `w`. `φᵢw` is the precomputed weight used for that entry in the paper’s feature example, and `k` is the count of the n-gram in `w`. The multiplication sign means that repeated occurrences increase the contribution according to the same weight. An absent n-gram receives the value `0`.

This character representation is a bag of n-grams. It preserves the order of characters within each sequence and counts the occurrences of a sequence wherever it appears in the word. The feature vector has no separate entry specifying the location of each occurrence. Its purpose is to give the classifier a manageable spelling description with more detail than an exact lookup match.

Exact membership in the English, Bengali, and Hindi dictionaries supplies a separate binary feature for each dictionary. Membership is encoded as `1` and absence as `0`. If the form is absent from all dictionaries, the system calculates its minimum edit distance to entries for each language and uses the lowest distance as a feature value. The authors report using radix sorting, binary search, and hash maps to make the search less costly. These implementation choices concern finding candidates and distances. The information being supplied is how close the unknown spelling is to a reference form.

The context features come from a `7`-word window centered on the word under consideration, with up to `±3` words around it. The authors describe features for the surface forms of the previous and following words and for the language tags of the preceding words. They use a precompiled inventory from the corpora to represent the surface forms by word IDs, since Weka’s classifier receives numeric input. The surface forms can help a word receive a label consistent with the phrase it is in. The preceding tags can give a more direct clue about an ongoing stretch of language.

Context is valuable precisely when local spelling evidence is weak. Consider an ambiguous dictionary form removed from the language lists. A nearby unambiguous form or a label already assigned to a preceding word can still help. The same dependence on neighbors creates a failure mode when the ambiguous word is a real insertion. The fitted classifier uses context as one source of evidence. The authors then add a separate rule that makes a stronger assumption about immediate neighbors.

#### Revisit a label that interrupts a run

The authors designed post-processing after inspecting errors in the development data. Their motivating pattern is a word predicted to be in a different language from both of its immediate neighbors, which themselves share a language. Some of these interruptions are erroneous predictions in a passage where a language continues. The correction assigns the middle word the neighbors’ label.

```
L(wₙ) = L(wₙ₊₂) = lₐ and L(wₙ₊₁) ≠ lₐ  ⇒  set L(wₙ₊₁) to lₐ
```

`L` denotes the system’s assigned language label for a word. `wₙ`, `wₙ₊₁`, and `wₙ₊₂` denote successive words, starting at position `n`. The plus signs move the index forward by the indicated number of positions. `lₐ` is the language shared by the outer words. The equals signs express their agreement, `≠` marks the middle word’s different label, and the arrow introduces the reassignment.

The correction works on labels produced by the classifier. It leaves the spelling features and dictionary decisions behind those labels intact. The paper treats it as an empirical way to repair false interruptions and acknowledges that language can genuinely change for a single word. The rule therefore has a clear tradeoff. It can remove a false boundary in a continuing phrase and can also erase a genuine insertion with the same pattern of neighboring labels.

### Experiments and results

#### The Facebook data and the reference labels

The English–Bengali collection contains 24,216 sentences and 193,367 words, with 100,227 unique tokens. The English–Hindi collection contains 8,901 sentences and 67,402 words, with 40,240 unique tokens. These are corpus totals. The number of distinct forms describes the vocabulary observed across the material, while the word count includes repeated occurrences. Both matter for a detector whose character and dictionary features must handle variation in spelling.

The Bengali collection’s confession and matrimonial groups account for 5,040 and 4,656 messages, respectively, and the placement material accounts for 500 messages. The Hindi collection’s confession and compliments groups supply 1,676 and 1,717 messages, with 631 messages from the technical group. Message and sentence totals refer to different units. A message can contain several sentences, one reason a single label for the message gives less detail than the annotated word sequence.

The partition proportions are 60% for training, 20% for development, and 20% for testing in each language pair. The authors report inter-annotator agreement above 98% for English–Bengali and above 96% for English–Hindi, averaged across the tags as described in the paper. They also report kappa values of 0.86 and 0.82, respectively. Kappa adjusts the agreement measure for the amount of agreement expected by chance under its calculation. These are measurements of agreement among annotators. The detector’s scores measure how well its outputs correspond to the resulting reference labels.

The similarity of annotators’ judgments overall supports the use of the labels for evaluation. The borrowing and suffix examples still matter because an aggregate agreement statistic can be high while particular distinctions remain hard to make. For example, frequent clear cases can contribute a great deal to overall agreement, while an uncommon category of composite forms carries a different kind of uncertainty. The results give a general agreement figure, and the discussion supplies examples of where it can break down.

#### How much mixing appears in each topic category

The topic analysis uses the word-level total defined in the method. For English–Hindi, non-English words make up 32.37% of the informal material and 8.25% of the formal material. For English–Bengali, the corresponding word shares are 58.82% and 12.58%. The comparison runs in the same direction in both collections. The informal groups contain more non-English material according to the study’s English-base convention.

The percentages for the type of switch use the non-English words as their denominator. For English–Hindi, the within-sentence share is 54.95% on informal topics and 53.42% on formal topics. The across-sentence share is 36.85% and 39.88%, respectively. Word-internal mixing accounts for 8.2% on informal topics and 6.7% on formal topics. These figures describe how the non-English portion is distributed after the overall amount of non-English text has been established.

The English–Bengali breakdown also puts within-sentence mixing first. It accounts for 60.21% of the non-English words on informal topics and 60.61% on formal topics. Across-sentence switching accounts for 32.09% and 34.19%, respectively. The word-internal shares are 7.7% in the informal material and 5.2% in the formal material. A category can account for a similar share of the non-English portion in two groups whose overall non-English word shares differ considerably.

The authors also report that Hindi accounts for 3–4% of words in the Jadavpur University confession material, which they generally characterize as English–Bengali. They illustrate the point with a contribution that uses Hindi and Bengali before an English closing phrase. The example and the corpus figure put a practical limit on what a pair name tells us. The name describes the main languages around which the collection was organized. It cannot rule out other languages from a particular message or group.

#### The baseline and the measures

The baseline uses an English dictionary and assumes that the corpus supplies the other language in advance. A word found in the dictionary is labeled English. A word left unidentified is assigned Hindi for the English–Hindi collection or Bengali for the English–Bengali collection. This is a useful comparison because it shows what happens when language evidence consists of an English word list plus a corpus-level assumption about everything it misses. It is simpler than the later dictionary module, which consults separate resources and filters overlapping entries.

The authors report baseline word-level F1 of 38.0% for English–Hindi and 35.5% for English–Bengali. Missing a dictionary entry is weak evidence of a particular language in this setting. An English abbreviation, an unfamiliar name, and a misspelled Bengali word can all fail the same lookup. The baseline acts on that shared outcome with a single default. It consequently has no way to distinguish among those possibilities when there is no English match.

The paper also reports trying existing language identifiers and finding that they generally failed to separate the relevant language spans in these collections. It supplies no comparable set of word-level scores for those systems. Their role in the experiment is to motivate a detector that operates at the desired granularity. The numerical comparisons below concern the dictionary baseline and the successive configurations the authors evaluate on their own data.

Precision describes how many of the relevant labels the system predicts are correct. Recall describes how many of the relevant reference labels it recovers. F1 combines precision and recall, so a large value on one component alone gives an incomplete picture. These measures concern the reported word-level decisions. Earlier studies discussed in the paper sometimes evaluate whether a whole post was labeled correctly or use accuracy over a very different distribution of languages. Both the evaluation unit and the composition of the data need to match before scores can be treated as a direct comparison. [Evaluation & benchmarks](https://md.research.elamur.ai/free/en/topics/evaluation-benchmarks/)

#### Held-out performance for English–Hindi and English–Bengali

The authors first evaluate the pruned character profiles and a version that adds dictionary information. They separately establish an SVM configuration with word-context features. The next SVM row adds weighted character features, and the final basic row adds exact dictionary evidence and minimum edit distance. The post-processed result applies the local correction to that full basic configuration. The charts report the paper’s word-level F1 values and keep the two test collections separate.

Word-level F1 on the held-out English–Hindi Facebook test set The full classifier improves on the simpler feature sets and gains further from post-processing.

**The numbers**

| System or setting | F1 % |
| --- | --- |
| English-dictionary baseline | 38.0 |
| Pruned character n-grams | 57.21 |
| Pruned character n-grams with dictionary | 63.02 |
| SVM with word context | 59.57 |
| SVM with context and weighted n-grams | 70.35 |
| SVM with context, weighted n-grams, dictionary, and edit distance | 76.03 |
| Full SVM with post-processing (this paper) | 79.07 |

For English–Hindi the pruned character system has test precision of 70.12% and recall of 48.32%. The row adding dictionary evidence reports 82.37% precision and 51.03% recall. In this comparison, the stronger movement in precision suggests that the dictionary is particularly helpful for making assigned labels more reliable. The rise in recall is smaller, so many reference items are still missed.

The full English–Hindi SVM before correction has 90.84% test precision and 65.37% recall. With the correction it reaches 94.37% precision and 68.04% recall. Both metrics move in the same direction on this test set. Precision is higher than recall in both configurations. In the aggregate reported here, many of the predictions counted toward precision are correct, while the system still misses a substantial share of what the reference counts towards recall.

Word-level F1 on the held-out English–Bengali Facebook test set Combining context, spelling, and dictionary evidence gives the strongest basic result, with an additional gain from post-processing.

**The numbers**

| System or setting | F1 % |
| --- | --- |
| English-dictionary baseline | 35.5 |
| Pruned character n-grams | 55.37 |
| Pruned character n-grams with dictionary | 62.45 |
| SVM with word context | 58.74 |
| SVM with context and weighted n-grams | 68.11 |
| SVM with context, weighted n-grams, dictionary, and edit distance | 74.35 |
| Full SVM with post-processing (this paper) | 76.37 |

For English–Bengali, the pruned character system has 69.51% test precision and 46.01% recall. When the dictionary is added, precision is 77.69% and recall is 52.21%. Thus the additional evidence helps both measures in this collection as well. At this stage, the English–Bengali dictionary configuration has higher recall than the corresponding English–Hindi configuration, in spite of its lower F1.

The full English–Bengali SVM reports 87.14% test precision and 60.22% recall before post-processing. With post-processing, precision is 91.92% and recall is 65.32%. The combined improvement has the same direction as in English–Hindi. The results support the authors’ decision to use the development errors to design a final correction and then evaluate it on held-out words. The table gives the net effect of the changes in labels across the test partition. It does not separate correct repairs from genuine switches that the rule may have removed.

English–Hindi has the higher F1 in the corresponding configurations in the two charts. The study proposes that the lower amount or complexity of mixing in the Hindi collection might help explain this. Language pair, collection source, topic distribution, and lexical resources vary together. The result establishes a difference between these test collections. Determining why would require breaking those factors apart.

#### The difference between validation settings

When the authors use 10-fold cross-validation within the training portions, the SVM reaches F1 of around 98% for English–Hindi and 96% for English–Bengali. These are the paper’s approximate word-level scores for internal training-set cross-validation. The main tables use the held-out test partitions, where scores are substantially lower. The internal procedure is useful for trying feature settings, but it gives a much more favorable estimate than the external partition in this experiment.

The authors describe the gap as evidence of overfitting. In this setting the term means that the classifier benefits from regularities found in the material used for fitting and internal comparison that are less helpful on the held-out data. Word identity, language-specific spellings, and local context can all capture useful generalizations. The same features can also depend heavily on what is common in a particular sample. The paper points to regularization and further feature selection as possible responses. Regularization would constrain what the classifier learns from the available features. Further selection would alter which evidence can influence the decision in the first place.

The paper also reports a separate trial on the Turkish–Dutch data made available by Nguyen and Doğruöz. It describes an accuracy increase of 0.99% relative to their reported result. That comparison uses accuracy on another collection. It does not belong on the same chart as the Facebook F1 measurements. The discussion gives the result as an indication that the approach could be tried on other data, alongside reasons that the composition and evaluation of the two studies make direct comparisons difficult.

### What the ablations show

#### What changes when a source of evidence is added

The paper offers a series of component comparisons. Some add a single source of evidence, and some change several things together. In the character-based comparison, dictionary information is the addition to the pruned profiles. Both test sets improve in precision and recall. This is consistent with whole-word matches supplying information beyond the frequency of short character strings. The result concerns adding a dictionary to that system. The same contribution can take a different form once a trained classifier is combining exact matches with context.

The SVM sequence begins with local word context. It scores better in F1 than pruned n-grams alone on each test collection. The dictionary-enhanced character system then exceeds this context-only configuration. The sequence of results gives a role to both context and spelling. Nearby words offer useful evidence even by themselves, and a form can carry language information that its immediate surroundings leave unresolved.

The next SVM configuration adds weighted character sequences to the context features. F1 rises in both test collections. English–Hindi test precision moves from 72.01% for the context row to 89.36% with the weighted sequences, while recall goes from 50.80% to 58.01%. English–Bengali precision moves from 74.33% to 86.83%, and recall from 48.55% to 56.03%. This is the clearest table comparison of context with and without internal spelling features in the SVM. It tests their contribution together with their weights.

The final basic configuration adds exact dictionary membership and minimum edit distance together. English–Hindi recall rises from 58.01% with the context and weighted-character configuration to 65.37%, and English–Bengali recall rises from 56.03% to 60.22%. Precision also rises in both. The result supports the addition as a package. It leaves the individual contributions of exact lookup and approximate lookup unresolved in that SVM comparison. A token with a clear dictionary hit and an unfamiliar token near a dictionary spelling benefit through different paths.

The paper separately states that weighted character features perform `3–4%` better than binary features that record mere presence. This is a comparison of how to represent an available character clue. A binary feature treats every retained sequence occurrence as evidence of the same magnitude. Weighting lets the contribution reflect the precomputed weight and its frequency within the word. The paper gives the size of the gain without a separate breakdown by language pair, test partition, and metric for that comparison. The much fuller SVM table tests adding weighted character features to context, which is a different intervention.

#### What pruning and the correction establish

The paper reports that pruning improves convergence time by a factor of `5` and gives a marginal performance improvement described as `0.5`. It does not identify a unit or a separate test score row for the latter figure. The efficiency observation is consistent with a smaller input inventory after ambiguous strings have been removed. The feature choice rests on discrimination between languages rather than on frequency alone. A common sequence can be frequent enough to occupy space in several language profiles and still contribute little to the comparison.

There are two decisions within this part of the method. The authors compare several n-gram lengths in cross-validation, leading to their choice of lengths, and they apply a fixed discrimination threshold. The comparison of lengths provides evidence about the setting used for the character representation. The paper says it did not vary the threshold. Consequently the reported pruning outcome gives no evidence about which nearby threshold would work best, or whether the same rule would discard the right forms in a different language pair.

The cleanest comparison at the end of the pipeline is the full basic system with and without the correction. Both use the same spelling, dictionary, and context features. The added step revisits positions where the immediate neighbors agree and the middle word has a different label. Its improvement on both held-out collections supports the authors’ observation that some errors break a continuing span. The aggregate result also puts a limit on the interpretation. The rule helps on balance in these collections, and the experiment says little about which grammatical constructions are most vulnerable to an incorrect change.

In particular, the rule is compatible with two different explanations for the same pattern of predictions. The classifier might have mislabeled an ordinary word in a continuous phrase, or it might have correctly identified an isolated English insertion in Bengali or Hindi. The authors explicitly acknowledge the weakness of making the correction a linguistic assumption. No error counts by subtype accompany the post-processing scores. The result gives evidence about the tradeoff as it plays out on these test data, while the linguistic status of a given switch still depends on its context.

#### What the error analysis adds

The authors point to forms such as *addaing* and *jugading* to illustrate the difficulty of assigning labels when word formation combines languages. The suffix annotation is important because it gives such cases a place in the data. Neither exact dictionary membership nor resemblance to a familiar word directly settles how the composite form should be labeled. Character evidence can reflect the ending, while the surroundings can reflect the language in which the stem is being used. The paper discusses the examples as cases of mixed word formation and does not report a score for that group alone.

The discussion also examines reduplication, where all or part of a form is repeated. The paper gives Bengali *majhe majhe* and a playful pairing, *affair taffair*. In the latter, a recognizable English form appears next to a creative echo. Treating each surface form as an independent dictionary query makes the echo particularly hard to interpret. The relationship between the adjacent items carries information that neither spelling provides in isolation. The context window gives the classifier access to adjacent forms, but the paper does not test explicit recognition of the reduplication pattern.

The authors mention other language-boundary errors that would require language-specific knowledge about spelling. They also consider whether the sequence of labels assigned to words can be treated as a separate learning problem. In the paper’s account of Barman and colleagues, a conditional random field, which learns relationships between labels in a sequence, produced a slight increase in accuracy with mixed effects on precision and recall. Precision fell and recall rose for majority tags, with the opposite tendencies for minority tags. This is evidence from a related investigation cited in the discussion. The Facebook system’s own component comparisons test its context features and its local correction, instead of a full comparison with sequence learning.

### Limitations

#### Limits the authors state

The authors restrict their main experiments to Facebook posts organized around English–Hindi and English–Bengali. They regard the detector’s performance, which they characterize as F1 in the region of `75–80%`, as insufficient for use in a real-world setting. Their conclusion treats the annotated corpora and the formulation of the word-level task as substantive contributions alongside the detector. The performance is a measurement of an initial system under a particular evaluation, not a demonstration that the full processing problem has been solved.

They also say that they did not evaluate detector performance separately on formal and informal data. The descriptive analysis shows how much non-English material appears in the topic groups and where it occurs. The classifier results are reported for the held-out language-pair sets. Accordingly, the conjecture that greater mixing helps explain the lower English–Bengali F1 remains untested by a within-pair topic comparison. Even if the formal portion were easier, the reported test results would say only how the system performed on the combination present in the partition.

The cross-validation gap is another limit the authors acknowledge explicitly. An internal score from the training data can be considerably above the held-out score even when the internal procedure rotates which data are used for evaluation. The study tries pruning as one way of removing unhelpful features, but it does not show that pruning resolves overfitting. The suggestions about regularization, further selection, and combining different learners are avenues the authors identify for investigation.

The paper also cautions against taking other reported scores as a ranking of solutions to the same task. Some speech studies use artificial material, some text studies evaluate at the document or post level, and some word-level collections contain predominantly monolingual texts. Methods can depend on resources specific to a language or a platform. An English–Bengali system with Romanized dictionaries and a Twitter system using platform-specific priors have access to different evidence. The authors suggest that a method depending on word probabilities may be easier to compare across languages, but leave the broader comparison open.

Platform differences are likewise framed as a research question. The authors propose comparing Facebook material with tweets, whose limit they describe as `140` characters. Shorter posts might change how frequently writers switch and how much neighboring text is available to the detector. A short post could still contain a difficult insertion, and a longer one could supply more context to classify it. The experiments establish the behavior of the detector on their Facebook collections. They leave those effects of length and platform to future work.

The final correction has a limitation even when overall test scores improve. The authors acknowledge that a genuine language switch can produce a middle word with a different label from matching neighbors. The improvement after correction therefore depends on how common erroneous interruptions are relative to correct isolated labels. The rule embodies a regularity of the errors the authors inspected. A different mix of insertions and classifier errors could change how frequently that regularity is useful.

#### Limits visible in the setup

The informal and formal material comes from different Facebook groups. Topic therefore varies along with the communities, purposes, and conventions attached to those groups. The measured differences establish a pattern in the collections. They cannot isolate what would happen if exactly the same people discussed different topics under the same conditions. Likewise, the two language pairs come from different campuses and use different lexical resources. Comparing their scores combines differences in language, data, and supporting evidence.

The English-base convention also determines what the descriptive percentages mean. If a sentence is entirely Bengali, its words can count towards across-sentence switching in the study’s calculation. That is a valid consequence of the study’s definition. It leaves open how a reader might describe the message as a whole, including which language provides its grammatical base and whether a given sentence marks an actual transition from the previous one. The total share of non-English words answers a corpus-composition question. It does not by itself count boundaries or establish the direction of an individual switch.

The granularity of evaluation leaves other questions open. A word-level score can give credit for most words in a span even if the system misplaces its beginning or end. It can also hide whether names with suffixes, ambiguous borrowings, and rare composite forms are handled equally well. The paper gives overall precision, recall, and F1, and illustrates types of hard cases. It does not give a separate boundary-recovery measure or a breakdown of the detector’s performance across all of the annotation categories. A downstream application that needs exact spans or reliable identification of mixed morphology would need evidence for those outcomes.

There are also gaps in the description of how some inputs are constructed. The context section describes a word inventory compiled from all the corpora, leaving the role of the partition boundaries in that inventory unspecified. It describes preceding language tags as features without a full account of how the tags are supplied during fitting and passed along at test time. A detector using its own preceding predictions can carry an error into subsequent decisions. A detector supplied with reference tags has different evidence. The result tables on their own do not resolve those implementation details.

The mismatch between the written threshold and its percentage rationale also matters for replication. The general pruning criterion is explicit, but a reader trying to reproduce the retained feature inventory needs to know the scale on which the threshold is applied. The stated `0.2` and `> 2%` do not come with a conversion or an accompanying sensitivity comparison. The tables nonetheless establish how the authors’ reported systems performed. Recreating the precise inventory would require a more detailed account of the weights and threshold.

Finally, broad agreement among annotators coexists with indeterminacy in some individual labels. The paper’s account of borrowing makes that visible. A form can participate in the receiving language’s ordinary vocabulary while retaining a spelling or history associated with English. A mixed suffix can carry information about the grammatical environment of a proper name without determining the language of the name itself. The annotations make these distinctions usable in the study. The evidence supports conclusions about prediction under those annotation conventions, with room for other conventions to produce different labels in some cases.

### What came after

Later work that cites the paper spans a focused language-identification study and surveys with broader scopes. The connection is clearest at the level of the problem. Das and Gambäck show that deciding which language appears in a piece of writing involves choices about the unit being labeled, the treatment of ambiguous forms, and the kinds of evidence available within a short stretch of text. The later titles identify different settings in which those choices arise. The citations establish a connection to the paper, while the scope of each work gives the basis for describing where that connection fits.

The study of Algerian Arabic multilingual documents takes language identification into a different language setting. Its unit of interest, as expressed in the title, is multilingual documents. Das and Gambäck’s Facebook study shows why the word *multilingual* leaves an important design question open. A system might detect which languages are present, estimate their extent, or assign particular words to them. The link between the studies is the problem of sorting out languages that coexist in written material. The title establishes the Algerian Arabic focus, while leaving the study’s use of particular Facebook-system components unspecified. [Identification of Languages in Algerian Arabic Multilingual Documents](https://md.research.elamur.ai/free/en/papers/adouane-2017-identification-languages-algerian-arabic-multilingual/)

Jauhiainen and colleagues’ survey takes up automatic language identification across texts. In that broader setting, the contribution of the Facebook work is a case where the choice of evaluation unit changes the research question. A post-level decision can be evaluated as a text classification result, while a sequence of word labels can be evaluated on the material the first decision leaves unresolved. The survey’s scope puts code-mixed text in conversation with the wider language-identification problem. The Facebook paper supplies a concrete example involving short posts, a shared alphabet, and several sources of evidence. [Automatic Language Identification in Texts](https://md.research.elamur.ai/free/en/papers/jauhiainen-2019-automatic-language-identification-texts/)

The survey titled *Beyond Monolingual Assumptions* addresses code-switched language processing across modalities. The Facebook study belongs to the written-text part of that wider subject. Its particular contribution is to make the consequences of a monolingual assumption observable in the annotation and evaluation. A single post can require multiple word labels, and some words require an account of both the base and the ending. The survey’s title signals a wider scope for the problem, while the Facebook results remain evidence about written posts from the two campus collections. [Beyond Monolingual Assumptions](https://md.research.elamur.ai/free/en/papers/sheth-2026-beyond-monolingual-assumptions-survey-code/)

Across these works, the durable question is what a language-identification result describes. In the Facebook experiments, the answer is a set of word decisions made under explicit conventions for borrowed forms, names, suffixes, and uncertain tokens. In other multilingual documents or other modalities, the units and conventions may differ. Das and Gambäck’s study gives later discussions a concrete case in which those choices can be traced from the annotated material through the detector to the reported results.

## Cite

Cite as Amitava Das and Björn Gambäck. 2013. Code-Mixing in Social Media Text. BIBSYS Brage (BIBSYS (Norway)).

The paper itself, not this page. BibTeX from the library's record of the work.

```bibtex
@inproceedings{das2013code,
  title = {{Code-Mixing in Social Media Text}},
  author = {Amitava Das and Björn Gambäck},
  booktitle = {BIBSYS Brage (BIBSYS (Norway))},
  year = {2013},
  url = {https://aclanthology.org/2013.tal-3.3/}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
