Elamur Research

Urdu Word Segmentation using Conditional Random Fields (CRFs)

Paper · 2018 · Haris Bin Zia, Agha Ali Raza and Awais Athar

Summary

A space in digital Urdu can mark the end of a word, or it can keep letters inside the same word from joining. A word boundary can also go unmarked when the letters already look right without a space. A reader can frequently make sense of both conventions. Software that splits text on spaces can turn a single word into several pieces or treat a run of words as one. The authors investigate how to recover the units needed for tokenization while preserving the breaks that give words their intended written form.

They treat the task as a sequence of decisions about characters. The input is a string with its boundary markers removed. At each character, a conditional random field, or CRF, predicts whether the character begins a word, begins a sub-word, or continues the current unit. A word start calls for a space. A sub-word start calls for a Zero Width Non-Joiner, or ZWNJ, a character that prevents letters from connecting without inserting a visible gap. The system uses nearby characters and properties such as whether the current character can join to its neighbor. A compound or a word formed with an affix can thus remain a single token while retaining an internal break.

The authors prepared an Urdu corpus of 4,325 sentences with both kinds of boundaries marked and released the corpus and code. On the held-out test set of 825 sentences with diacritics removed, the system achieved an F1 score of 0.97 for word boundaries and 0.85 for sub-word boundaries. F1 combines precision, the share of predicted boundaries that are correct, with recall, the share of reference boundaries that are recovered. Sub-word boundaries were harder to recover. With diacritics retained, their F1 score was 0.87, while word-boundary F1 stayed at 0.97.

The feature comparisons help explain that difference. The identity of a character by itself yielded no correct sub-word predictions in the reported comparison. The scores rose as the system gained access to more neighboring characters, and they rose again when the authors added properties of the script. The experiment demonstrates that the two boundary types can be learned from the same annotated text and predicted together. Its scores describe how well the system reproduces the boundary conventions of that corpus.

Deep dive: Urdu Word Segmentation using Conditional Random Fields (CRFs)

How conditional random fields recover Urdu word boundaries and preserve internal breaks in a script where visible spaces can serve either purpose. · about 33 minutes to read

The problem and its context

A visible break can do different jobs

Word segmentation determines where one word ends and the next begins. Many applications of natural language processing expect these decisions to have been made before they receive text. A part-of-speech tagging system, for example, needs units to which it can assign grammatical categories. The paper also names machine translation and information retrieval as settings where unreliable word divisions matter. When the text supplies the wrong units, later processing inherits a decision about the words that the writer may never have intended to make.

The paper uses English and other languages written in Latin script to establish a familiar starting point. In those languages, a space generally supplies a usable cue to the next word, with compounds among the exceptions the authors mention. Digital Urdu regularly places a different demand on the space character. A typist may use it to produce a familiar written shape. Whether that shape belongs to a single word or to neighboring words is a separate question. The computational task begins with this gap between what a mark does on screen and what it means for a sequence of tokens.

Urdu uses an extended Arabic script and is commonly written in the cursive Nastaliq style, as described in the paper’s account of the writing system and its cited work on Urdu letter forms. Letters run from right to left, while numerals run from left to right. Urdu writing ordinarily represents consonants and most long vowels, and short-vowel marks are optional. These conventions affect what evidence a program can expect to find. Letter shape can depend on the neighbors, and some marks that could help identify a word may be absent from ordinary writing. Letter-to-sound conversion for Urdu

The distinction between joiners and non-joiners explains why spaces can be hard to interpret. In the authors’ description, joiners have forms suited to the beginning, middle and end of a connected run, as well as an isolated form. Non-joiners have final and isolated forms. The names refer to what the letters can do in the script. A non-joining point can therefore arise from the letter itself, regardless of whether the word actually ends there. Conversely, a letter capable of joining may have to be prevented from connecting across an internal division.

That gives the same visible separation more than one possible explanation. It can result from an ordinary word boundary, a deliberate interruption within a word, or the behavior of a letter that already ends a joined run. A tool that tries to infer words from the appearance of connected groups faces the same underlying ambiguity as a tool that relies on typed spaces. The correspondence between a connected group of letters and a word is precisely what the writing examples call into question.

When writers leave spaces out

The authors call the first problem space omission. If a word ends in a non-joiner, it can retain its expected shape when the following word is typed immediately after it. The writer has less reason to enter a space for the sake of appearance. A reader can still recognize the words, while a program that uses the space character as its only delimiter gets a longer string than it expects.

The paper illustrates this with a sentence about Asad taking the lead of a caravan. Its words all end in non-joiners. The spaced version provides each of the eight tokens to a whitespace-based procedure. The version without the interword spaces presents one token to the same procedure. The example holds the intended reading constant and changes the explicit boundary marks. It makes clear why omission can be unobtrusive to a reader and consequential for software.

An example involving an Urdu poet makes the same point at a smaller scale. The words can appear adjacent in the text because the relevant letter shapes stay the same with a space or without one. In such a case, the writer’s decision about the space may have little visual consequence. The segmentation system still needs to recover the boundary if it is to supply the intended words to a later stage.

The non-joiner is a cue about the appearance of the transition. To identify a word boundary, the system must also judge the surrounding letters. A place where joining stops could occur at the end of a word or somewhere inside it. This helps explain why the authors ultimately use joining behavior alongside character context. The property tells the system something important about the script, while the sequence gives it evidence about which unit is being written.

When writers add spaces inside words

Space insertion creates the reverse computational error. A word formed from several parts can need an internal break to preserve the expected shape. If a part ends with a joiner, writing the next part directly after it can make the letters connect. A writer can stop that connection with a space. The rendered word then looks as intended, while a whitespace-based program reads the gap as a separation between tokens.

The authors illustrate this with a word glossed as “rich” and give examples from several kinds of word formation. An affix can be kept visually apart from its stem. The parts of a compound can be prevented from merging. Repeated elements in reduplication can be separated in the script even when the whole expression is treated as a unit. A borrowed word written in Urdu letters can also use internal gaps for readability, and a transliterated abbreviation can use them between its letter names. The examples bring together morphology and writing conventions. Some breaks arise between parts involved in forming a word, while others arise in representing material borrowed from another script.

The example of the word for football makes the representation problem concrete. With an ordinary internal space, the two parts have the intended appearance but are available to a space splitter as separate tokens. Writing the letters together with the gap removed preserves a single token but allows joining that the example treats as inappropriate. The ZWNJ provides a way to preserve both the appearance and the single-token interpretation. The paper demonstrates the same distinction with examples of affixation, compounding, reduplication and a transliterated abbreviation.

The ZWNJ is a Unicode character that interrupts joining without supplying a visible space. The authors point out that many Urdu users are unfamiliar with it and that most Urdu keyboards lack a direct key mapping for it. That practical constraint helps explain why a writer might use an ordinary space even when a more precise character exists. The proposal therefore gives the two characters different functions in the output. A space separates words. A ZWNJ records an internal division while keeping the parts in one word token.

The authors use sub-word for this internal boundary. The meaning comes from the annotation conventions and its examples. It concerns places in an Urdu word where an explicit non-joining mark is called for, such as the division between components of a compound. Treating it as a distinct target allows the system to address both omission and insertion in a common representation. An omitted word boundary needs a space, whereas an internal break needs a way to preserve the intended form without causing the same kind of split.

How earlier approaches framed segmentation

The paper’s review describes dictionary matching as one approach to strings with unreliable boundaries. Maximum matching selects a dictionary match by length. The authors discuss a Chinese segmentation procedure of this kind and observe that a preference for longer matches can pass over a shorter valid word. It also leaves out the context that could help decide between competing interpretations. Other rule-based procedures discussed in the review generate possible divisions and choose among them using heuristics. Those procedures move the choice from a single match to a comparison among segmentations, with the quality of the choice depending on the heuristic.

The review also discusses statistical segmentation using n-grams, which are sequences of neighboring units. The authors describe them as effective in earlier work, with results dependent on the quality of the training text. Increasing the span of an n-gram can help represent evidence farther away, at a computational cost. The paper also mentions feature-based work on Thai that used surrounding information to identify boundaries of unknown words. Taken together, these approaches give the authors a reason to consider both the identity of adjacent characters and broader properties that may be shared across different strings.

An earlier Chinese CRF segmenter used comparatively simple features such as individual characters and character pairs. The paper identifies the work on informal Arabic as an especially close precedent. It also used a CRF and added linguistic features for boundary identification. The Urdu study retains that general strategy and chooses features for the writing conventions and labels of its own task. The use of a related script makes the earlier work a useful methodological comparison, while the feature definitions and the treatment of internal breaks are specific to this experiment. Word Segmentation of Informal Arabic with Domain Adaptation

The review also covers neural Chinese segmentation that represents words and characters numerically. The authors say those approaches improved on traditional methods in the work they review and emphasize the amount of training data such approaches can require. They frame the availability of annotated text as an important consideration for low-resource languages. Their own study couples a manually prepared corpus with features that can be specified from character identity and the script. Neural Word Segmentation Learning for Chinese

For Urdu, the closest task precedent is the work of Durrani and Hussain. Their approach combined dictionary matching, statistical information and part-of-speech information to address inserted and omitted spaces. Zia and colleagues identify a further need for a shared Urdu segmentation corpus with reference labels and a reproducible CRF procedure. Compiling that resource was part of defining the task. An annotated sequence records when a visual break counts as a separation between words and when it belongs inside one. That distinction has to be specified before the success of a segmenter can be measured. Urdu Word Segmentation

The method, step by step

Specify the intended text before removing its boundaries

The procedure starts with sentences whose word and sub-word boundaries have been established. The authors then take away the marks that disclose those boundaries and ask the CRF to predict where the marks belong. This gives each sentence two roles. Its plain character sequence is the input, and its annotated form supplies the reference decisions. The relation between them makes the task a supervised learning problem. The system sees expected outputs during training, then has to make the corresponding decisions for sentences held out for testing.

Removing the boundary marks also defines what the experiment measures. In a naturally typed sentence, an ordinary space might be correct, missing or used in place of a non-joining mark. The character-sequence formulation asks for the intended divisions across the whole string. Existing spaces are therefore dispensable as evidence in the task as defined. The input represents the material that the segmenter will keep, and the predictions determine how that material will be divided.

Consider the paper’s example of a compound glossed as “live.” The annotated form identifies the start of the word and an internal start at the junction of its components. The second start must keep the components from visually merging, while the output still treats the compound as a single token. The example glossed as “investment” uses the same output distinction for a root and suffix. The grammatical relation between the parts differs, but both cases call for a ZWNJ at the internal division. The system has a common class for positions that require that character.

From annotated Urdu sentences to segmented text

The steps in order.

From annotated Urdu sentences to segmented textStep 1: Mark word boundaries and internal non-joining breaks1. Mark word boundaries and internal non-joining breaksStep 2: Normalize characters and prepare the diacritic conditions2. Normalize characters and prepare the diacritic conditionsStep 3: Strip boundary markers to obtain character sequences3. Strip boundary markers to obtain character sequencesStep 4: Describe each character and its surrounding context4. Describe each character and its surrounding contextStep 5: Learn CRF weights from reference labels5. Learn CRF weights from reference labelsStep 6: Predict a label sequence for new text6. Predict a label sequence for new textStep 7: Restore spaces and non-joining marks from predicted starts7. Restore spaces and non-joining marks from predicted starts

Build a reference with separate marks for each boundary

The source for linguistic annotation was the Urdu portion of the Urdu-Nepali-English parallel corpus. The paper traces its common English source to Wall Street Journal news sentences in the Penn Treebank. The authors began with an existing collection of sentences and added information needed for this segmentation task. The resulting corpus comprises 4,325 sentences and approximately 111,000 tokens.

The authors used the CLE Urdu corpus cleaning application and followed conventions proposed by Rehman and colleagues. The central convention is to place a space at each word ending and use the ZWNJ at specified internal divisions. As a practical matter, this requires deciding which character should appear at the junction. An annotation scheme that asked only whether a break was present would lose exactly the distinction that matters for Urdu text. With separate markers, the reference simultaneously represents the intended token count and the places where letters should stop joining within a token.

The compound conventions illustrate the specificity of that decision. In compounds of the types the authors call X-Y and X-e-Y, the annotation puts a ZWNJ at the division between the roots or stems. In an X-o-Y compound, the mark goes on either side of the linking letter و. That convention allows a single word to contain more than one marked internal division. Each division will eventually be an independent position at which the label sequence must specify a sub-word start.

The other conventions assign the ZWNJ between the repeated elements of a reduplicated expression and at the junction of an affix and a root. For prefixation the relevant division is after the prefix. For suffixation it is before the suffix. The authors also mark internal component divisions in a transliterated word and between the components of a transliterated abbreviation. This brings the annotated football example and the abbreviation corresponding to Ph.D. under the same marking scheme, while retaining distinct reasons for the separation in the linguistic description.

An important distinction follows from the way the reference is constructed. The annotator uses knowledge of compounds, affixes and transliterations to mark certain positions. The CRF receives character-level evidence from which to learn those choices. The final feature inventory has no field that explicitly tells the system whether it is looking at an affix or a compound. It can learn that certain strings and character properties often occur around the junctions that annotators marked. The linguistic rules define the expected answer, and the features define the information available for predicting it.

The first author annotated the entire collection. A co-author also annotated a sample of 100 sentences covering 21,781 characters. Both were native Urdu speakers, regularly used printed and digital Urdu, and had backgrounds in computer science and natural language processing. The reported Cohen’s kappa was 0.98. Kappa assesses agreement with an adjustment for the amount of agreement expected by chance. Here it concerns the two people’s annotation of the shared sample. Its role is to say something about the consistency of the reference conventions before the automatic scores are interpreted.

Normalize the input and decide what to do with diacritics

The authors applied Unicode normalization to put equivalent character representations into consistent forms. This matters when exact character identity is used in a feature. If equivalent encodings were allowed to appear as separate identities, evidence about a recurring letter sequence could be spread over several representations. Normalization gives those occurrences a common representation. The authors also removed repeated spaces in their preparation of the text.

They considered two treatments of diacritics. These marks can help a reader identify a word or recognize a construction that has an internal division. The paper describes their omission as common in informal Urdu and in much formal writing. The experiment without diacritics thus addresses the condition the authors regard as representative of ordinary input. Removing the marks has a practical cost for the segmenter. A useful signal about how to interpret a sequence may disappear, which means that the decision must draw on the remaining characters and their context.

The authors also report the corresponding results when the available diacritics remain in the text. In that condition, a diacritic can appear in the context seen by the predictor. The comparison asks what difference the observed marks make under this annotation scheme. It is separate from the change made by stripping the target markers, which applies to the basic prediction problem. A diacritic can supply evidence about an answer. A space or ZWNJ in the reference supplies the answer itself.

The split is at sentence level. The training portion contains 3,500 sentences and 90K tokens, and the test portion contains 825 sentences and 21K tokens. Keeping sentences intact preserves the context in which positions are labeled. The test sentences are held out from training, so the scores concern prediction in unseen sentences from the same corpus. The authors released the annotated material and accompanying Urdu word-segmentation pipeline publicly.

Express segmentation as a label at each character

Once the markers have been removed, the input is an ordered sequence of characters. The paper uses the following notation for that sequence.

X = (x₁, …, xₙ)

X is the complete input sequence. x₁ is its first character and xₙ is its last character. The subscript specifies a position, n is the length of the sequence, and the ellipsis stands for the intervening characters. The parentheses group the characters in sentence order.

There is a corresponding sequence of labels.

Y = (y₁, …, yₙ)

Y is a candidate labeling of the input. y₁ through yₙ are the labels at the respective character positions. The ellipsis again stands for the intervening entries and the parentheses preserve their order. The length n is the same as in the input, since each character is assigned a label.

I indicates that the character continues a word or sub-word. Both cases use the same symbol because neither requires a boundary marker before the character. B_W denotes the beginning of a word. B_S denotes the beginning of a sub-word. The subscripts distinguish the two kinds of beginning. Thus the information needed to choose a marker belongs to the character immediately following the division. To recover the text, the sequence of word starts gives the space boundaries, and the sequence of sub-word starts gives the ZWNJ boundaries.

This representation lets the system distinguish two mistakes at the same position. It might miss the beginning and assign I, leaving the relevant characters adjacent. Or it might recognize a beginning but use the wrong boundary type. Predicting B_W where the reference has B_S introduces a word division at an internal break. Predicting B_S where the reference has B_W keeps two words in one token in spite of interrupting the join. The distinction is visible in the evaluation because the reference preserves both labels.

A continuation label applies throughout the rest of an ordinary stretch of characters, even when the script itself includes a letter that prevents joining. This separates the linguistic output from the shapes of particular characters. Joining behavior contributes evidence to the decision, but the labels specify the intended segmentation. The start of a word or sub-word is something the system learns to predict from the annotated sequences.

Turn the current character and its neighborhood into evidence

The strongest feature collection described in the paper starts with character identity and local character combinations. The system considers the current character with up to three characters before it and three after it. The authors express the span using positions relative to the character being labeled.

(xᵢ₋₃, …, xᵢ, …, xᵢ₊₃)

x denotes a character from the input sequence, and i is the position under consideration. xᵢ is the current character. xᵢ₋₃ and xᵢ₊₃ are the positions at the stated distances before and after it, when present. The ellipses represent the other positions in that neighborhood. The parentheses indicate an ordered neighborhood from which the character n-gram features are drawn.

Characters on either side can matter because a label describes a junction. The current character might be a plausible beginning in several constructions. Its predecessor can help indicate whether a recognizable unit ends there. The following characters can help indicate whether the proposed beginning matches a part that occurs in training. A window can bring both kinds of evidence into the same decision. The paper compares gradually larger windows to see how much the additional surrounding text helps.

The final system also describes the current character using properties that group different identities by their behavior. A digit feature tells the CRF whether the character is numeric. A joiner feature tells it whether the character can take the joining forms discussed in the account of Urdu writing. A Unicode class feature describes the character through its encoded classification. A direction feature describes its writing direction, relevant to sentences in which Urdu letters and numerals run in different directions.

These properties supplement the character window. A particular sequence of letters can be learned as local evidence for a boundary, while properties such as joining or digit status allow characters to share a description even when their identities differ. Some of the features may convey overlapping information. A digit and its direction, for instance, can both say something about the presence of numeric text. The feature comparison tests how much benefit appears when each property is added to the features already present.

The feature set includes no separate dictionary match or part-of-speech assignment in the system as described. The vocabulary of evidence at prediction time consists of the character sequences and the stated properties. This explains the relationship between the engineering of the features and the annotation rules. The authors choose which observations the system can see and what each target label means, then use the annotated examples to learn how those observations bear on the labels.

Score complete sequences and reconstruct the text

The conditional random field assigns a probability to a labeling for a given input sequence and set of learned weights. The conditional distribution in the paper is written as follows.

P(Y | X; w)

P denotes probability, Y is a candidate sequence of boundary labels, and X is the observed character sequence. The vertical bar means that the probability of the labels is conditional on the input. The separator inside the parentheses distinguishes w, the collection of learned feature weights, from the observed sequence X. The weights govern how strongly feature values contribute to the scoring of a labeling.

The authors use a linear-chain CRF. The chain follows the order of characters and lets neighboring label decisions be treated as parts of a sequence. The decision rule selects the candidate whose feature score is highest. In the paper’s notation, with the range of the maximization made explicit, it is

Ŷ = argmax over Y [Σᵢ₌₁ⁿ wᵀ ϕ(X, yᵢ)]

Ŷ is the predicted label sequence. The hat marks the selected labeling, and the equals sign identifies it with the result of the maximization. argmax over Y returns the candidate sequence that attains the highest score. The square brackets group the quantity being maximized. Σᵢ₌₁ⁿ sums over positions i from the first character through position n, the end of the input. wᵀ is the transpose of the weight vector, so its product with the feature vector is a weighted score. ϕ is the feature map, X provides the observed characters, and yᵢ is the candidate label at position i. The parentheses give the arguments to the feature map. The paper presents the feature contribution at a position in this compact notation.

The scoring expression says how the trained parameters are used. Each candidate labeling receives contributions from features across the sequence. The selected candidate is the sequence with the greatest total according to those weights. The training data connect the input characters to the reference I, B_W and B_S labels, providing examples from which the weights are learned. The paper gives the representation, feature inventory and prediction rule, with less detail about the numerical training procedure.

The last step converts the labels to characters in the output. Continuations retain the adjacent characters as part of the current unit. Word starts create the space boundaries between words. Sub-word starts create internal ZWNJ boundaries. For the paper’s compound and affixation examples, this means the parts can retain the intended shapes and still be passed on as single word tokens. The output is a segmented string in which the boundary decision and the choice of script mark have already been made together.

Experiments and results

What the test set measures

The main experiment applies the trained segmenter to the 825 held-out sentences, representing 21K tokens. According to the corpus description, this split contains 20,264 spaces marking word boundaries and 1,200 ZWNJs marking sub-word boundaries. Those counts describe how often the two targets occur in the reference. The test therefore gives the system many more opportunities to predict a word boundary than a sub-word boundary. It also gives the reader a reason to examine the classes individually before interpreting any overall score.

The paper reports precision, recall and F1 for each boundary type. For word-boundary precision, the starting point is the places where the system predicts a word start. The question is what share the reference also marks as word starts. For recall, the starting point is the reference word starts. The question is what share the system finds and labels correctly. The same definitions apply separately to sub-word starts. A high F1 score depends on both precision and recall because F1 combines them using the harmonic mean. In this experiment it describes the accuracy of a category of boundary decisions.

The difference between precision and recall is especially relevant to internal breaks. A system can assign a ZWNJ only where the evidence seems strong and be fairly precise while missing many positions where the reference calls for one. Conversely, predicting many internal breaks can recover more of the reference at the cost of putting marks in the wrong places. The paper’s class-specific results let a reader see which of those problems is more pronounced. They also distinguish the recovery of actual word boundaries from a judgment about how words should look internally.

The direct comparisons use the authors’ own CRF with changes to the features and with or without diacritics. The smallest feature setting, which sees the current character alone, provides an internal baseline. The related-work discussion gives a different kind of comparison. Durrani and Hussain’s Urdu hybrid approach is reported at an error detection rate of 85.8% for spacing errors. The paper likewise cites F1 results of 0.92 on Egyptian Arabic Treebank material and 0.98 on Arabic Treebank material from the earlier Arabic CRF work. The Urdu error detection figure and the Arabic corpus scores each describe their original setting. The controlled comparisons for the present study come from the configurations evaluated on its annotated Urdu material.

The results with diacritics removed

On the undiacritized test set, word-boundary precision is 0.97 and recall is 0.97. The resulting word-boundary F1 is 0.97. For sub-word boundaries, precision is 0.91 and recall is 0.80, giving F1 of 0.85. Taken together, the sub-word figures show that predictions of an internal boundary are usually correct when made. The weaker result lies in recovering all of the internal boundaries in the reference.

The undiacritized confusion matrix makes that pattern more concrete. The system correctly predicts the word-start label at 19,637 reference word starts and the sub-word-start label at 965 reference sub-word starts. It labels 574 reference word starts as continuations and 53 as sub-word starts. For reference sub-word starts, it labels 119 as continuations and 116 as word starts. The last pair of counts shows two distinct ways an internal boundary can be missed. At some positions the system keeps the sequence unmarked. At others it inserts the separation appropriate to a word boundary.

Errors also occur at positions the reference calls continuations. The matrix shows 474 of those positions labeled as word starts and 42 labeled as sub-word starts. These are predicted boundaries where the annotated text has none. The counts explain why precision and recall answer different questions even with a system that assigns exactly one label per input character. A missed boundary and an extra boundary may appear in different places, and an incorrect boundary type affects both the target class and the one predicted in its place.

In the undiacritized condition the paper also reports macro-F1 of 0.91 and micro-F1 of 0.96. Macro and micro averaging give different weight to classes and individual decisions. Macro averaging gives a class’s score influence independently of its frequency, while micro averaging pools decisions. The paper’s class-specific measurements are the most direct way to check how the rare sub-word boundary fares alongside the much more frequent word boundary. An aggregate score by itself would obscure the difference between their precision and recall.

The results with diacritics retained

With diacritics present, word-boundary precision is 0.98 and recall is 0.97. The reported word-boundary F1 remains 0.97. Sub-word precision is 0.92 and recall is 0.83, with F1 of 0.87. The larger visible change for sub-word boundaries is in recall, consistent with the idea that some of the marks help reveal internal boundaries that the plain sequence makes harder to identify.

Sub-word boundary F1 on the held-out Urdu sentences

Retaining the available diacritics improves recovery of internal boundaries.

Sub-word boundary F1 on the held-out Urdu sentencesDiacritics removed: 0.85Diacritics removed0.85Diacritics retained (this paper): 0.87Diacritics retained (this paper)0.87
The numbers
System or settingF1
Diacritics removed0.85
Diacritics retained (this paper)0.87

In the corresponding confusion matrix, the system labels 997 reference sub-word starts correctly. It assigns continuation labels to 115 and word-start labels to 88. It also correctly labels 19,660 reference word starts, while labeling 560 as continuations and 44 as sub-word starts. These counts describe a condition that includes the diacritics as additional characters, so comparisons of continuation counts between the matrices also reflect a difference in the input representation. The class-specific precision and recall are designed to make the boundary comparison interpretable.

The reported macro-F1 for the version with diacritics is 0.92 and the micro-F1 is 0.96. The aggregate picture is therefore one of modest changes when the marks are retained, alongside a clearer change in sub-word recall. A reader choosing a headline value for ordinary input should keep track of the distinction between the two conditions. The authors use 0.85 for sub-word F1 on undiacritized text as their main result, while 0.87 is the result in the condition that preserves the available marks.

The test corpus gives the result a fairly precise interpretation. The 0.97 word-boundary F1 establishes performance at identifying individual word starts in held-out sentences under the paper’s annotation rules. The 0.85 sub-word F1 in plain text establishes performance at identifying internal starts under those rules. A sentence-level exact-match measure would ask whether every relevant position in the sentence is correct together. A word-level display measure would ask whether the predicted internal breaks preserve the intended rendering. The authors chose boundary metrics to show the two local identification problems and the kinds of errors made on each.

What the ablations show

Local context chiefly changes what the CRF can recover

The feature comparison builds the system up cumulatively. The first setting uses only the current character. Each widening of the window adds surrounding evidence, and each subsequent character property is added to the features already available. The sequence is useful because it shows what happens as the system gains access to richer evidence. The comparisons measure the marginal contribution of each addition in this order.

Word-boundary F1 in the Urdu corpus feature comparison

Word-boundary scores rise as the character neighborhood grows and improve further with script properties.

Word-boundary F1 in the Urdu corpus feature comparisonCurrent character: 0.59Current character0.59+1 character window: 0.77+1 character window0.77+2 character window: 0.85+2 character window0.85+3 character window: 0.92+3 character window0.92Add digit feature: 0.95Add digit feature0.95Add joiner feature: 0.96Add joiner feature0.96Add Unicode class: 0.97Add Unicode class0.97Add direction feature (this paper): 0.97Add direction feature (this paper)0.97
The numbers
System or settingF1
Current character0.59
+1 character window0.77
+2 character window0.85
+3 character window0.92
Add digit feature0.95
Add joiner feature0.96
Add Unicode class0.97
Add direction feature (this paper)0.97

Sub-word boundary F1 in the Urdu corpus feature comparison

Internal boundary prediction benefits from broader character context and gains further from character properties.

Sub-word boundary F1 in the Urdu corpus feature comparisonCurrent character: 0Current character0+1 character window: 0.07+1 character window0.07+2 character window: 0.46+2 character window0.46+3 character window: 0.72+3 character window0.72Add digit feature: 0.79Add digit feature0.79Add joiner feature: 0.84Add joiner feature0.84Add Unicode class: 0.85Add Unicode class0.85Add direction feature (this paper): 0.85Add direction feature (this paper)0.85
The numbers
System or settingF1
Current character0
+1 character window0.07
+2 character window0.46
+3 character window0.72
Add digit feature0.79
Add joiner feature0.84
Add Unicode class0.85
Add direction feature (this paper)0.85

For word boundaries, the current character already supports an F1 score of 0.59. Access to neighboring letters improves it at every window setting reported. The score is 0.92 by the time the widest character window is available. One plausible reading follows from the task itself. The identity of a character can offer some evidence about whether a word begins there, and the preceding and following letters help supply more of the pattern. The experiment measures the improvement from that context without singling out particular word forms responsible for it.

Sub-word boundaries show a stronger dependence on context in these comparisons. The current-character score is 0, and the first window produces F1 of 0.07. The wider settings produce 0.46 and then 0.72. An internal break is tied to a relationship between parts. The examples of compounds and affixed words show why knowing the identity of the next character alone can be a weak signal. Seeing more of the material around the division gives the CRF a chance to learn recurrent junctions. The results support the usefulness of that broader neighborhood, while the aggregate comparison leaves the responsible constructions unidentified.

The fact that both curves rise matters for the overall design. The annotation distinguishes space from ZWNJ, and the same character context provides evidence about both. The benefit appears even before the explicit script properties are added. This helps explain why an approach based only on a table of joining letters would address just part of the problem. Joining is relevant, but the feature results give a substantial role to which characters occur together around a potential boundary.

Character properties add evidence after the window is in place

After the widest character window, adding the digit feature gives word-boundary F1 of 0.95 and sub-word F1 of 0.79. The addition of joining status takes those results to 0.96 and 0.84. The Unicode class feature takes them to 0.97 and 0.85. The last comparison, with direction added, reports the same scores for both boundary types as the preceding setting at the precision shown in the paper.

The digit result belongs to the combination of digit status and the full character window. It shows that giving the system a shared description for numeric characters helps at that point in the feature sequence. The paper provides no breakdown of errors next to numerals, so the result does not locate the improvement in a particular kind of numeric expression. The joiner result has a more direct connection to the motivating examples. It shows a gain when the system is told which current characters can join, a property central to why writers insert or omit spaces. The feature table measures the added predictive value of the property across the test material.

Unicode class contributes a further improvement in the reported settings. It provides information about a character that can be shared across multiple exact identities. Direction, which is included in the final feature inventory, leaves the displayed scores unchanged when added after those other properties. That result is conditional on the preceding configuration and the reported precision. Other features could carry some of the same information, or any change in which positions are correctly labeled could leave the displayed F1 unchanged.

The cumulative procedure leaves the contribution of each feature in other combinations open. An experiment removing joining status from the final configuration would ask a different question from the experiment that introduced it after digit status. Likewise, trying direction on a smaller feature set would test whether it can stand in for evidence that was already available by the final stage. The paper establishes an ordering of improvements for its chosen path through the feature sets. It gives no independent ranking of the properties across every possible combination.

Diacritics provide a separate comparison

The experiment with and without diacritics changes a property of the text instead of adding a flag for the current character. Retaining these marks lets certain patterns appear directly in the sequence. The authors note that a mark can help identify an internal division in compounding, and that diacritics can also give evidence about word boundaries. The improvement in sub-word recall with marks present is consistent with that explanation. A class of difficult cases might become easier when the written text provides a clue that would otherwise have to be inferred.

The authors also give a reason for the modest size of the change. They count 5,237 diacritics in 111K tokens in the corpus. The retained-mark condition thus preserves the diacritics already present in a sparsely marked collection. It does not represent a condition in which every possible mark was added. The comparison answers the practical question of how much the observed marks help in these experiments. It leaves the performance of a systematically diacritized version open.

The confusion matrices complement the feature and diacritic comparisons. They show that confusing the two beginnings is a real part of the error profile, alongside missed and extra boundaries. Feature comparisons show which additions help overall, while the error counts show which distinctions a full system still struggles to make. The paper links these findings at the level of the task. Its results support using wider context and script properties, while its label confusions identify internal starts as a continuing source of difficulty.

Limitations

Limits the authors identify

The authors describe their annotated corpus as small compared with the segmentation benchmarks they discuss for Arabic and Chinese. It contains 4,325 sentences and 111K tokens. Their proposed extension is to tag a larger corpus with both spaces and ZWNJs. That future direction matters for each label. More annotated text could supply additional examples of familiar character patterns and cover forms that are infrequent in the existing collection. The paper reports results for the collection it built and evaluated.

The authors also identify sub-word boundaries as the task in need of further improvement. They propose exploring more linguistic features for the CRF. The results motivate that aim. In the principal experiment, the system recovers word starts more successfully than internal starts, and a substantial part of the internal-boundary difficulty appears in recall. The paper suggests recurrent and bidirectional recurrent approaches as another future direction. Those are proposals from the conclusion, with no corresponding Urdu scores in the experiments.

The paper treats the sparsity of diacritics as a limit on the with-diacritics comparison. The authors suggest that automatic diacritization could change the conditions under which segmentation is performed, and leave it beyond the scope of the work. Their experiment therefore covers the marks that happen to occur in the corpus and the same task with those marks removed. It shows how the given marks affect prediction in this setting, without supplying evidence for an automatic process that adds diacritics before segmentation.

Limits of the data and comparison

The test split comes from the same parallel corpus as the training split, with the common English source traced to news text. Holding out sentences gives a direct test of prediction on unseen examples within that collection. Generalization to other Urdu sources remains open. Text written directly for different audiences or contexts could show different word choices, spelling habits or uses of spaces. The paper’s observation about the omission of diacritics motivates the plain-text condition, while a separate evaluation on independently collected Urdu would be needed to measure performance under other writing conditions.

The transformation from an annotated sentence to a concatenated character sequence also matters. It creates a consistent task with both boundary markers hidden. A raw-text system might have access to existing spaces and need to decide which ones to trust. In this study, the approach reconstructs the word and sub-word divisions from characters and their features. The scores leave open how much information original whitespace would contribute in a setup that retained it, or how performance would differ across sources with different rates of spacing errors.

The agreement assessment is evidence about the repeatability of the annotation on 100 sentences. It draws on annotators who share relevant language experience and technical backgrounds. A broader annotation study could reveal how particular conventions are interpreted by other annotators or with different editorial goals. For evaluating the CRF, the important point is that “correct” means matching the scheme used in this corpus. The score does not settle every possible linguistic analysis of what should count as one word in Urdu.

The earlier Urdu system’s error detection rate and the present CRF’s F1 values do not furnish a common measure of improvement. A claim that one system outperforms the other on the same task would require aligned data, target definitions and evaluation. The paper’s own current-character baseline and richer variants provide direct evidence about feature choices. A comparison with a prior Urdu method re-evaluated on the shared split would answer the different question of how the overall approaches perform under the same conditions.

Limits of the reported diagnostics

The paper shows examples from compounding, affixation, reduplication, borrowed vocabulary and abbreviations. Its reported boundary results pool across those categories. They do not show whether the performance gap between word and sub-word boundaries is concentrated in one construction or distributed across several. The matrices can identify a confusion between continuation, word start and sub-word start. They cannot identify the grammatical or orthographic construction associated with each error.

The precision and recall results are evaluated on one sentence split. The paper leaves variability across other splits or repeated training runs unmeasured. This matters particularly when interpreting small changes in the reported feature and diacritic comparisons. The numbers show the direction of change under the reported conditions. A stronger claim about how stable each effect is would require more comparisons than the paper reports. The direction feature’s tied scores are similarly evidence about the displayed evaluation and precision.

The number of correctly identified individual boundaries also leaves downstream effects open. A missed space can combine words that a later application expects to see separately. An incorrect ZWNJ can change an internal joining point within a token. These consequences can matter differently to a tagger, a translation system or a search application. The authors motivate segmentation through such applications and evaluate the boundary prediction itself. The practical effect in any of those applications would require observing how it handles the resulting text.

Finally, the article’s mathematical description specifies the conditional labeling setup, the feature map and the choice of the highest-scoring sequence. It provides less detail about how the weights are fitted than about which evidence they use. The release of the annotation and code is therefore a substantive part of the contribution. The paper establishes the task and reports the evaluation, while the accompanying materials are the place to inspect implementation choices beyond the written description.

What came after

SimplifyUR: Unsupervised Lexical Text Simplification for Urdu cites the segmentation paper from the context of a different Urdu text-processing task. Lexical simplification concerns the words or expressions in text. Segmentation determines which stretches of characters are available to be treated as words in the first place. That connection is concrete in a script where an affix or a part of a borrowed expression can be separated by a typed space. The segmentation study addresses the earlier decision about the token and its internal shape. The citation establishes that the study enters the later Urdu simplification literature. It leaves open whether SimplifyUR uses the released code, annotation or CRF predictions.

Handling Cross- and Out-of-Domain Samples in Thai Word Segmentation cites the study from the context of Thai segmentation. The later paper’s stated subject is what happens when the samples to be segmented cross domain boundaries or come from outside the domain at issue. This connects to a question left open by the Urdu study’s sentence split. Success on sentences drawn from the same collection as the training material establishes one kind of generalization. Segmentation under a change in domain asks whether the decisions continue to work when the distribution of strings and contexts changes. The citing relationship puts the Urdu paper in that wider discussion of word segmentation, while leaving any transfer of the Urdu feature set or ZWNJ conventions unspecified.

The two citations place the work in different lines of research. One concerns what can be done with words once Urdu text is available as meaningful units. The other concerns how well word segmentation works when the source of the input changes. The distinct contribution of Zia and colleagues remains the representation they made testable for Urdu. They treated a word division and a break in joining inside a word as separate outcomes, supplied reference annotations for both, and reported how well those outcomes could be recovered from character sequences.

Cite

Cite as Haris Bin Zia, Agha Ali Raza and Awais Athar. 2018. Urdu Word Segmentation using Conditional Random Fields (CRFs). Proceedings of the 27th International Conference on Computational Linguistics.

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

@inproceedings{zia2018urdu,
  title = {{Urdu Word Segmentation using Conditional Random Fields (CRFs)}},
  author = {Haris {Bin Zia}, Agha Ali Raza and Awais Athar},
  booktitle = {Proceedings of the 27th International Conference on Computational Linguistics},
  year = {2018},
  url = {https://aclanthology.org/C18-1217/}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/zia-2018-urdu-word-segmentation-conditional-random/