Elamur Research

Look Ma, Only 400 Samples! Revisiting the Effectiveness of Automatic N-Gram Rule Generation for Spelling Normalization in Filipino

Paper · 2022 · Lorenzo Jaime Flores and Dragomir Radev

Summary

Filipino social media users can write d2 for dito or nkktawa for nakakatawa. These are deliberate shortcuts, and a system that treats them as ordinary typing errors can miss the intended word. Flores and Radev study spelling normalization, the task of recovering a conventional written form from a shortcut or contraction. They ask whether a small collection of corrected examples is enough to learn rules that can restore other words. Their experiments use 398 abbreviated or contracted forms from Facebook comments on Philippine weather advisories, with a main split of 298 training examples and 100 test examples.

The method compares each abbreviated form with its correction and records possible replacements for short stretches of characters. A stretch of this kind is a character n-gram. A stretch can have several replacements in the resulting dictionary. For a new input, the normalizer recursively applies the available rules to construct possible words. It consults a Filipino vocabulary and then ranks the surviving candidates. The strongest configuration uses Damerau–Levenshtein distance, which measures how many character edits separate the candidate from the input. The paper also tests ranking by how often the rules used to make a candidate occurred in training.

On the selected test set, the strongest rule-based configuration achieves first-choice accuracy of 0.77 and top-five accuracy of 0.85. The distance-only baseline scores 0.45 and 0.72 on those measures, respectively. ByT5 with an added consistency objective produces candidate lists with the lowest average edit distance to the reference, but its first-choice accuracy is 0.37. In five-fold cross-validation, the rule-and-distance approach still has the highest first-choice accuracy among the systems compared, at 0.53 ± 0.02. The lower score under this second evaluation matters because the main test set was deliberately chosen to use spelling rules represented in training.

On a local CPU, training the rule dictionaries takes less than a second. The broadest distance-ranked search averages 2.781s per input, while a variant that restricts where single-character rules can apply averages 0.0086s and scores 0.67 for first-choice accuracy on the main test set. The authors can also diagnose a failed prediction by checking whether the intended word was ever generated. In their analysis, some failures came from missing rules and others from putting an available correction too far down the list. Those are different problems for a normalizer built from isolated words, especially when the surrounding sentence could help decide which correction the writer meant.

Deep dive: Look Ma, Only 400 Samples! Revisiting the Effectiveness of Automatic N-Gram Rule Generation for Spelling Normalization in Filipino

How a Filipino spelling normalizer learns character rules from a small set of examples, and how its accuracy compares with other approaches. · about 37 minutes to read

The problem and its context

A shortcut can be deliberate

A writer who enters d2 has produced a compact version of dito, which means “here.” In nkktawa, the writer has left out letters from nakakatawa, meaning “funny.” Both examples illustrate a difficulty with online text. A human reader can draw on pronunciation and familiarity with the expression to recover a word whose written form has changed considerably. A spelling system has to recover it from the characters that remain. Even the shape of the problem varies across the examples. One shortcut contains a digit, while the other compresses a longer string of letters.

The paper uses correction to mean this kind of normalization. The target is the conventional form that corresponds to the abbreviated or contracted input. That definition sets the scope of the study. The authors start with a word already identified as a shortcut and ask what conventional form to propose. A full system that reads a comment would also have to decide which pieces of text need attention. A compact form might be interpretable to its intended readers, so the practical problem here is making the word recoverable for subsequent language processing.

Normalization matters to the authors because online writing is a substantial source of Filipino text. For 2022, the paper cites an estimate of roughly 84.75M Filipinos online and gives 96.2% as the share on Facebook. The authors point to contractions and abbreviations as recurring features of that writing. A system that expects conventional words can have difficulty when the same expression turns up in several compressed forms. Giving those forms a common representation is a preprocessing task, with the normalized word available to whatever application comes next.

The setting also helps explain why the authors focus on low-resource languages. The shortage they discuss is a shortage of suitable training material, in particular examples in which a shortcut is paired with a correction. A large volume of online writing and a small supply of such pairs can coexist. The writer of a comment supplies the original expression as part of a conversation. Turning that expression into an example for supervised correction requires someone to identify what should be expanded and record the intended conventional form.

What earlier Filipino spelling systems could use

The authors describe earlier Filipino normalization systems that started from hand-written rules. A developer could recognize a recurring pattern and write a replacement for it. The procedure makes sense when the pattern is known and stable. The maintenance problem is that emerging conventions have to be noticed and entered by hand. Online vocabulary changes, so a fixed set of rules can lag behind the forms people actually write. Automatically collecting replacements from fresh pairs offers a way to revise the dictionary when corrected examples become available.

Other earlier work used dictionary substitution to extract patterns in misspelled words. As Flores and Radev describe it, the difficulty with a single substitution per pattern is that the same characters can occur in words that need different repairs. A replacement learned in one word may be appropriate in some other words and inappropriate in others. Once the dictionary is allowed to hold several replacements, learning a rule and choosing when to trust it become distinct decisions. The first can be made from corrected examples. The second has to be made separately for each new word.

The paper also discusses systems that use trigrams, meaning stretches of three characters, along with Levenshtein or QWERTY distance. Shared trigrams give a way of finding words with similar written pieces. Edit distance scores how much the written form would have to change, while keyboard distance uses the keyboard as a guide to how readily one key could have been pressed in place of another. The authors distinguish the situation these approaches were designed for, typographical errors, from intentional compression. A writer constructing a shortcut may remove several characters or use a digit for part of the spoken form. The omitted material need not be recoverable from keyboard proximity.

A distance score can still serve a purpose once plausible expansions are available. By itself, it rewards written resemblance. An extracted rule can first give the system a reason to consider an expansion, after which distance can help order the choices. The paper takes this division of labor from the practical strengths of the preceding approaches. It retains explicit changes to strings, allows a piece of an input to have several potential expansions, and applies a general measure of similarity after proposing words.

Automatic rule acquisition for spelling correction, from the earlier work of Mangu and Brill, provides the direct inspiration. The principle is to record recurring edits by comparing observed errors with corrected strings. In the Filipino setting, what counts as an error for the system can reflect an intentional choice by the writer. The evidence for the replacement nevertheless has the same form. There is a written string, a target string, and a comparison from which the procedure can record a candidate change.

Why a small collection of pairs changes the choice of method

The study situates the rule procedure alongside sequence-to-sequence approaches. In this task, those approaches learn to take one character sequence as input and produce another as output. They offer a way to learn corrections without designing a dictionary of specific changes by hand, but they still need evidence of which transformations should be made. The authors cite earlier supervised correction work that used thousands of labeled examples. They also discuss work on unsupervised translation in which vocabulary lists containing the desired targets were still a resource. Those examples motivate asking what explicit rules can extract from the smaller collection available for Filipino normalization. Word Translation Without Parallel Data

A pair of whole words can contain information about several pieces of spelling. The rule procedure takes advantage of that structure. If an abbreviated form and its correction share a stretch of characters, the procedure can record that the stretch remains the same. If a stretch changes, the procedure can record the proposed replacement and later offer it in another word. The opportunity comes from reusing evidence below the level of a complete word. It depends on the new input sharing some of the relevant character patterns with the training examples.

The paper’s question is therefore narrower than whether explicit rules can handle online Filipino in general. It asks how much normalization can be done when the intended corrections share reusable spelling patterns and only a small set of corrected forms is available. The evaluation takes up both a split designed around that premise and a cross-validation experiment on the collected words. This distinction follows from the problem itself. The ability to reuse an observed change and the ability to handle a previously unseen change place different demands on a spelling system.

The method, step by step

From corrected pairs to a list of options

The method starts with examples of the kind a reader could supply when asked to expand a shortcut. Each example contains the abbreviated word and a corresponding correction. The algorithm works inside these pairs. It records direct correspondences between short stretches of the abbreviated and corrected strings, then stores the correspondences together across the training collection. The output of training is a rule dictionary with an abbreviated stretch as its key and a list of possible corrected stretches as its value.

At inference time, the direction of use is reversed. Given an abbreviated word, the normalizer looks for pieces that match the dictionary keys. A match gives it possible replacement text. One match may support several replacements, and choices at different positions can be combined. Each completed string is a candidate correction. A list of Filipino words can then narrow the candidates, and a scoring rule puts the remaining forms in order.

The paper illustrates inference with 2loy and its correction tuloy. The example shows the intended relationship between the stored correspondences and the final word. A string containing 2 can be expanded to the conventional form, with the rest of the spelling contributing evidence about the word as a whole. The dictionary represents transformations of pieces, so it can use a correction learned from one word while working on another. The example illustrates the procedure’s output without making every occurrence of the same character an unconditional instruction to rewrite it.

Learning and applying Filipino spelling rules

The steps in order.

Learning and applying Filipino spelling rulesStep 1: Collect abbreviated forms and their corrections1. Collect abbreviated forms and their correctionsStep 2: Compare short stretches within each training pair2. Compare short stretches within each training pairStep 3: Store the observed replacements by input stretch3. Store the observed replacements by input stretchStep 4: Generate alternatives by applying matching rules4. Generate alternatives by applying matching rulesStep 5: Limit the alternatives kept during search5. Limit the alternatives kept during searchStep 6: Filter against the Filipino vocabulary where possible6. Filter against the Filipino vocabulary where possibleStep 7: Rank candidates and return the highest choices7. Rank candidates and return the highest choices

Building the training collection

The comments came from Facebook responses to advisories issued by a Philippine weather bureau in 2014. The authors identified 403 distinct contracted or abbreviated words. Three Filipino undergraduate volunteers independently supplied the forms they considered correct. This linguistic annotation step supplies the target side of each example. A shortcut alone can tell a collector what people write, but the algorithm needs the corresponding expansion to record which parts of the spelling may change.

The authors remove hyphens and standardize spacing to make the annotations more directly comparable. They then discard cases in which all annotators supply different answers. The resulting collection contains 398 examples, reported as 98.7% of the original forms, with 83.8% inter-annotator agreement. These figures measure different things. The first percentage describes retention under the collection procedure. The second describes how consistently the volunteers annotated the material. An example could pass the retention rule even where the annotators were less than unanimous.

For the principal experiment, the paper uses a 298-100 train-test split. The dictionary is learned from the 298 training pairs. The authors select the 100 test pairs so that their spelling rules are represented in the training portion. In this design, a test word can be a new complete input while a transformation that helps recover it is familiar. Cross-validation uses the combined collection to study behavior under other divisions. The authors make the data and experimental code available through the Filipino-Slang repository.

Extracting replacements with separate pointers

To extract a rule, the algorithm uses a window of length k over each member of a pair. A window is a span of characters taken from a current position in the string. The paper calls the abbreviated string w and the correction c in its method description. It uses i for the position in the abbreviated string and j for the position in the correction. The proposed replacement takes the stretch beginning at i in w and associates it with the stretch beginning at j in c.

The distinction between the two positions matters because compression can leave the words with different lengths. A position in the abbreviated form may correspond to a later position in the correction after a compressed part has been expanded. The algorithm in the appendix describes pointers that begin at the start of both strings. At each iteration it takes a window at each pointer and compares the windows. It appends the corrected stretch to the list associated with the abbreviated stretch.

When the stretches match, both pointers move forward by k. When they differ, the pointer on the abbreviated side moves by 1, while the pointer on the corrected side moves by k. The mismatch branch can therefore keep examining nearby material on the abbreviated side while advancing farther through the expanded spelling. The loop continues while both pointers are within their respective words. The procedure follows this local rule for advancing, which gives it a simple way to handle mismatched spans without selecting a whole-word alignment first.

Even a match adds an entry. In that case the dictionary has seen evidence that the corresponding stretch can remain unchanged. A mismatch adds evidence for a replacement. Since the algorithm appends entries across training pairs, it can record multiple observations of a change as well as multiple distinct changes for a key. Multiplicity matters for the frequency-based ranking, where an often-recorded replacement gets more weight than a rare replacement from the same key.

These stored pairs are candidate correspondences inferred by the extraction procedure. They need not all represent productive spelling conventions. For example, the decision about how far to advance on a mismatch determines which later spans get paired. An unhelpful local pairing may enter the dictionary alongside useful ones. This is relevant at inference time because a noisy entry can both produce a distracting candidate and change the estimated frequency of other replacements associated with the same input stretch.

The authors explore windows from length 1 to 4 and report that lengths 1 / 2 worked best. They connect the finding to abbreviation by syllable, describing the relevant syllables as usually having 1-2 letters. The window lengths are a way of choosing how specific the recorded evidence should be. A short key can recur across many words. A longer key binds a change to more of its immediate spelling, which can make it more specific while reducing the number of occasions on which the exact key will be observed or matched.

For a fresh abbreviated form, the procedure looks up matching substrings in the learned dictionary. It recursively constructs whole strings, considering the stored alternatives each time it finds a matching key. When a substring has no entry, the algorithm keeps that substring as it is. This fallback allows observed changes to be combined with portions of a word that can already be carried into a plausible correction unchanged.

Recursion makes the set of opportunities grow with the number of possible replacements. The consequence is easiest to see by considering successive positions. A first replacement can leave several partial strings open. A later match may extend every surviving partial string in several ways. The number of completed candidates can therefore become much larger than the number of keys looked up for the word. The paper varies how many candidates are kept at each step, using the likelihood score to rank alternatives for that purpose.

The authors also vary where single-character rules are permitted. V1 can apply such a rule anywhere in the word. V2 permits it only on the last letter. The restricted version follows their observation that single-letter rules often occur at the end. The longer substring rules remain available in both variants. The positional restriction has a direct effect on coverage. If an intended correction needs a single-character change earlier in the word, V2 loses that route to the answer. It also avoids exploring the competing routes that such internal changes could open.

Search limits and positional restrictions act before final ordering. Keeping fewer partial alternatives can reduce the work needed to reach a completed list. It can also remove a partial string whose later continuation would have been useful. A final scoring method can choose only among strings that survive long enough to be scored. Thus the paper’s comparison of ways to rank completed candidates sits within a generation procedure that also uses a score to control its intermediate work.

The vocabulary check is another layer. The authors use a Filipino vocabulary list developed by Gensaya. If any generated strings are present in the list, the procedure keeps the listed candidates. If none are present, it falls back to the entire generated set. This condition gives the vocabulary a specific role. It favors known words whenever they are available while allowing the procedure to return an output for an input whose candidates all fall outside the list.

A consequence is that the vocabulary can change which mistakes are possible. If a true correction is listed and many implausible strings are unlisted, the check can make selection simpler. If the true correction is absent but some competing string is listed, the check can remove the answer. If all candidates are absent, the ranking step again has to choose among all of them. The adequacy of the vocabulary therefore matters alongside the adequacy of the rules.

Estimating how likely a replacement is

The paper defines the probability of a rule from its recorded frequency among replacements for the same abbreviated stretch.

P(a → b) = |{a → b}| / |{a → c}∀c|

P(a → b) is the estimated probability of replacing abbreviated stretch a with corrected stretch b. The arrow → indicates the direction of replacement. The numerator |{a → b}| counts the recorded occurrences of this particular replacement. The denominator |{a → c}∀c| counts the occurrences of all rules starting with a. In that denominator, c ranges over the possible replacement stretches, and ∀c means that every such outcome is included. The braces group the recorded rules and the vertical bars give their counts, including repeated observations. The slash divides the count for the selected replacement by the total for that input stretch.

This frequency is conditional on the abbreviated characters. A replacement can be common for one key and irrelevant to the estimate for another. The score reflects how the extraction procedure paired short spans in training. It can prefer an established correspondence over a rare one, though the frequency is only as informative as the records contributing to it. If the dictionary gives the same key several irrelevant replacements, their counts enter the denominator alongside useful observations.

The likelihood of producing a candidate is then written as a product of rule probabilities.

P(w → c) = ∏ᵢ₌₁ˡᵉⁿ⁽ʷ⁾⁻ᵏ P(w[i : i + k] → c[i : i + k])

P(w → c) is the score for converting the abbreviated word w to the candidate correction c. Here c is a complete candidate word, whereas in the denominator of the previous formula it ranged over replacement stretches. The product sign ∏ means to multiply the rule probabilities. The index i starts at 1 and runs through len(w) − k, where len(w) is the length of the input and k is the substring length. The bracketed expressions w[i : i + k] and c[i : i + k] denote slices of their respective strings beginning at i and ending at the boundary i + k. The probability inside the product gives the frequency-based score for changing the input slice into the corresponding candidate slice.

The prose account explains the intended use as multiplication over the rules that produced the candidate. The displayed expression uses the same slice index on the two strings. That presentation leaves a detail to distinguish from rule extraction, which explicitly uses separate pointers. A completed candidate may have a different length from its input, so the relation between a generation path and slices at matching indices is not fully specified by the formula. The underlying scoring idea is clear. The paper gives a stronger score to a candidate whose construction relies on better-supported replacements, according to the observed frequencies.

Ranking by distance instead

The alternative final score is Damerau–Levenshtein distance, abbreviated DLD. This distance expresses differences between strings in character edits, including insertion, deletion, substitution and the transposition of adjacent characters. The paper uses the standard settings of the pyxdameraulevenshtein package. At prediction time the comparison is between the original abbreviated form and the generated candidate. A candidate closer to the input under that edit count is preferred.

The rule dictionary and the distance score answer different questions about the same input. The dictionary supplies ways the spelling might plausibly expand based on examples. The distance score measures how much written change a resulting whole word requires. A candidate can be made by a frequently observed transformation and still end up farther from the input than a competitor. Another candidate can be very close in writing while being the wrong word. The experiments compare these ways of ordering candidates and also include a separate baseline that uses DLD.

The reference correction has a separate role in evaluation. It is available to the researchers to determine if the returned candidate matches the intended expansion and to compute distances from the returned list to that target. It is the input spelling that the DLD-ranked normalizer can compare against at prediction time. This distinction is especially important for interpreting the paper’s distance metrics. Selecting a candidate because it is close to the input does not guarantee that it will be close to the reference.

Experiments and results

The comparison systems

The main experiment compares the rule system against other ways of handling the same abbreviated words. Within the rule system, the authors pair the V1 and V2 generation procedures with either distance or likelihood for final ordering. This yields comparisons where the generation variant is held fixed while the final scoring approach changes, and comparisons where the placement of single-letter rules changes under the same scoring approach. The paper also includes a standalone DLD baseline and an evaluation using Google Translate.

The sequence-to-sequence comparisons use ByT5 and RoBERTa-Tagalog. The paper describes ByT5 as a character-level variant of T5 trained on cross-lingual tasks and previously shown to be robust to misspellings. Its use here is to generate a corrected string from an abbreviated input. RoBERTa-Tagalog is described as a BERT-based system trained on large Filipino corpora to predict hidden text. It supplies a comparison with prior training directly on Filipino. These systems enter the task with different kinds of prior training, so the benchmark compares the resulting normalization procedures under the available data. T5 · BERT · Improving Large-scale Language Models and Resources for Filipino

For this part of the experiment, the authors use an 80-20 division of the training data to select settings. The tuning criterion is the lowest validation loss. At inference, the systems use beam search to obtain the five highest-scoring candidates. Beam search keeps a limited set of promising partial outputs as the sequence is generated. The final output is thus a ranked list of possible corrections, which can be evaluated using the same list-based measures as the rule procedure.

The appendix specifies the Adam optimizer, a starting learning rate of 5e−5 and a stability setting of 1e−8. The epoch and batch settings are selected with Ray Tune. The selected unaugmented ByT5 configuration uses batch size 1 and 50 epochs. The ByT5 configuration with the consistency objective uses batch size 1 and 70 epochs, with a mean-squared-error weight of 0.2. These settings make clear that the plain and augmented comparison systems were tuned rather than run as untouched general-purpose predictors.

Augmenting the small training set

The authors try to strengthen the learned comparisons with two augmentation techniques. The first is the Π consistency objective. In addition to learning from the target correction, the procedure is encouraged to produce similar predictions for two versions of a misspelled word. The discrepancy is measured with mean squared error, and a tunable weight controls its influence on training. It is a semisupervised technique in the paper’s account. Its contribution is to reward consistent predicted corrections alongside the direct supervision from corrected pairs.

The second technique is autoencoding augmentation, labeled AE in the results. Training alternates between normalization and a copying task in which the desired output is the same word that went in. Copying gives practice in reproducing strings. Normalization makes a different demand whenever the source has to be expanded. Evaluating them together tests whether practice retaining written material helps with the main task under a limited supply of corrected examples.

Google Translate is evaluated differently. The authors submit a word and check for either an acceptable translation or a suggested spelling correction. They treat either as evidence that the input was understood well enough to be normalized. The decision can be made even when a translation service exposes no ranked list of proposed Filipino spellings. Consequently, the paper includes a figure for this check but leaves the list-based accuracy and edit-distance entries empty for Google Translate.

What counts as a correct prediction

Accuracy at a cutoff asks whether the exact reference appears among the candidates up to that cutoff. At k = 1, the first suggestion itself must match. At k = 3 or k = 5, another suggestion can receive credit if it appears high enough in the list. The authors attach particular importance to the first-choice result because an application may offer a single replacement. For an interface that shows alternatives, the wider cutoffs describe whether the intended word can at least be presented to the user.

The accuracy columns are labeled with a percent sign in the paper’s tables, but the entries are printed as proportions such as 0.77. The results here keep that printed scale. This also makes the relationship to the count of first-choice errors easy to track. The main test contains 100 observations, and the error analysis reports 23 first-choice failures for the leading configuration. The first-choice result concerns exact agreement with the reference, regardless of how similar an incorrect suggestion looks.

The edit-distance measures compare each of the top five suggestions with the reference. The authors report the minimum, mean and maximum. The minimum is the distance for the closest candidate in the list. The mean describes how close the candidates are as a group. The maximum reflects the farthest candidate within that evaluated list. A system can win on the minimum by supplying one particularly good candidate while losing on the mean if other suggestions are farther away.

There is another distinction between the minimum distance and first-choice accuracy. In the distance evaluation, the researchers can identify the closest suggestion using the reference. In a live correction, the ranking method has to place a suggestion first without that reference. A list with a good minimum distance can therefore indicate useful generation even where the final choice is weak. Conversely, a system with strong first-choice accuracy can return miscellaneous lower-ranked strings that raise its average distance. The measurements show different parts of the same output.

Results on the selected test set

On the held-out set constructed to reuse training rules, the first-choice leader is V1 with DLD. Its score is 0.77, followed among the rule configurations by V2 with DLD at 0.67. The standalone DLD baseline is at 0.45. Google Translate receives 0.44 under its translation-or-correction check. The latter score answers a related question with a different observable output, so the chart compares the systems that have a directly reported first-choice normalization accuracy.

First-choice accuracy on the 100-example Filipino spelling normalization test set

The unrestricted rule search with distance ranking has the strongest first choice on the selected test set.

First-choice accuracy on the 100-example Filipino spelling normalization test setN-grams with DLD V1 (this paper): 0.77N-grams with DLD V1 (this paper)0.77N-grams with DLD V2: 0.67N-grams with DLD V20.67N-grams with likelihood V1: 0.17N-grams with likelihood V10.17N-grams with likelihood V2: 0.47N-grams with likelihood V20.47Standalone DLD: 0.45Standalone DLD0.45ByT5: 0.31ByT50.31ByT5 with Π consistency: 0.37ByT5 with Π consistency0.37ByT5 with autoencoding: 0.04ByT5 with autoencoding0.04
The numbers
System or settingAccuracy @ 1 (proportion)
N-grams with DLD V1 (this paper)0.77
N-grams with DLD V20.67
N-grams with likelihood V10.17
N-grams with likelihood V20.47
Standalone DLD0.45
ByT50.31
ByT5 with Π consistency0.37
ByT5 with autoencoding0.04

The authors describe an improvement of 32% in first-choice accuracy over DLD, which they identify as the next best comparison in that claim. The main table separately reports 0.77 for the strongest rule configuration and 0.45 for the standalone DLD baseline. It does not give a calculation connecting the stated percentage to those entries. The tabulated scores specify the systems and metric directly, and the relative figure is the authors’ reported characterization.

Looking beyond the first suggestion, V1 with DLD attains 0.82 at the top-three cutoff and 0.85 at the top-five cutoff. V2 with DLD is at 0.74 for both cutoffs. The standalone DLD baseline scores 0.67 and 0.72, respectively. Expanding the list changes what the user can recover from it, but the unrestricted rule approach remains the highest-scoring system at each of these cutoffs on the selected set.

ByT5 with Π consistency reaches 0.58 for top-three accuracy and 0.66 for top-five accuracy, compared with 0.42 and 0.49 for plain ByT5. Both results benefit from giving credit to candidates beyond the first position. The Π variant, whose first-choice score is 0.37, is particularly instructive. An application can encounter a useful suggestion lower in its list even when the system would be less reliable if it could offer only its first choice.

The likelihood-ranked rule systems show a different relationship between generation and first choice. V1 with likelihood scores 0.17 at the first-choice cutoff, 0.38 at the top-three cutoff and 0.58 at the top-five cutoff. For V2 with likelihood the corresponding scores are 0.47, 0.61 and 0.64. The looser generation procedure can therefore supply targets that reappear somewhere in the wider list, even though its likelihood score is especially poor at putting them first. The restricted generation procedure gives likelihood ranking a different selection of candidates to order.

The autoencoding and RoBERTa-Tagalog comparisons make the spread of performance visible. ByT5 with autoencoding scores 0.04 at each of the reported accuracy cutoffs. Plain RoBERTa-Tagalog and both augmented variants score 0.00 at each cutoff on the main set. These are exact-match results for the tested procedures, including how they were adapted and how candidates were decoded. Their distance scores still express how far the generated strings were from the reference even in the absence of an exact match.

What the distance scores add

V1 with DLD records the lowest best-case distance on the selected test set, 0.46. Plain DLD records 0.59, and ByT5 with Π consistency records 0.57. The minimum-distance result is consistent with the top-five accuracy ordering at the very top of the comparison. V1 with DLD frequently supplies an exact target, which contributes the smallest possible distance for that observation, and the minimum can also credit a close approximation when the target is missing.

The mean tells a different story. ByT5 with Π consistency has the lowest reported mean reference distance, 2.06. The standalone DLD baseline has 2.28, plain ByT5 has 2.71, and V1 with DLD has 2.91. The Π variant also has a maximum-distance statistic of 3.41, while V1 with DLD records 4.73 on that statistic. These scores support the paper’s observation that ByT5 with consistency can generate several outputs that resemble the intended correction, even though it has fewer exact hits than the unrestricted rules with DLD. The standalone DLD baseline’s maximum-distance statistic is 3.32.

Mean reference edit distance among the top five on the selected Filipino test set

ByT5 with consistency training produces the closest suggestions on average across the candidate list.

Mean reference edit distance among the top five on the selected Filipino test setByT5 with Π consistency (this paper): 2.06ByT5 with Π consistency (this paper)2.06Standalone DLD: 2.28Standalone DLD2.28ByT5: 2.71ByT52.71N-grams with DLD V1: 2.91N-grams with DLD V12.91N-grams with DLD V2: 2.96N-grams with DLD V22.96N-grams with likelihood V2: 3.06N-grams with likelihood V23.06N-grams with likelihood V1: 3.50N-grams with likelihood V13.50
The numbers
System or settingMean Damerau–Levenshtein distance
ByT5 with Π consistency (this paper)2.06
Standalone DLD2.28
ByT52.71
N-grams with DLD V12.91
N-grams with DLD V22.96
N-grams with likelihood V23.06
N-grams with likelihood V13.50

The rule variants illustrate why the mean is useful alongside exact accuracy. V2 with DLD is behind V1 on exact accuracy and has a best-case distance of 1.03, compared with V1’s 0.46. Their means, 2.96 and 2.91 respectively, are closer on the printed scale. Restricting generation changes whether the very best option appears more visibly than it changes the average closeness of the entire returned list. The mean also leaves room for a system like the Π variant to do well on the overall quality of suggestions while missing the reference more often.

For RoBERTa-Tagalog, the unaugmented comparison has a mean distance of 15.3, the Π variant has 16.5, and the AE variant has 42.8 on the selected set. All have the same zero exact-match results, so the distance statistic reveals variation that accuracy cannot distinguish. The paper’s comparison therefore covers both ends of a useful diagnostic. Some systems provide plausible-looking alternatives without enough exact targets, while others can generate strings much farther from the intended form.

Cross-validation on the combined collection

The five-fold cross-validation uses the joint training and test data and reports the measurements with one standard deviation. This changes how examples are divided across training and evaluation. The main split guarantees training representation for spelling rules used by its selected test examples. The appendix describes cross-validation on the combined collection as a generalizability check. The original division no longer determines which words are held out.

At the first-choice cutoff, the n-gram procedure with DLD leads the reported cross-validation comparison at 0.53 ± 0.02. ByT5 with Π consistency follows at 0.40 ± 0.06, and the likelihood-ranked n-gram procedure has 0.35 ± 0.07. Plain ByT5 has 0.32 ± 0.06. The appendix labels the rule systems by their scoring method, without specifying V1 or V2 in the table. The results therefore support a comparison between the reported rule-and-distance and rule-and-likelihood entries, with the detailed V1 and V2 labels established on the main test.

Mean first-choice accuracy in five-fold cross-validation on the combined Filipino collection

The n-gram procedure with distance ranking leads when results are averaged across the folds.

Mean first-choice accuracy in five-fold cross-validation on the combined Filipino collectionN-grams with DLD (this paper): 0.53N-grams with DLD (this paper)0.53ByT5 with Π consistency: 0.40ByT5 with Π consistency0.40N-grams with likelihood: 0.35N-grams with likelihood0.35ByT5: 0.32ByT50.32ByT5 with autoencoding: 0.02ByT5 with autoencoding0.02RoBERTa-Tagalog: 0.0RoBERTa-Tagalog0.0
The numbers
System or settingAccuracy @ 1 (proportion)
N-grams with DLD (this paper)0.53
ByT5 with Π consistency0.40
N-grams with likelihood0.35
ByT50.32
ByT5 with autoencoding0.02
RoBERTa-Tagalog0.0

The relative performance depends on where the list is cut. At the top-three cutoff, the rule procedure with DLD records 0.63 ± 0.04 and ByT5 with Π consistency records 0.57 ± 0.03. At the top-five cutoff, the reported means are both 0.65, with standard deviations of 0.06 and 0.03 respectively. That equality belongs to the printed means. The top-five result is a narrower basis for favoring the rule system than top-one accuracy is. The standalone DLD and Google Translate comparisons are absent from the cross-validation table.

Cross-validation also changes which approach leads on best-case distance. ByT5 with Π consistency achieves 0.53 ± 0.05, while plain ByT5 achieves 0.77 ± 0.15 and n-grams with DLD have 1.49 ± 0.11. The Π variant also has a mean distance of 1.75 ± 0.07, compared with 2.93 ± 0.07 for the rule-and-distance entry. The rule method’s strongest cross-validation finding is its first-choice accuracy. The distance results show that the augmented comparison can achieve closer alternatives across the folds.

The authors describe a general drop in the metrics relative to the main test and say that the accuracy ordering is broadly preserved. The detailed figures qualify that description. The behavior varies by system and cutoff, as the shared top-five mean shows. The advantage of V1 with DLD on the deliberately selected test is strongest evidence about reuse of familiar spelling patterns. Cross-validation provides a second perspective on performance across the collection, with first-choice results still favoring the rule-and-distance procedure among the entries reported there.

The time cost of learning and using the rules

Training any of the n-gram configurations on a local CPU takes less than one second. By comparison, the paper says most of the learned sequence systems require at least 20 minutes on a GPU. The authors report using one RTX 3090 (24GiB) and a total of six GPU hours across fine-tuning and hyper-parameter selection. ByT5 has 300 million parameters. The timings describe the setups used for these experiments, including a training regime in which the rule system collects and stores local correspondences.

Inference separates the rule variants more sharply. V1 with DLD averages 2.781s, while V2 with DLD averages 0.0086s. The restricted variant also has lower accuracy on the selected split, at 0.67 for the first choice compared with 0.77 for V1. This is a meaningful choice within the method. The rule dictionary can be rebuilt quickly in either case. The amount of search required to use it on each incoming word depends strongly on where the procedure permits changes and how many alternatives it retains.

What the ablations show

Holding the candidate procedure fixed

The paper compares explicit variants and investigates their errors, without presenting a single experiment that removes every component in turn. Its clearest controlled comparison changes the ranking method while holding the named generation variant fixed. With V1, moving from likelihood ranking to DLD changes first-choice accuracy from 0.17 to 0.77 on the selected test set. With V2, the corresponding scores are 0.47 and 0.67. The result applies to both search variants, with a particularly large separation in the wider search.

The authors attribute the poorer likelihood results to irrelevant rules collected in the dictionary. Frequency ranking asks those entries to do more than simply suggest possibilities. It treats their observed counts as evidence about the relative quality of competing outputs. If a key yields several incidental pairings, a higher score may reflect how the training strings were traversed rather than a reliable correspondence. DLD gives the procedure another source of evidence by directly comparing the completed candidate with the observed spelling.

Keeping these roles distinct helps explain how a dictionary can be useful in spite of containing noise. For generation, a rule can be valuable if it makes the intended correction reachable on some inputs. Its presence among many alternatives is tolerable if the later scoring stage typically chooses well. For likelihood, a rule’s count can influence the result even when the rule is irrelevant to the intended correction. The authors suggest heuristics for removing irrelevant entries, while pointing out that tighter filtering could sacrifice the capacity to handle a wider range of forms.

The result also distinguishes final scoring from the use of likelihood as a search aid. The method describes keeping a limited number of candidates during generation with likelihood as a guide. The reported accuracy gap concerns which scheme selects the final output. It shows that likelihood can be substantially weaker as the final judge in these configurations. It does not isolate how much the same likelihood estimates contribute to retaining useful partial strings during search.

Restricting single-letter changes

The V1–V2 comparison shows that the effect of a restriction depends on the subsequent ranking. With DLD, allowing single-letter substitutions throughout the word gives better first-choice and top-five accuracy on the selected set. V1 with DLD reaches 0.85 at the top-five cutoff, while V2 reaches 0.74. The extra flexibility is consistent with giving the system ways to reach corrections that a word-final restriction would rule out.

With likelihood as the final ranking criterion, the directional result changes. The restricted variant leads the broader one on all three exact-match cutoffs on the main test. This is compatible with a search in which additional options make final selection harder if the ranking score has trouble identifying a useful candidate. The comparison does not tell how many gains or losses came from any particular first-letter or internal rule. What it does show is that a larger search and a better result go together only for some configurations.

The timings show a practical benefit of the narrower procedure. A rule that is available anywhere can introduce alternatives at many positions in one input. Limiting that rule to the final letter reduces the opportunities for branching. The paper measures the runtime difference between the V1 and V2 distance-ranked procedures, although it does not report a separate count of the branches explored. The measured time and the accuracy results jointly describe how much the search restriction changes the procedure used in the study.

Window length and candidate cutoffs

The authors vary the length of substrings used for rules and favor shorter ones in the reported comparison. Their interpretation is that these pieces frequently correspond to what survives when an abbreviation compresses syllables. This is a plausible reason for short windows to transfer between words. The experiment establishes the usefulness of the shorter settings in this collection. The explanation about syllables is the authors’ interpretation of that performance, since the rule extractor operates on character spans.

The appendix also examines accuracy and inference time in relation to cutoffs. It reports cutoff settings of 100 for the DLD procedure and 30 for the likelihood procedure as giving the best tradeoff in that analysis. The method separately describes limiting the number of alternatives retained during generation. The figure captions use k for the maximum substring length, while the prose gives the larger cutoff values. The paper therefore discusses both substring length and search limits, but the notation around the plots leaves the exact association between every plotted axis and these settings unclear.

The settings address different sources of cost. A window-length decision changes which character correspondences the dictionary records and how broadly they might match. A candidate-retention decision limits the alternatives explored while assembling a word. An apparent loss of accuracy could arise because the relevant rule was unavailable or because the search discarded a useful path. The appendix’s runtime discussion shows that tuning for cost was part of the study, while the main V1–V2 timing result gives a directly named comparison tied to a concrete restriction.

What the training comparisons isolate

The Π consistency comparison gives the same underlying ByT5 approach another objective and shows gains across its reported measures on the selected test set. First-choice accuracy rises from 0.31 to 0.37, and the mean distance to the reference moves from 2.71 to 2.06. The improvement in the distance of the list matters because it is evidence about more than the top result. With consistency, the candidate set as a whole sits closer to the reference according to the metric used here.

The result is specific to the settings that were tuned. The RoBERTa-Tagalog variants have no exact matches on the selected test, even with the consistency objective or the autoencoding task. ByT5 with autoencoding likewise falls behind plain ByT5 in the reported normalization results. The paper thus offers evidence for a useful consistency objective in one comparison and sharply different outcomes for other combinations. The experiments do not disentangle which training or decoding details are responsible for the weaker comparisons.

The cross-validation measurements extend the consistency finding. The augmented ByT5 entry leads plain ByT5 for first-choice accuracy, and its mean distance is lower. The corresponding figures are 0.40 ± 0.06 and 0.32 ± 0.06 for first-choice accuracy, and 1.75 ± 0.07 and 2.31 ± 0.16 for mean distance. Giving the system a consistency objective is therefore associated with gains across both reported evaluation arrangements for ByT5. Its ability to match the rule method’s top-five mean in cross-validation shows that those gains can alter the comparison when more than one suggestion is allowed.

Diagnosing the failed first choices

The authors inspect the 23 failed first choices made by V1 with DLD on the main test. They divide the failures according to whether the intended correction existed in the candidate pool. There is an internal inconsistency in the wording of the nine-case group. Its heading and the reported ranks place the intended corrections in the pool, while a sentence in the description says they were absent. The matching accounts of the heading, the ranks and the separate 14-case group support reading the 9 cases as ranking failures with an available target.

For those 9 cases, the paper reports that the intended words ranked in the top 12.65% of candidates on average, with a median of 8.57%. Those percentages describe the location of the intended outputs within candidate pools. They are different from the proportion of test examples answered correctly. A word can be relatively high in a pool and still fail the first-choice test. The distance score in these cases preferred another spelling that resembled the abbreviated input.

The other 14 cases are described as missing their target in the candidate list because the dictionary lacked a rule needed for the correction. The authors add the missing rules and revisit the affected examples. The procedure then predicts all but five of them correctly. In those five, the target is now available but is still ranked below another choice. The intervention makes the separation between reachability and ordering especially clear. A rule can solve the first problem and leave the second intact.

Adding the rules with the benefit of seeing the errors tells the authors something about their causes. The exercise is a repair of the inspected examples, so it does not supply a new held-out accuracy estimate. Its value is that the normalizer exposes a specific place to look. An investigator can see whether the needed transformation is absent, whether a correction was filtered or whether the scoring method chose a different word. The paper’s diagnosis points to rule coverage and context-sensitive selection as distinct sources of improvement.

Limitations

Limits the authors identify

The authors first identify the size and domain of the data. The collection comes from comments on weather advisories and contains 398 retained abbreviated or contracted forms. It records evidence about how people wrote within that setting. Topics, purposes and groups of writers outside it could bring other abbreviations or different uses of familiar spellings. A collection spanning more settings could add corrections from which the procedure could learn a broader range of rules. This follows directly from the missing-rule errors observed on the selected test.

Vocabulary coverage is a related constraint. The authors propose a more complete Filipino word list that includes conjugated forms. Since the current filter keeps vocabulary hits whenever it finds any, a broader inventory of valid outputs could help keep correct forms available while still discarding implausible alternatives. The relevant resource is the vocabulary of whole candidates, which serves a different function from the rule dictionary. Improving the inventory can change what the algorithm retains even if every rule stays the same.

The authors also identify ranking as an incomplete part of the method. Distance from the input can misorder candidates with similar spellings, and a frequency for an isolated rule gives limited evidence about which word was intended. They suggest considering how common a candidate word is or using the nearby words to infer the correction. The error analysis motivates this proposal directly. Some correct candidates were already constructed and could be found relatively high in the pool, so the remaining problem was choosing the right one.

Context could also have a computational role in the authors’ account. If a contextual clue rules out some alternatives before edit-distance scoring, fewer distance calculations may be needed. The paper does not evaluate such a procedure, so the effect on accuracy and runtime remains open. Using context would also change the evidence available to the system, which currently takes the abbreviated word as its input. A context-aware evaluation would need examples that preserve the words around the abbreviation.

Finally, the authors evaluate correction for inputs that have already been identified as misspelled or abbreviated. They describe combining correction with detection as a possible practical extension. Detection would require deciding which words to pass to the normalizer in the first place. That decision matters because a system applied to ordinary comments encounters conventional forms as well as shortcuts. The reported accuracy covers recovery after selection of the input. It does not measure the quality of that selection.

Limits visible in the experimental setup

The main test was deliberately chosen to involve spelling rules represented in training. This makes it suitable for asking whether the algorithm can acquire and reapply a type of change. It gives less direct evidence about a new comment whose shortcut requires an unobserved rule. The error analysis shows that a needed rule could still be missing from the learned dictionary, even with the split designed around shared rules. Representation in the training examples and successful automatic extraction are separate conditions.

Cross-validation broadens the comparison across the collected words and gives a lower reported first-choice score for the rule-and-distance procedure. All the folds still draw from the same source collection. They cannot establish performance on comments from another domain or period. A study of new conventions would need a test that changes where or when the examples are collected. A study of previously unseen rule types would need a split organized around those types. Each design would ask a different question from the main experiment.

The annotation procedure also narrows the problem. Cases in which all annotators offered different corrections were excluded, and the retained collection is evaluated against recorded target forms. The 83.8% agreement figure shows there was room for disagreement in interpreting the shorthand. An exact-match evaluation can score an alternative expansion as an error even where another reader would consider it plausible. The paper’s scores consequently measure correspondence with the chosen references under its annotation procedure.

The comparison with Google Translate uses a different success criterion from the ranked-list evaluations. A valid translation or a correction suggestion can establish success under that check, but translation provides indirect evidence of which Filipino form was recovered. There is also no top-five list from Google Translate in the reported results. Its figure is best understood as the output of the study’s specific check for understanding an isolated shortcut. It cannot answer the same questions about candidate coverage or edit distances as the systems returning ranked words.

The sequence-to-sequence results concern the specific systems, training objectives and settings tested on this collection. They establish that the reported rule approach can win under small-data conditions, including for first choice in cross-validation. The design does not vary the amount of labeled training material across a range of collection sizes. The title’s emphasis on approximately how many examples were collected therefore speaks to feasibility at the studied scale. It leaves open where the ordering of approaches might change with different supervision or settings.

The runtime figures likewise belong to the reported implementations and hardware. Training a rule dictionary on a local CPU and adapting the sequence systems on a GPU are different workloads. The timings establish that fitting and rebuilding the dictionary was quick in the authors’ setup. The inference measurements establish that the choice between V1 and V2 mattered greatly there. They do not give workload measurements for running a complete correction and detection system on a stream of comments.

Some component effects are also hard to separate. Candidate construction, pruning, vocabulary filtering and final scoring can each determine whether the reference reaches a returned position. The paper compares selectors, positional restrictions and substring settings, and it inspects the presence of the target in failed cases. A separate measurement of the target’s survival after each stage would be needed to attribute losses across all of them. Vocabulary filtering in particular is part of the proposed method, but the reported results do not isolate what happens when the vocabulary is removed.

The rule dictionary gives access to the transformations the normalizer can apply. That access makes direct diagnosis possible in the cases the authors examine. The extracted rules are still products of local string comparisons, and the generation procedure can combine them in ways that require further checking. An inspectable rule record helps answer why a path was available or missing. Determining that a rule reflects an actual usage convention would require evidence beyond its presence in the dictionary.

The discussion of related patterns in Indonesian and Malay suggests possible transfer. The authors base that suggestion on similarities relevant to short character spans and syllables. Their data and reported evaluations are for Filipino, so the proposed extension remains an open empirical question. A different language would supply its own conventions for shortening words and its own vocabulary for filtering candidates. The method would have to be assessed with corrected examples from that setting.

What came after

There are no documented follow-up studies to discuss here. The paper closes with open questions about broader rule coverage, ranking with surrounding words and combining normalization with detection. Its experiments establish how the approach behaved on the Filipino collection and splits it tested. Whether later work adopted the rule extraction procedure, extended it to another language or evaluated it on new online text remains unestablished.

Cite

Cite as Lorenzo Jaime Flores and Dragomir Radev. 2022. Look Ma, Only 400 Samples! Revisiting the Effectiveness of Automatic N-Gram Rule Generation for Spelling Normalization in Filipino. Proceedings of the Third Workshop on Simple and Efficient Natural Language Processing (SustaiNLP).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2022.sustainlp-1.5

@inproceedings{flores2022look,
  title = {{Look Ma, Only 400 Samples! Revisiting the Effectiveness of Automatic N-Gram Rule Generation for Spelling Normalization in Filipino}},
  author = {Lorenzo Jaime Flores and Dragomir Radev},
  booktitle = {Proceedings of the Third Workshop on Simple and Efficient Natural Language Processing (SustaiNLP)},
  year = {2022},
  doi = {10.18653/v1/2022.sustainlp-1.5},
  url = {https://doi.org/10.18653/v1/2022.sustainlp-1.5}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/flores-2022-look-ma-only-400-samples/