Elamur Research

A Grammar Checker for Tagalog using LanguageTool

Paper · 2011 · Nathaniel Oco and Allan Borra

Summary

A Tagalog sentence can contain familiar words in a plausible order and still have a grammatical error. An adjective may disagree in number with the expression it describes, or a small linking word may be missing. To catch such problems, a checker needs to know more than whether the words exist. Nathaniel Oco and Allan Borra added Tagalog to LanguageTool, an open-source grammar and style checker that looks for manually specified error patterns. They wanted to make a checker available for a language with 22,000,000 native speakers in the estimate they cite and relatively few grammar-checking tools at the time. Tagalog’s extensive use of affixes made the design of the dictionary especially important.

The authors built a dictionary of nearly 8,000 entries from resources developed for earlier Tagalog research. Each entry connects a written form to a base form and a grammatical label. The tagset has 87 tags across 14 grammatical and lexical categories. Its labels also carry details such as the person and number of a pronoun, the focus and aspect of a verb, the number of an adjective, and the kind of word an adverb can modify. The authors compiled the dictionary into a binary finite-state representation using Morfologik. Separately, they wrote an XML rule file that tells LanguageTool which sequences of words, labels, or letter patterns to flag. The rules address wrong words, missing words, and certain word transpositions. Examples include repeated mga, number disagreement, and the choice of a linker or of din versus rin.

On a collection of 272 sentences, the checker achieved a reported precision of 91%, recall of 51%, and accuracy of 83%. It detected 42 of the 82 sentences with errors and correctly left 186 of the 190 error-free sentences unflagged. Its feedback was correct for 41 of the 42 erroneous sentences it detected. PanPam, an earlier Filipino grammar checker tested on the same collection, achieved 23% precision, 46% recall, and 38% accuracy. The clearest advantage for LanguageTool in this comparison was its handling of acceptable sentences.

A warning was typically warranted on this collection, while many erroneous sentences passed without one. The missed cases included problems involving flexible word order, transpositions of more than 2 words, extra words, and errors that required checking meaning. Incorrect dictionary entries also led to warnings on some acceptable input. The study shows how explicit rules can provide useful coverage even when a grammar checker handles only a selection of constructions. Tagalog support appeared in the August 07, 2011 LanguageTool snapshot.

Deep dive: A Grammar Checker for Tagalog using LanguageTool

Oco and Borra explain how they built a Tagalog grammar checker in LanguageTool and which errors its dictionary and rules could detect. · about 33 minutes to read

The problem and its context

Why checking the words is only part of the job

Consider an adjective and the expression it describes. A reader can judge whether their singular or plural forms fit together. A program told only that the sentence contains an adjective and a nominal expression has less information. It can identify the grammatical categories in both an acceptable example and an example with disagreement, yet receive the same sequence of categories for both. That is the practical difficulty behind the paper. The authors needed a representation that preserved the distinctions a rule would have to inspect.

Tagalog makes extensive use of changes to word forms. The grammatical descriptions cited by the authors discuss the combination of roots and affixes, and the paper’s agreement example draws attention to the repetition of a syllable in plural adjectives. The relevant distinction can therefore be visible inside a word even when the grammatical category and surrounding sequence stay the same. Other distinctions are visible at word boundaries. The paper illustrates a choice between forms of a short particle that depends on the ending of the preceding word. A checker needs access both to a word’s grammatical description and to the letters that actually appear. These are different kinds of evidence about a language’s morphology.

The authors also describe a practical gap. Tagalog is the basis for Filipino, which the paper identifies as the official language of the Philippines, and the authors cite earlier work describing a limited selection of Tagalog grammar checkers. LanguageTool already supplied the machinery for applying rules and displaying feedback, with standalone use and integration into OpenOffice.Org and LibreOffice. Adding language-specific resources could put a Tagalog checker into that existing software. The work therefore had a concrete deliverable alongside its linguistic question. The authors could test how far the available rule notation went while also making the resulting checker available through an established program for grammatical error correction.

Earlier checkers and the role of parsing

The paper describes earlier systems concerned with both structure and meaning. Ang and colleagues developed an analyzer that could examine semantic relationships in a Tagalog sentence. Jasa and colleagues, and Dimalen and Dimalen, developed Filipino grammar-checking extensions for OpenOffice.Org Writer. In the account given by Oco and Borra, the latter projects used a syntactic parser for error checking. A parser attempts to assign a grammatical structure to the input. A checker built around its success can take a successful analysis as a sign that the input is acceptable and a failure as a sign of an error. The judgment therefore depends on the grammar available to the parser.

A parser-driven checker faces a coverage problem. A grammatical construction needs to be represented for the parser to recognize it, and the checker also depends on the grammar to distinguish acceptable constructions from erroneous ones. The authors cite Naber’s discussion of the need for a complete grammar in this kind of checker. The concern matters for a language whose forms and combinations have to be encoded explicitly. A judgment based on successful analysis carries assumptions about what the grammar accepts, just as a judgment based on failed analysis carries assumptions about what the grammar ought to recognize.

LanguageTool starts with a different question. Its rules look for evidence of a particular problem. If the checker finds a sequence that meets a rule’s conditions, it can display the message written for that sequence. A sentence can pass through the checker without the program having assigned it a complete grammatical structure. The linguistic commitment is made locally in the rule, in the form of an assertion that a specified pattern warrants attention. This makes it possible to add coverage construction by construction. It also gives the absence of a warning a particular meaning. The checker has found no reason to intervene among the patterns it knows how to recognize.

That distinction helps explain the design challenge. LanguageTool makes it possible to build a checker without first encoding an entire grammar, but it still needs a way to distinguish forms that a rule treats differently. Earlier Tagalog work offered inventories of grammatical labels and examples of tagged text. Reference grammars offered descriptions of such phenomena as affixation, case, and the behavior of modifiers. The authors combined these resources to handle the needs of checking. A label that suffices to identify a verb in a tagged sentence may need to carry more information before a rule can ask what role that verb form assigns to the subject. The choice of what to encode is part of the design of part-of-speech tagging.

The project consequently involved more than expressing existing descriptions in XML. It required deciding which grammatical distinctions should be available at lookup time, which properties a rule could read directly from the word’s spelling, and which combinations supplied enough evidence for feedback. A dictionary and a rule can be individually plausible and still work poorly together if the dictionary offers a reading that is inappropriate in the sentence where the rule fires. The paper’s examples make that interaction visible because both the lexical analysis and the error pattern are explicit.

The method, step by step

From text to a warning

LanguageTool divides the input into sentences and breaks each sentence into words for matching. The units a rule inspects are called tokens. A rule may ask for the spelling of a token, a grammatical tag supplied by dictionary lookup, or both. These conditions can refer to successive tokens, so a match depends on which units are next to each other and on their order. The initial boundaries matter because a rule can also refer to positions such as the start of a sentence. Preparing those units is the role of tokenization.

For a reader new to grammar checking, it helps to separate the two resources by the questions they answer. The dictionary asks what a particular written form could be. It can supply a grammatical category and any features the tagset records for that category. A rule asks whether the tokens and their descriptions form a known error pattern in this context. The feedback attached to the rule tells the reader what the checker noticed. If the rule includes a suggested edit, the same match also determines where the edit belongs.

The word-repetition example shows these roles at their simplest. A rule can look directly for consecutive instances of mga. For this pattern, the written forms already give the rule the information it needs. An agreement rule has a different job. It must know that a word belongs to an appropriate grammatical category and must also be able to read the relevant number feature. Some rules therefore make substantial use of the dictionary, while others can operate on the spellings alone. LanguageTool provides a common matching procedure for both.

How LanguageTool checks Tagalog text

The steps in order.

How LanguageTool checks Tagalog textStep 1: Split input into sentences1. Split input into sentencesStep 2: Split sentences into tokens2. Split sentences into tokensStep 3: Look up forms in the Tagalog dictionary3. Look up forms in the Tagalog dictionaryStep 4: Read grammatical labels and features4. Read grammatical labels and featuresStep 5: Match tokens against XML error patterns5. Match tokens against XML error patternsStep 6: Flag matching spans and show feedback6. Flag matching spans and show feedbackStep 7: Offer a correction when the rule supplies one7. Offer a correction when the rule supplies one

The authors’ contribution concerns the Tagalog data that drives this procedure. The matcher was already part of LanguageTool. For the extension, the authors specified the forms and grammatical distinctions that the matcher could see, then wrote conditions that would turn some combinations into warnings. The process is easiest to follow by looking first at a dictionary entry, then at the rule that can use it.

What the dictionary records

The first field of a Tagalog dictionary entry holds the written inflected form, which may include a ligature. A ligature is a linking element that can join words in a construction such as an adjective followed by a noun. Some ligatures appear attached to the preceding word. The second field serves as the base form. The authors describe deriving it by removing the ligature where present. A form can therefore look the same in both fields. In particular, “base form” in this dictionary does not require reducing every inflected form to its grammatical root.

The examples make that convention concrete. Doktor appears as doktor in both fields, and kumakain appears as kumakain in both. The latter keeps its grammatical information in the tag field, which gives it actor focus and the aspect the paper calls incompleted. The dictionary can retain the form that occurred and still represent its grammatical properties separately. That separation is important when a rule needs to inspect the spelling itself, including the case where a linker is present on the written word form.

The third field gives the tag. For categories that carry attributes, this field contains the category code and the relevant values, separated by spaces. For example, ako is entered with PANP ST S. The first code places it among the ang pronouns, ST marks the speaker’s grammatical person, and S marks singular number. The combined label gives a rule access to all of those distinctions without requiring the rule to name ako as an individual word. By contrast, the example entries for mga and hoy use a category code without the extra features that appear on pronouns and verbs.

The dictionary was assembled using evaluation and test data from previous Tagalog work by Bonus, Cheng and Rabo, and Miguel and Roxas. The authors report almost 8,000 word declarations. This count describes the entries they had available to the tagger. It does not specify how many roots were represented, how many grammatical constructions could be checked, or how frequently the forms would appear in new documents. A single grammatical construction can draw on many entries, while multiple declarations can supply different analyses of a single written form.

LanguageTool could use a plain-text dictionary, a dictionary file, or a dictionary encoded as a finite-state automaton. The authors used Morfologik to build the binary automata. Here the automaton is a representation of a dictionary used for recognizing listed forms and retrieving their descriptions. The paper describes a construction process based on assembling entries and compiling them for lookup. It does not give a procedure for estimating the entries from the checker’s evaluation sentences, and compiling them does not establish that a listed reading is the appropriate one in every context.

How the tagset serves the rules

The authors adapted the tagset from work by Rabo and Cheng and the later changes by Miguel and Roxas. Their choices also drew on grammatical accounts of affixes, the Tagalog case system, verb focus and aspect, and the major word classes. The resulting inventory has 87 tags from 14 grammatical and lexical categories. The extra attributes have a specific purpose. They expose properties a rule may need in order to distinguish a grammatical combination from a superficially similar error.

For nouns, the tagset distinguishes proper nouns, common nouns, and abbreviations. The paper connects the proper and common noun distinction to the choice of determiners. A determiner is a form used with a nominal expression, and the grammatical descriptions cited by the authors say that the available choices differ to a degree between these kinds of nouns. With NPRO and NCOM available, a rule can state which class of noun its condition concerns. The distinction can work across several words without treating their spelling as the reason they belong together.

Pronouns carry both a grammatical family and features for person and number. The tagset distinguishes pronouns and demonstratives grouped under ang, ng, and sa, alongside other categories such as interrogative and indefinite pronouns. Person indicates whether a form refers to the speaker, the addressee, or another participant, with a null value available in the inventory. Number distinguishes singular, plural, and forms recorded as compatible with both. These details let a rule ask a narrower question than whether a token is a pronoun. They also allow the dictionary to express when a feature is inapplicable or when the form is compatible with more than one number.

Verb tags record focus and aspect. Focus, in the authors’ account, can indicate the role of the participant treated as the subject. The inventory separates actor, object or goal, beneficiary, location, and instrument focus, with another category for remaining cases. These labels tell a rule what kind of relationship the verb form makes available for checking. They say something different from aspect, which describes how the action is presented. The aspect inventory includes neutral, completed, incompleted, contemplated, and recently completed forms, along with an other category. Thus VACF IN on kumakain identifies an actor-focus form and supplies an aspect value at the same time.

The distinction between exposing a feature and using it in a particular check matters here. The authors describe verb focus as useful for future work because of its connection to the role of the subject. Its presence in the dictionary establishes that the representation can carry that information. It does not establish that the implemented rule file checks all relevant combinations of focus and participants. The same distinction applies to other features. The dictionary makes a condition possible to express, and an implemented rule determines when the condition has a visible effect.

Adjectives carry a category and a number value. The inventory distinguishes, among others, ordinary modifiers, comparatives, superlatives, numeral adjectives, and unaffixated adjectives. The number values are singular, plural, and null. This is the feature most directly motivated by the paper’s agreement example. Both the acceptable and unacceptable sentences exhibit the same broad categories. The checker can represent the difference once the adjective’s number is available. The grammatical account the authors cite identifies repetition of the first syllable as a way of marking adjective plurality. A dictionary declaration makes that information available to the matcher without requiring a rule to rediscover the morphological analysis from the spelling each time.

The adverb inventory combines categories such as manner, frequency, and comparison with a feature indicating what a form can modify. The possible targets include verbs, adjectives, and other adverbs. A further value covers forms usable with all those targets. This information gives a rule a way to tell apart two words with the same broad category if they are licensed with different kinds of expressions. Conjunctions, determiners, prepositions, ligatures, and several other categories are represented as well. The authors do not give those classes extra attributes of the kind used for adjectives, adverbs, pronouns, and verbs.

The tagset is therefore best understood through the decisions a checker can make with it. Some labels distinguish classes of words that take different determiners. Some carry agreement features. Others represent distinctions in use that could support future checks. The inventory describes the interface between lexical information and the matcher. The evaluation, by contrast, measures the behavior of the dictionary and rules together.

How a rule turns evidence into feedback

The rule file is written in XML and organized into categories, which may contain individual rules or groups of rules. LanguageTool’s rule notation can be used for spelling, grammar, style, and punctuation. The Tagalog rules draw on grammatical descriptions by Ramos, Cubar and Cubar, Cena and Ramos, Otanes and Schachter, and Kroeger. Those works supplied descriptions of the forms and combinations the authors wanted to check. The authors then had to express the relevant conditions in terms of the evidence LanguageTool receives.

Each rule has a pattern, a message, and examples. The pattern defines the token sequence that triggers a warning. The message gives the explanation and can contain a proposed replacement. The examples record an erroneous instance and a correct one. Readers of the rule can see both the expression it should pick up and the construction the authors regard as acceptable. When the matcher finds the pattern in the input, LanguageTool marks the affected text and displays the corresponding message. It can also display the replacement when one is supplied.

A token condition can specify a literal word or ask for a grammatical tag. Successive conditions can combine the two. The paper illustrates this with a generic pattern in which a base-form verb tag is followed by the literal word house. A rule can also test a condition in reverse, as in the generic example where cause is followed by a token other than and or to. A start-of-sentence tag lets a rule recognize a word only in the initial position. These examples describe the possibilities of the notation. The Tagalog rules use those possibilities to express their language-specific conditions. Matching is case insensitive by default, and the displayed repetition rule explicitly uses that setting.

Regular expressions allow a token condition to describe a family of spellings. In the paper’s particle examples, a question mark after g makes that letter optional, so ding? matches din and ding, while ring? matches rin and ring. A character list at the end of a pattern can test whether the final letter belongs to the vowel or consonant set shown by the authors. The dot and asterisk allow material before that last letter. Using one spelling condition for a family of forms keeps a rule from having to repeat the same test for every word with that ending.

The repetition rule inspects two successive tokens and looks for mga in both positions. Its example edits mga mga to ang mga. The suggestion is written using a reference to the second matched token, so that the rule inserts ang and retains that occurrence of mga. A warning can consequently do more than identify generic repetition. It can propose the repair intended for the specific sequence the rule recognizes. This example also shows why literal matching is enough for some checks. The sequence itself carries the evidence on which this warning depends.

A rule’s precision of expression and the accuracy of the judgment it produces are separate questions. The notation can specify an exact token sequence, yet the grammatical claim attached to that sequence can still be too broad. Similarly, a tag-based rule may be well motivated given the readings it asks for, but receive an unsuitable reading from the dictionary. The authors’ design makes these conditions open to inspection. The evaluation then reveals whether the conditions are dependable on sentences that actually reach the matcher.

Wrong forms, missing material, and changes in order

The authors group errors by the kind of change the sentence calls for. A wrong-word error can leave the broad sequence of parts of speech intact. A different determiner, an unsuitable affix, or a form that fails to agree may occupy a position where a word of that class is otherwise legitimate. The diagnostic question is therefore whether the particular form fits the environment. The check can use a feature such as number, a spelling property such as the preceding word’s final letter, or knowledge of which token is present.

For adjective agreement, the paper points to the number of the nominative argument and the number of the adjective or predicate. The nominative argument is the sentence participant whose grammatical status is relevant to the agreement discussed in the paper. If the adjective carries the wrong number for that participant, a sequence expressed only with broad word classes provides no direct signal of the mismatch. The added number feature makes the mismatch expressible in a rule. The example explains the reason to encode number even though both constructions can be described with the same parts of speech.

The din and rin example uses a property that can be read from the spelling. Both are forms of an enclitic, a short element whose use here depends on the preceding word. In the environment described by the paper, din follows a consonant and rin appears in the other case. The preceding token’s final letter and the spelling of the enclitic are the evidence the rule needs. The paper uses this example to show how a sound and letter change can cross a word boundary. It also shows why some linguistic detail can go directly into a spelling pattern without adding a special attribute to the tagset.

The ligature examples give a similar role to the word ending, with the grammatical relationship between the words supplying additional context. After a vowel, the examples attach -ng, as in matalinong bata. After final n, they attach -g, as in matuling bata. The paper illustrates separate na after a consonant with matapang and bata. Reading the final letter helps choose the appropriate form once the checker has reason to expect a ligature. Establishing that expectation is a separate question. The rule has to recognize a construction in which the words ought to be linked.

For missing words, the authors start from a sequence that is unusual because of what is absent. Omitted items include determiners, markers, and particles. The illustrated case concerns a pronoun immediately followed by an adjective in a construction where the authors expect the marker ay. A rule can recognize the relevant sequence and suggest inserting the marker. In this design, the input does not need to contain an explicit representation of an empty slot. The adjacent words provide the evidence that a missing item may belong between them.

An unfamiliar sequence can also arise from words having been moved. The paper describes using the tokens and tags around the unexpected sequence to help distinguish a transposition from an omission. The classification sketch starts by asking whether the observed sequence of grammatical categories can occur. When that sequence is plausible, a problem with the selected word is one possibility. When the sequence is unusual, the surrounding categories can support an account in which material is missing or in which existing words are out of order. The sketch describes the authors’ approach to organizing the rules. The checker still relies on specific patterns that identify contexts for the proposed diagnosis.

These error families demand different amounts of context. Adjacent repetitions can supply enough evidence by themselves. A rule for omission needs a configuration in which the missing item is predictable. A transposition may require enough surrounding material to establish where the words belong. The more possible arrangements a construction allows, the more carefully a local pattern has to be specified before a warning or correction is justified. The architecture gives all of these checks the same form of output, but the linguistic inference behind them differs.

How the evaluation measures a match

The authors measure performance at the sentence level. The positive decision is a warning on a sentence, and the reference judgment is whether the sentence actually contains an error. The paper gives formulas for precision, recall, and accuracy. Each looks at a different set of decisions.

Precision = TP ÷ (TP + FP)

TP is the number of true positives, or erroneous evaluation sentences correctly flagged. FP is the number of false positives, or error-free sentences that drew a warning. The plus sign groups all warned sentences in the denominator, and the division sign gives the share for which a warning was warranted. The paper reports that share as a percentage. A sentence can count as a true positive even when the warning gives the wrong explanation, which the authors examine separately.

Recall = TP ÷ (TP + FN)

TP again counts correctly flagged erroneous sentences. FN counts false negatives, which are erroneous sentences the checker leaves unflagged. The sum in parentheses is the set of sentences that contain errors, and division gives the share the checker detected. Recall is reported as a percentage of the erroneous sentences in the evaluation collection.

Accuracy = (TP + TN) ÷ (TP + FP + TN + FN)

TP counts correctly flagged erroneous sentences and TN counts true negatives, the error-free sentences correctly left unflagged. FP counts acceptable sentences that drew a warning, and FN counts missed erroneous sentences. The plus signs in the numerator combine the correct judgments. The plus signs in the denominator combine all the outcomes, and division gives the share of evaluation sentences classified correctly. The paper expresses that share as a percentage. This measure gives credit both for detecting errors and for letting acceptable sentences pass.

Experiments and results

The sentence collection and the comparison

The authors evaluated the checker on 272 sentences. Of these, 190 were error-free and 82 contained errors. The collection drew on evaluation material associated with FiSSAn, LEFT, and PanPam. It also included test material used by Dimalen, examples from the grammatical works of Kroeger and Ramos, and additional test data. This combined material gave the authors previously used examples and examples grounded in published descriptions of Tagalog grammar. The results are reported for the collection as a whole.

The paper describes the test as an initial evaluation. Its unit is the individual sentence. For a sentence containing an error, a warning counts towards detection. For an acceptable sentence, a warning counts against the checker. The authors then ask an additional question for the erroneous sentences that were caught. They examine whether the message or suggested repair was actually appropriate. Someone using the checker encounters these as successive judgments. A useful warning has to draw attention to a genuine problem and then say something that makes sense for that problem.

PanPam is the comparison system. The authors ran it on the same collection, so both sets of results concern the same 190 acceptable and 82 erroneous sentences. Some material in the collection came from evaluation data used by PanPam, and the paper gives aggregate scores for the combined set. The comparison is therefore between two systems on a shared set of inputs. It does not assign either system’s behavior to a particular source within the collection.

How often a warning was warranted

LanguageTool’s reported precision on the sentence collection was 91%. It flagged 42 erroneous sentences and also flagged 4 error-free ones. These counts show what the precision means for the warnings produced in this test. Most corresponded to a sentence that did contain a problem. Whether the message correctly diagnosed it is a separate result.

PanPam’s reported precision was 23% on the same collection. Its count of correctly flagged erroneous sentences was 38, and it raised warnings on 122 error-free sentences. It caught a substantial set of erroneous cases but also gave warnings on many acceptable inputs. The contrast in precision follows from the make-up of the warnings produced by each checker. The counts show that the main separation was in how often a warning fell on acceptable text.

Tagalog LanguageTool and PanPam on the sentence collection, precision

A larger share of LanguageTool's warnings were on erroneous sentences.

Tagalog LanguageTool and PanPam on the sentence collection, precisionPanPam: 23PanPam23Tagalog LanguageTool (this paper): 91Tagalog LanguageTool (this paper)91
The numbers
System or settingprecision %
PanPam23
Tagalog LanguageTool (this paper)91

Precision answers a practical question about whether to take an alert seriously. It describes the mix of correct and incorrect warnings among those the system produces. It cannot show how many errors the user will encounter without a warning. The large separation in precision is therefore compatible with the much closer recall scores reported by the authors.

How often the checker found an error

On the 82 erroneous sentences, LanguageTool warned on 42 and passed over 40. Its reported recall was 51%. PanPam warned on 38 erroneous sentences and passed over 44, receiving a reported recall of 46%. LanguageTool led on this measure, but both systems missed a substantial share of the errors in the collection. A user relying on silence as a sign of grammatical acceptability would have reason to be cautious with either system on this material.

Tagalog LanguageTool and PanPam on the sentence collection, recall

LanguageTool detected more erroneous sentences, and both checkers missed many.

Tagalog LanguageTool and PanPam on the sentence collection, recallPanPam: 46PanPam46Tagalog LanguageTool (this paper): 51Tagalog LanguageTool (this paper)51
The numbers
System or settingrecall %
PanPam46
Tagalog LanguageTool (this paper)51

The distinction between the two measures follows from how the rules work. To reach an erroneous sentence, a LanguageTool rule must have been written for a recognizable form of the problem, and the sentence must supply the tokens and features the rule expects. An error in a construction outside those rules does not contribute to recall. At the same time, a checker can keep precision high when its existing rules generally fire only in appropriate contexts. The reported scores describe that combination on the evaluation collection. They do not determine whether the remaining errors would be easy to cover while preserving the reliability of the current warnings.

The follow-up analysis identifies several kinds of problems among the misses. Some concerned flexible word order or the transposition of more than 2 words. Others involved extra words or relationships that could only be judged by considering meaning. These examples help explain the reach of the implemented rules. The omissions and limited transpositions that can be recognized through a specific local context are a narrower target than all the structures or interpretations a reader may find unacceptable.

Correct decisions across the collection

LanguageTool correctly left 186 of the 190 error-free sentences unflagged. Together with its correct detections, the results table gives 228 correctly classified sentences among the 272 tested and a reported accuracy of 83%. PanPam correctly left 68 of the 190 error-free sentences unflagged. Its table gives 106 correct judgments overall, and the paper reports 38% accuracy.

Tagalog LanguageTool and PanPam on the sentence collection, accuracy

LanguageTool made more correct decisions across the full collection.

Tagalog LanguageTool and PanPam on the sentence collection, accuracyPanPam: 38PanPam38Tagalog LanguageTool (this paper): 83Tagalog LanguageTool (this paper)83
The numbers
System or settingaccuracy %
PanPam38
Tagalog LanguageTool (this paper)83

Accuracy reflects the particular balance of the collection. Here, error-free sentences outnumber erroneous ones. Correctly leaving the acceptable examples alone has a large influence on the overall result. The separate counts show which decisions produced that advantage. LanguageTool’s detection of erroneous sentences was closer to PanPam’s than its handling of error-free sentences was. Reading accuracy alongside precision and recall preserves this distinction.

The authors relate the pattern of results to Konchady’s discussion of manually written rules, which can yield dependable matches without covering the variety of ways a sentence can go wrong. Their observation is consistent with the cases they found. Many implemented patterns behaved as intended, and some classes of error lay outside the rule file. The reported scores apply to that particular set of resources, on that particular collection. The comparison with PanPam supplies context for the scores without determining how another checker built around different resources would behave.

When the warning gave the right advice

The authors judged the feedback correct in 41 of the 42 erroneous sentences that LanguageTool correctly flagged. This count is conditional on detection. It tells the reader what happened once a genuinely erroneous sentence had triggered a warning. It leaves the 40 undetected erroneous sentences outside the set being judged for feedback. An editing application depends on both stages, since feedback can help only where a warning reaches the relevant input.

The exception shows the difference between identifying a suspicious position and diagnosing the problem that put a word there. The sentence came from a test of flexible word order and contained a transposition involving several words. The checker noticed ang at the end. Because the determiner should not occupy that position, the rule diagnosed an omission and treated the sentence as though a final word were missing. The warning was on an erroneous sentence and so counted as a detection. The proposed account of the problem was nevertheless wrong, because the intended repair involved rearrangement.

This example gives the feedback count a concrete interpretation. A local condition can reliably identify something unusual while leaving open several explanations for why it occurred. A message written for only one of those explanations will fit only some of the cases that satisfy the condition. The authors’ decision to examine the feedback separately exposes that difference, which the headline precision, recall, and accuracy figures do not measure.

What the ablations show

The paper presents no ablation experiments and instead offers a same-collection comparison with PanPam and an analysis of false alarms, missed errors, and incorrect feedback.

What the examples establish about the tagset

The adjective agreement example explains why the authors needed richer tags. With broad parts of speech alone, the relevant representations of the acceptable and unacceptable sequences coincide. Marking adjective number creates a distinction a rule can inspect. This is an argument about the information a feature preserves, grounded in the example. The paper does not run the full checker with and without adjective number, so the example supplies no estimate of how often that feature changed a result across the collection.

The spelling-based particle check illustrates the complementary case. The choice between din and rin in the described environment can be formulated using the preceding word’s last letter. A broad grammatical description may be adequate for locating the suspected particle, while the decisive property belongs to the surface form. The authors show that a matcher using both types of evidence can express different kinds of conditions. They do not compare versions limited to words, tags, or regular expressions, so the scores cannot be divided among those sources of information.

The comparison with PanPam has the strength of a shared evaluation set. That makes it possible to say where the outputs differed on the collection. The largest practical difference was in how often an acceptable sentence drew an alert. A comparison between complete systems cannot show what would happen if the Tagalog dictionary, individual features, or particular rules were exchanged or removed. Those components jointly determine the opportunities each system has to find and flag a pattern.

How a dictionary entry can create a false alarm

The authors attribute most of the 4 warnings on error-free sentences to incorrect dictionary declarations. They describe a case in which mag-aral was listed as a noun and maingay could be read as either an adverb or an adjective. A rule looking for an adjective before a common noun could then find a sequence that appeared to require a ligature. The alert was understandable given those readings. In the actual sentence, the authors judge the warning unwarranted.

This case shows how a rule can apply its intended grammatical reasoning to the wrong analysis. A missing-linker condition can be appropriate for the intended adjective and noun construction while producing a false alarm when the dictionary makes unrelated tokens look like that construction. The authors’ account ties the warning to concrete declarations and an identifiable rule condition. It offers evidence about the cause of that false alarm without establishing how many dictionary changes would be needed to fix the wider class of errors.

The adverb and adjective readings also show why multiple possible labels matter for evaluation. A dictionary can capture the fact that a spelling has more than one grammatical use. A rule that sees an allowed label still needs conditions that identify the use relevant to the sentence. In this example, the existence of an adjective reading and a noun declaration was enough to make the rule’s local evidence misleading. The case is about the interaction between available readings and rule conditions, an issue that the overall score alone would leave hidden.

How a sentence boundary changes the rule’s input

The authors give an ellipsis as another source of an incorrect warning. In that case the checker treated material belonging to separate sentences as a single sentence. They relate the boundary problem to the lack of a declaration for the ellipsis in the rule file. Consequently the matcher received a sequence organized differently from the one a reader would expect.

A sentence-level rule depends on the boundaries given to it. When the input is grouped incorrectly, words that come from separate sentences may become available to a check as though they belong to a single construction. Positions such as sentence start and end can also change. The ellipsis example therefore concerns the conditions under which grammar rules operate. Adding coverage for grammatical constructions alone would leave this source of misanalysis intact unless the sentence boundary were also handled.

What a detected symptom can hide

The missed sentences and the incorrect ang warning point to different limits. For many of the misses, the authors identify errors that the available patterns did not handle, including wider reorderings and sentences requiring semantic judgment. For the ang example, the system did have a pattern that recognized an unusual local outcome. That pattern reached the sentence and still did not identify the repair it needed.

These cases show why broader detection and better diagnosis are distinct outcomes. Adding a warning for a terminal determiner can help recognize certain omissions, yet a rearranged sentence may also end with that determiner. Detecting the position is evidence of a possible problem. Selecting the appropriate repair requires enough context to decide how the position arose. The analysis makes that ambiguity visible, though it gives no controlled estimate of how frequently a different context window or a different rule would resolve it.

Limitations

Limits identified by the authors

The authors explicitly tie coverage to the dictionary and rule file. If a pattern is absent or the lexical information needed to match it is unavailable, LanguageTool can let the error through. Building support involved the time-consuming work of creating the tagset, assembling dictionary declarations, and writing rules for Tagalog phenomena. The paper shows how those resources make a checker possible and describes several places where the first implementation remained incomplete.

Among those places is flexible word order. A local sequence that looks unexpected may result from an omission, a relatively simple transposition, or a more extensive rearrangement. The implemented rules handle certain cases, while the authors identify free-word-order problems and transpositions of more than 2 words among the misses. Their example of incorrect feedback shows what happens when a rule identifies a suspicious ending without recognizing the wider arrangement. A practical limit here is the amount of context the rules actually use and the number of arrangements they explicitly cover.

The authors also name extra words as an uncovered kind of error in the analysis of misses. The repetition rule illustrates why this observation has to be read at the level of specific constructions. LanguageTool can flag a known duplicated token such as mga. An arbitrary unwanted word is harder to identify from its presence alone. It may be a legitimate word with a legitimate tag, and its neighbors can each be individually plausible. A rule needs a recognizable condition that makes that item superfluous in the particular sentence. Coverage of a known repetition therefore leaves open the broader problem of identifying unwanted material.

Some erroneous examples require examining relationships in meaning. The paper distinguishes these from the local combinations the Tagalog rules were designed to recognize and identifies semantic checking as an area for future work. A pattern can determine that words and grammatical tags appear in a familiar order. It may still lack the information needed to assess whether the participants and actions make sense together. This is a limit of the implemented checks as evaluated, even though earlier work discussed in the paper had explored semantic analysis for Tagalog.

The authors also show that acceptable input can be mishandled for reasons outside the grammatical generalization the rule was intended to encode. An unsuitable dictionary entry can make a sentence look like an example of missing linkage. A missed ellipsis boundary can put tokens into the wrong sentence for purposes of matching. These are stated problems in the system examined by the paper, alongside the narrower problem of incomplete rule coverage. The quality of the warnings depends on the representations supplied to the rules as well as on the conditions they express.

Limits of the evidence from the experiment

The reported metrics describe a compiled collection of existing evaluation material, grammatical examples, and added test sentences. The study does not establish that the collection matches the distribution of errors in ordinary Tagalog documents. The proportion of acceptable input, the prevalence of each construction, and the variety of word forms can affect what a checker appears to do well. On a collection where warnings are concentrated in a different range of constructions, the chances that a warning is correct or that an error gets caught could differ. The paper provides no scores for other distributions of sentences.

The paper also reports no separate results for the different sources in the collection. A reader can see where the sentences came from and how the checker performed overall. There is no breakdown showing, for example, whether it caught errors in the examples from grammar books more readily than errors from earlier checker evaluations. The dictionary drew on previous Tagalog data, and the rules drew on grammatical descriptions, some of the kinds of resources also represented in the evaluation. The study does not document the separation between resource development and evaluation in enough detail to determine how unfamiliar every tested form or construction was to the authors when they built the checker.

The sentence-level unit limits what can be concluded about correction. A sentence contributes a correct detection once an error-bearing input draws a warning. That judgment does not account for every error the sentence might contain or every warning produced for it. The conditional feedback count adds information about the author-judged correctness of the advice on detected erroneous sentences. It provides a narrower view than a full account of editing quality across the evaluation collection. The wrong explanation for sentence-final ang is a reminder that a correct decision to warn and a correct analysis of the error can come apart.

The comparison with PanPam establishes an ordering on the reported measures for the shared collection. It cannot isolate the reason for that ordering. The systems bring different dictionaries, grammatical assumptions, and checking procedures to the inputs. Differences in the kind of evidence they require before issuing a warning may help explain the observed behavior, but the experiment does not vary that choice while holding the other components fixed. In particular, the results give no measured contribution for the finite-state dictionary representation, the number of tags, the individual grammatical features, or the use of regular expressions.

There is a small inconsistency in how the paper describes the missed sentences. The main results table records 40 misses among 82 erroneous sentences, with 42 correctly flagged. A later sentence in the error analysis gives 42 as the denominator for the misses, even though the paper also uses 42 for the detections. The counts in the main table support reading the 40 misses against the full erroneous set of 82. The later discussion is useful for describing types of missed errors, while the table supplies the reference counts for interpreting the reported recall.

Finally, the examples establish expressibility for selected phenomena. A spelling condition can distinguish the particle forms in the illustrated environment, and a grammatical feature can represent the number distinction that an agreement rule needs. Those demonstrations remain narrower than a claim about all Tagalog constructions involving particles, agreement, or word order. The study’s reach is the combination it tests openly. A set of explicit patterns could produce a high share of warranted warnings on the sentence collection while leaving much of error coverage to future work.

What came after

Flores and colleagues’ later citing paper moves from Tagalog grammar checking to Filipino spelling normalization. Its stated subject is the effectiveness of generating spelling rules automatically with n-grams. An n-gram is a sequence of consecutive units. The title does not specify what units the later paper uses, but it identifies recurring sequences as the basis for the rules under study. Oco and Borra describe a human-authored rule file, with patterns drawn from grammatical accounts. The later work makes the source of the rules itself a subject of investigation. Look Ma, Only 400 Samples! Revisiting the Effectiveness of Automatic N-Gram Rule Generation for Spelling Normalization in Filipino

The connection is clearest where spelling carries evidence for an edit. Oco and Borra’s particle rule uses the written ending of one token to help judge the form of the following token. Their ligature examples likewise give the last letter of a word a role in selecting the appropriate written form. The checker places those conditions in grammatical contexts. The later paper’s title identifies a related interest in local sequences and a different target, spelling normalization. Normalization concerns which written form to use, while the grammar checker also asks questions about relationships among words, such as whether an adjective agrees with the expression it describes.

The citation connects two ways of investigating explicit rules for Philippine-language text. Oco and Borra show the work involved in choosing dictionary distinctions and translating grammatical descriptions into patterns. The later paper revisits automatic generation for a narrower kind of editing task. Its title and citation establish that connection without establishing reuse of the Tagalog dictionary, the XML rule file, or the sentence collection. The question carried forward is how to obtain rules that cover useful editing cases and how to evaluate them on the task for which they were designed.

Cite

Cite as Nathaniel Oco and Allan Borra. 2011. A Grammar Checker for Tagalog using LanguageTool. Proceedings of the 9th Workshop on Asian Language Resources.

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

@inproceedings{oco2011grammar,
  title = {{A Grammar Checker for Tagalog using LanguageTool}},
  author = {Nathaniel Oco and Allan Borra},
  booktitle = {Proceedings of the 9th Workshop on Asian Language Resources},
  year = {2011},
  url = {https://aclanthology.org/W11-3402/}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/oco-2011-grammar-checker-tagalog-languagetool/