The Grammar and Syntax Based Corpus Analysis Tool For The Ukrainian Language
Paper · 2023 · Daria Stetsenko and Inez Okulska
Summary
Two news articles can report the same event and still differ in how they tell it. One might put a statement in direct speech, while the other folds it into the reporter’s account. The distinction can matter to someone studying writing style, but finding comparable differences across a collection takes more than reading individual articles. The authors present StyloMetrix, an open-source Python package that uses hand-written rules to measure such differences. Originally developed for Polish and subsequently extended to English, the package gains a Ukrainian version in this paper. The authors describe it as the first Ukrainian tool they know of to offer this combination of grammatical, syntactic and lexical measurements.
StyloMetrix starts with spaCy’s Ukrainian pipeline, which divides a text into tokens, assigns grammatical labels and identifies relationships between words. The authors add rules for features such as noun declension, verb tense and parataxis, a way of attaching clauses or other units without making one an ordinary grammatical dependent of the other. A feature score generally expresses the share of a text’s tokens selected by the corresponding rule. The package can process an input as short as a sentence and export a CSV file with a row for each text and a column for each metric. The authors report 104 Ukrainian metrics.
The quality of a count depends on the quality of the decisions behind it. spaCy sometimes misidentifies case, animacy, aspect, gender or part of speech. The authors give the example of Ілля, a masculine given name that the pipeline marks as feminine. They found the labels for relationships between words more dependable and drew on them when writing rules. In an assessment by a linguist, the reported accuracy was 0.957 for part-of-speech metrics, 0.934 weighted accuracy for lexical metrics, 0.912 for grammatical metrics and 0.886 for syntactic metrics. The widest constructions were among the harder cases. The authors also identify memory and access to a GPU as practical considerations for running the package.
The case study uses text classification to predict which outlet published a Ukrainian news article. A voting classifier trained on StyloMetrix features scored slightly above the Naïve Bayes–SVM baseline in the comparison the authors report. An explanation produced with DALEX associated parataxis, adverbs, second-declension nouns, and inanimate, plural and masculine nouns with higher scores for BBC News Ukraine. Negative sentences, greater type–token ratio and nominative case figured on the other side of the explanation. The case study illustrates what the named columns contribute beyond a benchmark score. They let a reader relate a prediction to measurable properties of the articles, while leaving open whether those properties characterize the outlet beyond the sample.
Deep dive: The Grammar and Syntax Based Corpus Analysis Tool For The Ukrainian Language
StyloMetrix measures grammar, vocabulary and sentence structure in Ukrainian texts and tests those measurements on a news classification task. · about 35 minutes to read
The problem and its context
Measuring how people write
In corpus linguistics, researchers use collections of texts to examine how language varies in actual use. A collection can make a pattern visible that would be easy to miss in a single example. It also creates a measurement problem. If researchers want to compare how frequently writers use a construction, they need to find it consistently across the collection and decide what a frequency should be relative to. A search for a recurring word can sometimes do the first job. A grammatical construction can survive changes in vocabulary, word order or inflection that make a search for a fixed string much less informative.
The StyloMetrix paper approaches this problem through stylometry, the quantitative study of writing style. The authors are interested in applications such as distinguishing authors, genres or stylistic varieties. Their starting assumption is that grammar and syntax can carry enough information to support some of these distinctions. A useful comparison might therefore ask how often writers use particular forms of negation, how they join clauses or which noun forms they favour. Such questions concern choices in expression. A subject-matter description of the same text serves a different purpose and can sit alongside an account of those choices.
The account of earlier work begins with Douglas Biber and colleagues. The authors cite their work on methods for studying grammar across a corpus and Biber’s argument that looking at narrative meaning or offering a descriptive account can leave questions of genre, authorship and period unresolved. A reader may recognize a writer’s subject and still have little basis for deciding whether the grammar resembles that of another writer, register or time. Frequencies make that comparison possible at the level of patterns. They also allow a researcher to consider several tendencies together, even when the presence of any individual construction says little about a particular document.
The paper also draws on M. A. K. Halliday’s view of language as probabilistic. In the authors’ account, the point of counting grammatical phenomena reaches beyond assigning labels. Counts can help researchers understand how parts of the grammatical system interact and how choices are distributed in real texts. Applied to StyloMetrix, that perspective explains why the end product is a set of measurements per document. Identifying a noun’s case or recognizing a clause relation is an intermediate step. The research question may concern the frequency of that case across groups of texts, or how the clause relation varies along with other properties.
From studies of constructions to reusable software
The historical examples in the paper show different ways of making grammar countable. Some researchers developed methods for finding constructions in corpora as part of work on automatic tagging and parsing. Others chose particular phenomena. The authors mention work on negation and its spread through the vocabulary, on the relation between cleft constructions and prosody or pragmatics, and on automated recovery of passive constructions. They also cite work on clauses with infinitives and put generative grammar in the broader intellectual background. The examples range from descriptions of a construction to methods for finding its instances.
That range matters because a system that finds a construction and a system that summarizes its distribution have different jobs. The investigator of passives needs a reproducible way to decide which forms qualify. A researcher comparing registers then needs an answer that can be related to the lengths or other properties of the documents. StyloMetrix places the two jobs in the same pipeline. Its authors begin with linguistic categories and convert the results of detecting them into values suitable for comparing texts. The precedents they cite explain both the hand-written rules and the interest in document-level frequencies.
The paper discusses several established stylometry packages. The R package stylo is presented as a flexible way to compare writing styles and as a tool that can be used in supervised classification. The authors associate it with work in English and Polish. They describe WebSty as an open system that lets the user choose among grammatical, lexical and thematic properties and that supports Polish, English, German and Hungarian. These packages represent different forms of access to the same broad kind of question. A researcher might want to select a set of textual features or to use those features in a predictive comparison.
The authors also discuss Coh-Metrix, which exposes a broad set of descriptive measurements through a web platform. In their account, its measures range from pronoun counts to lexical diversity, cohesion, readability and the density of particular syntactic patterns. They distinguish such measurements by what they describe. A readability score and a count of pronouns can both be attached to a document, but each answers a different question about it. The paper notes independently developed versions for Spanish, Portuguese and Chinese. The example establishes a precedent for collecting interpretable measures into a common tool, as well as for adapting that idea to other languages.
More general corpus tools provide facilities such as concordances, which display occurrences in their surroundings, and counts of n-grams, which are sequences of adjacent items. Searches for recurrent combinations and salient words give a researcher a useful view of vocabulary and phrasing. The authors see a gap when the question concerns a tense or a syntactic pattern whose instances have different surface forms. A frequency list can show which forms recur. A count of a tense requires a decision about which forms count as instances of the same grammatical category. The Ukrainian package focuses on making those decisions reusable.
The Ukrainian gap
The paper describes Ukrainian as a low-resource language with relatively few applied systems for machine learning. In its account, much of the relevant work approaches Ukrainian within wider multilingual research. Among the studies it cites are an investigation of contextual representations for resolving word meanings and a study of abstractive summarization using Ukrainian news. These illustrate active research on Ukrainian text from different angles. The StyloMetrix project asks whether a researcher can inspect a collection through a consistent set of counts tailored to the language’s grammar. Contextual Embeddings for Ukrainian · Abstractive Summarization for the Ukrainian Language
Ukrainian gives the authors a specific reason to tailor the measurements. It is a fusional language, meaning that a word form can express several pieces of grammatical information at once. Morphology is the study of that structure in words. A noun occurrence may supply evidence about case and number through its form, while the word belongs to a declension, a broader pattern of inflection. A common measurement procedure can be shared across languages, but what qualifies for a given measurement depends on the distinctions the language makes and what the available analysis can identify.
The authors call their claim of priority a matter of their knowledge of existing work. Its scope is a Ukrainian corpus tool offering a substantial inventory of grammatical and syntactic measurements alongside descriptive lexical ones. That scope helps explain why it matters that StyloMetrix already existed for Polish and English. The general idea of building comparable document profiles was already in the package. The Ukrainian work concerns the labels, rules and checks needed to make those profiles meaningful for a new set of texts.
The method, step by step
From a document to a row of measurements
A collection enters StyloMetrix as individual texts. Imagine that a researcher wants to compare the use of plural nouns across a set of articles. The package first needs to know where the units of an article are and what grammatical information is attached to each one. It can then apply a rule for plural nouns, collect the units that meet its conditions and express the size of that collection relative to the length of the article. The process produces a named value for that article. Applying the other rules creates the rest of its row in the output file.
A token is a unit produced by tokenization, the process of dividing a sequence of written text into pieces for analysis. A token commonly corresponds to a written word or a punctuation mark. That detail matters because the paper describes the denominator as a count of tokens, and its examples of the material selected by a rule include punctuation. Readers comparing the scores with ordinary word counts need to keep the unit of measurement in mind. A score relates to the way the pipeline represents the document and to the set its rule selects within that representation.
How StyloMetrix measures a Ukrainian text
The steps in order.
The base analysis comes from spaCy’s standard Ukrainian transformer pipeline. A transformer uses attention to bring information from surrounding tokens into the processing of a token. StyloMetrix uses the linguistic output of the supplied pipeline. This includes part-of-speech labels, such as noun or adverb, and morphological attributes, such as number or case. It also includes relationships that describe how tokens are attached to one another in a sentence. The authors’ implementation work addresses the next stage, where these different forms of linguistic annotation become evidence for the measurements in the document profile. Transformer and attention
Part-of-speech tagging marks a token’s broad grammatical category. Morphological attributes describe properties of a form within that broader category. Case, for example, records a grammatical distinction found on nouns and other forms, while aspect distinguishes ways of presenting an action. Dependency parsing adds a different kind of information by relating a token to another token on which it grammatically depends. A word tagged as a noun can have several roles in a sentence. Its relation to another word supplies evidence about the role it has in that particular occurrence.
This distinction explains why the same token can contribute to several measurements. A noun occurrence can count toward a part-of-speech statistic, have the features required for a case statistic and occupy a position picked out by a syntactic rule. The measurements describe different properties of the text. The groups of metrics organize the columns for the researcher. A word remains available as evidence wherever the conditions of a rule are met, including where another rule has already selected it for a different purpose.
Writing rules on top of the base analysis
The authors place their custom extensions at the end of the spaCy sequence, where the earlier annotation is available to the rules. They describe these rules as the work of computational linguists and researchers in literary studies. A metric is designed by choosing a phenomenon and deciding what observable conditions identify it. Some conditions can be expressed directly through a tag. Others need information about word endings, the form of a token or where it sits in the dependency tree. The resulting implementation is a set of explicit linguistic decisions that can be checked against examples.
The base pipeline exposes attributes such as gender, number, animacy, degree and verb form. Those attributes offer evidence about parts of Ukrainian grammar. The paper also points to distinctions for which the authors wanted coverage beyond what the base pipeline supplied, including verb conjugation, noun declension and present, past and future forms. Conjugation class concerns the pattern according to which a verb changes form. Declension class plays a similar role for inflected nouns. A case label can record a property of a particular occurrence without specifying the broader pattern to which the noun belongs.
That difference between a property of an occurrence and a pattern of related forms helps explain the value of the custom layer. A rule that assigns a noun to a declension has to identify evidence for class membership, while a rule for the genitive case is looking for a form in a particular grammatical use. Both can be reported as shares of an article’s tokens. The numerical result alone will have the same kind of appearance in a spreadsheet. Its column name and definition tell the reader which question the rule was designed to answer.
The authors inspected the pipeline’s tags before developing their rules. They report mistakes in case, animacy, aspect and gender, as well as inconsistencies in word classes. The error involving Ілля shows why this matters for a downstream count. If a rule accepts the assigned gender when selecting masculine nouns, a token assigned feminine can be omitted from the intended set. A rule selecting feminine tokens can be affected in the other direction. The auditable object in this workflow is the connection between evidence and selection. A linguist can ask whether the token met the implemented conditions and whether those conditions were appropriate for the category.
The authors use affixes, the parts attached to a stem, as additional evidence in some lexical rules. In other situations they consult the position of a token in a dependency tree. An ending is visible in the token itself. A dependency provides contextual information about the token’s relation to another element of the sentence. The paper describes the dependency tags as the most reliable tags the authors examined. That assessment prompted them to use these tags extensively in implementing grammatical and syntactic rules, while the complexity of individual constructions still left room for errors.
The paper gives examples under rule identifiers so that readers can connect a metric with the items it selected. It also says that descriptions accompany the metrics and that some refer to Universal Dependencies, a scheme for describing word categories, morphology and grammatical relations. These descriptions matter because a short column label has limited room to express a rule’s scope. An object metric can be interpreted sensibly only if the reader knows how the package identifies an object and which occurrences it includes in its count.
What a rule selects
Several metrics are familiar descriptions of a text. They cover punctuation, the distribution of parts of speech, vocabulary variety, and the balance of content and function words. Content words carry much of the subject matter of an expression. Function words help provide its grammatical organization. A type–token ratio concerns the relation between distinct forms, known as types, and their total occurrences, known as tokens. Repeated occurrences contribute to the total without increasing the stock of distinct forms. These measurements can be read alongside the more specialized rules, giving a document profile both general counts and counts tied closely to Ukrainian grammar.
The paper uses selections from a news text to illustrate how the rules behave on real input. The rule L_ANIM_NOUN returns items including Президент and агресор as instances of animate nouns. The paper’s adverb example uses потрібно and відверто. Reading the underlying selections answers a question the document score cannot answer by itself. It shows which tokens the rule used as evidence. In the animate-noun example, a researcher inspecting the chosen forms can see whether the category the package applies corresponds to the intended grammatical classification in the article.
The examples of direct and indirect objects illustrate another distinction. The rule L_DIRECT_OBJ includes forms such as армію and потенціал. L_INDIRECT_OBJ includes, among its examples, Україні and режимом. The authors draw attention to contrasts between Ukrainian forms and their English glosses. English translations may express a relation with a preposition, whereas the Ukrainian occurrence can carry relevant evidence in its case marking. The examples show selections made by each rule. They leave room to inspect the clause and the word’s grammatical relation when deciding how natural or extensive a rule’s category is.
The genitive illustration makes the use of inflection especially clear. The items selected by L_GEN_CASE include безпеки and домовленостей. The metric concerns whether the word occurs in a genitive form, and its value reflects those occurrences among the tokens of the whole document. A noun’s appearance in another case can still matter to a different column. By keeping these as separate measurements, the package gives a researcher a way to ask about the distribution of particular realized forms rather than merely the presence of certain nouns in a text.
The declension example involves words such as затримка, підтримкою and країна. The authors describe the displayed selection as first declension even though the printed identifier is VF_FIRST_CONJ. The linguistic description is the clearest guide to that example. Declension is a property of a pattern of noun inflection, so the selected items need not appear with identical endings. Some individual forms reveal different cases within the same broader pattern. The value of a metric at this level is that it can collect members of the pattern under a common measurement in spite of differences between the particular forms encountered.
A parataxis example returns a span from a passage in which a narrator says what they wanted to hear and then presents direct speech addressed to Ukraine. The returned material includes pieces of the speech and punctuation as well as tokens in the surrounding wording. That example shows that the count can cover the tokens of a construction, across a stretch of text. It consequently answers a question about the amount of the text selected by the rule. The opening of the quotation, the boundaries of the span and the attachment of the reported words can all affect which tokens enter the calculation.
The paper places ellipsis and apposition alongside parataxis among the construction types of interest. Ellipsis involves leaving something unexpressed that is understood from the surrounding structure. Apposition places expressions together so that one identifies or redescribes the other. Rules for such phenomena have more to resolve than a straightforward lookup of a part-of-speech label. They can depend on which pieces belong together and where the construction begins or ends. Other specialized measurements concern future forms, participial forms, declension and case. The authors include these distinctions because a useful Ukrainian profile needs to represent features that the language makes available to its writers.
The count and its denominator
The paper expresses the common calculation as a sum of selected tokens divided by the number of tokens in the input. In its notation, the expression is:
(∑₀ⁿ w) / N
The summation sign ∑ indicates that the expression collects the tokens that satisfy the rule. The paper uses w for the token term being counted. The lower bound 0 and the upper bound n delimit the summation over the selected set, with n marking its upper endpoint. N is the total token count for the input text. The parentheses group the numerator, and the slash indicates division. The operational meaning is to count the selected tokens and express that count relative to the full input.
The denominator explains what the scores can be compared on. A longer article gives a rule more opportunities to find instances. Two articles can therefore have the same relative use of a feature while containing different raw counts. Dividing by the document’s token count puts their values on a common scale. A high value describes how much of the document the rule selects under that scale. For a rule that returns a span, a longer selected span can have a greater effect on the measurement than a shorter span. The paper’s parataxis example makes this distinction concrete.
For a nominal case measurement, the rule-selected tokens go in the numerator while tokens throughout the document go in the denominator. A genitive score thus describes genitive material relative to text length. The proportion of nouns that are genitive would answer a further question about the composition of the noun category and would use a noun count as its denominator. The interpretation of the documented score follows from the choice to use the full text as the reference for the regular measurements.
Normalization also clarifies the package’s treatment of short inputs. The authors say that it can produce values starting from a sentence. The calculation works as long as there are tokens to count, and a selected token in a short text accounts for a larger share than the same token would in a longer text. A sentence-level value can serve as a description of that sentence. Stability across different samples from an author, outlet or genre is a separate empirical property. The ability to compute a score supplies the starting point for that kind of evaluation.
The paper also uses the idea of a mean later when it summarizes metrics across texts in the BBC News Ukraine class. That is a different level of aggregation. The package first produces a value for each article. An average over those values describes the collection of article profiles in the class. Pooling all tokens from the articles and calculating a single frequency would give longer articles more influence. Keeping the two operations distinct helps when interpreting a class mean and relating it back to the documents from which it was calculated.
The exported representation and the supervised task
The finished representation is a matrix with a document per row and a metric per column. The paper reports 104 metrics for Ukrainian, organized into lexical, part-of-speech, grammatical and syntactic groups. The values in a row form a vector, an ordered set of numbers describing the corresponding text. A column keeps its linguistic identity across rows. A researcher can therefore examine the same metric across articles or compare several measurements within a single article. The CSV export makes both the descriptions and the inputs to later analysis available in a conventional tabular form.
The paper describes two kinds of work involved in the package’s evaluation. A linguist assessed whether the metrics recovered the linguistic material they were meant to measure. Separately, the authors used the document vectors as inputs to a classifier and examined whether they supported predictions on a labelled news collection. Neither the linguistic rules nor the spreadsheet require outlet labels in order to describe an article. Those labels enter when a classifier learns how the article profiles relate to the news sources.
For the supervised case study, the voting classifier brings together RandomForest, AdaBoost and Logistic Regression. RandomForest uses a collection of decision trees, which divide examples according to feature values. AdaBoost combines successive predictors while giving more attention to examples that are harder to classify. Logistic Regression uses feature values to estimate how an example relates to the available classes. Voting gives these approaches a shared prediction stage. Their common material is the set of linguistic columns produced by StyloMetrix, which also supplies the feature names used in the paper’s subsequent explanation.
Experiments and results
Validation of the extracted features
The most direct evaluation asks whether the rules find what their names say they find. The authors describe an accuracy assessment by a trained linguist and report scores for the groups of metrics. This part of the paper concerns the quality of the linguistic output itself. A newspaper label plays no part in deciding whether a token is an instance of a genitive form or whether a rule has selected a valid part of a larger construction. The reported values give a view of how well the measurements serve their descriptive purpose before those measurements are used for classification.
Accuracy by metric group in the Ukrainian StyloMetrix linguistic assessment
Part-of-speech metrics attain the highest reported accuracy and syntactic metrics receive the lowest.
The numbers
| System or setting | Accuracy |
|---|---|
| Part of speech (this paper) | 0.957 |
| Lexical | 0.934 |
| Grammatical | 0.912 |
| Syntactic | 0.886 |
The authors give 0.957 for the part-of-speech group and attribute its performance to the underlying spaCy tagger. The lexical group received 0.934, which the paper specifically describes as a weighted accuracy. Adjective and adverb cases caused some difficulty, and the authors also found mismatches involving case labels. The grammatical group received 0.912, with noun declension rules among the sources of inconsistency. The syntactic group received 0.886. The discussion associates its difficulties with constructions such as parataxis and apposition, where a successful selection depends on recognizing the construction and determining its extent.
The chart compares the reported group outcomes under the paper’s linguistic assessment. The lexical weighting matters when comparing the entries. The paper supplies a weighted figure for that group and gives an accuracy figure for each of the others without laying out a common weighting procedure. The group results can locate broad differences and direct attention to reported errors. A precise comparison between any individual rules would require the observations behind their scores and the way the group figures were formed.
The rating of the dependency tags and the score for syntactic metrics address different objects. In the authors’ initial inspection, individual dependency labels were the most dependable of the tags they examined. A syntactic rule can still be difficult to evaluate because its output concerns a whole construction. It can depend on several relations, and on a decision about the boundaries of the material involved. The group result therefore describes the performance of the feature extraction as a whole. It gives a different kind of evidence from the authors’ observations about individual labels supplied by spaCy.
The Ukrainian news benchmark
The classification study needed documents with labels already assigned. The paper discusses several Ukrainian resources to explain the choice of data. UberText 2.0 brings together material from news, fiction, social channels, Wikipedia and court decisions. The separate UA news corpus organizes articles by topic. The paper also mentions UA-SQuAD for question answering and UA-GEC for grammatical correction and fluency. Those examples show the kinds of resources the authors considered relevant to Ukrainian language processing. The classification experiment uses a particular public Kaggle news benchmark associated with the study by Panchenko and colleagues. Introducing UberText 2.0
The authors describe the selected corpus as material scraped from seven Ukrainian news websites. The sources include BBC News Ukraine and NV, as well as Ukrainian Pravda, Economic Pravda, European Pravda and Life Pravda. Unian is also represented. Here the classification question is tied to source identity. That choice determines how to read the labels and any feature associations. A source class can reflect a publication’s editorial habits, its repertoire of article types or the topics represented in the sample. The labels supply a concrete prediction task without assigning the individual articles to a linguistic genre.
Panchenko and colleagues described original training and test counts of 57,789 and 24,765 documents, respectively. The StyloMetrix authors say that the original division is unavailable to the public. Kaggle exposes a large training sample of 57,460 documents and a small training sample of 9299 documents. The paper notes that the larger sample contains part of the smaller one. That overlap gives the authors a reason to work with the large sample as their starting collection instead of treating the small sample as an independent test population.
The StyloMetrix experiment divides the larger sample into training and testing portions, with the paper specifying an 80/20% split and also stating that 15% is used for validation. Training provides the labelled examples from which the classifier learns, validation provides a means of assessing choices during development, and the test portion is intended for evaluating the resulting classifier. The paper gives the proportions without spelling out how the validation portion is drawn in relation to the training and test division. The experiment consequently has a documented public starting sample and reported split proportions, with the exact allocation left unclear.
This data arrangement affects how the paper can compare the results with earlier scores. Both studies concern the same benchmark and the same task, and the StyloMetrix authors adopt the earlier evaluation criterion. Their experiments use a new division of the publicly accessible data. A score depends on which examples were available for learning and which examples count towards testing. Holding the task and metric constant makes the results relevant to each other. It leaves the different partitions as part of the context for interpreting a small gap.
Baselines and macro-averaged F1
The earlier benchmark’s conventional baseline is described as Naïve Bayes with SVM. Naïve Bayes assigns classes using estimates of feature probabilities under simplifying assumptions about how those features relate. An SVM seeks a decision boundary between classes. The StyloMetrix authors add a baseline built from their linguistic vectors and the voting classifier. A baseline gives the reader a reference point for judging what more elaborate methods achieve. In this case the authors also want the reference point to expose the linguistic evidence behind its decisions.
The experiment retains ukr-RoBERTa and ukr-ELECTRA as the principal comparison systems used in the earlier benchmark. The paper connects ukr-RoBERTa to work on transferring an existing system across languages by initializing the representations of pieces of words. In the comparison, the Ukrainian transformer systems and the voting classifier represent different ways to supply information for prediction. The StyloMetrix route makes the set of input properties explicit in advance, which allows its output to be traced to the feature definitions. WECHSEL
The authors use macro-averaged F1. For a class such as BBC News Ukraine, precision asks how often predictions of that class are correct, while recall asks how many articles actually in that class are recovered. F1 combines those two quantities. Macro-averaging takes each class’s F1 as an individual contribution to the final score, giving every class equal weight in the average. A single overall accuracy would give greater influence to classes with more test articles. The paper’s choice makes the result depend on how the classifier behaves across different news sources.
The descriptions of macro-F1 and linguistic accuracy therefore belong to separate comparisons. In the linguistic assessment, the target is a morphosyntactic or lexical judgment about a token or a construction. In the news evaluation, the target is the publishing outlet. Extraction accuracy can matter to prediction since the article profile is the classifier’s input. Even so, a reliable measurement can have little value for distinguishing outlets if its distribution is similar across them, and a difficult construction can be predictive if its measured distribution differs in a consistent way. The two evaluations answer complementary questions.
The classification result stated by the authors is that the StyloMetrix voting classifier records a higher macro-F1 than the Naïve Bayes–SVM baseline, with a small gap. The paper’s discussion gives the direction of that comparison without stating the numeric macro-F1 entries. This supports a limited performance claim about a feature-based baseline in the news task. The numerical accuracy chart concerns the separate linguistic validation. It supplies no estimate of how many articles were classified correctly or of how much macro-F1 was gained.
The paper also recalls a prior application of the Polish package to erotic versus neutral texts. In that earlier study, StyloMetrix vectors supplied input to a RandomForest classifier, and the authors report an overall accuracy of around 0.90. They cite the example as motivation for developing and testing Ukrainian measurements. It concerns a different language, label distinction, classifier configuration and evaluation metric. Its role in the Ukrainian paper is to establish a precedent for using the descriptive vectors in prediction.
Reading the BBC News Ukraine explanation
The authors use DALEX, an open-source explanation library, to study the classifier’s decisions for class 0, BBC News Ukraine. This part of the study draws on interpretability, the effort to understand the grounds on which a system produces its output. In a StyloMetrix vector, the column under examination has a readable definition. If a feature contributes to a prediction, the reader can consult the definition and ask what characteristic of the document supplied that value. The case study uses that correspondence to connect feature attribution with linguistic description.
DALEX supplies Shapley values. The paper describes them as average marginal contributions. A marginal contribution asks how the prediction changes when a feature is considered in addition to features already present. Averaging such contributions gives a way to attribute parts of a prediction to individual features in the presence of other evidence. The resulting attribution concerns the behaviour of the fitted classifier. Its linguistic interest in this case comes from the connection between the values being attributed and named categories such as parataxis, declension and grammatical case.
In the example for class 0, the paper associates the parataxis and adverb metrics with predicting BBC News Ukraine. It also identifies second declension and metrics for inanimate, plural and masculine nouns on the side favouring that source. The metrics for negative sentences, type–token ratio and nominative case appear on the side reducing the likelihood assigned to the class. The directions describe how the authors read the explanation. They do not provide a ranking by causal influence or a direct estimate of how much more frequently one outlet uses a form than any other outlet.
The authors then connect the attribution to descriptive statistics. They use the exported document vectors to summarize selected metrics over the BBC News Ukraine articles. A class mean reports how much of the feature is recorded in the collection’s article profiles on average. The Shapley explanation reports how evidence represented by that feature contributes to a prediction. Their relationship is worth keeping explicit. A contribution can depend on the value of a feature in context, including the information carried by other columns, while the mean describes the observed values within the class.
The authors propose looking across several classes when using these summaries to characterize a text group. An outlet average makes a useful point of comparison for a later descriptive question, but the other outlets’ averages would determine whether a tendency was distinctive in this collection. The BBC News Ukraine example illustrates the stages of that inquiry. The classifier brings features to attention, the exported profiles permit inspection of their distributions, and linguistic interpretation links the observations back to structures that can be sought in the texts.
What the ablations show
The paper reports no ablation in which features or components are removed and the same evaluation is repeated. Its closest evidence comes from the inspection of spaCy annotations, the validation of groups of linguistic rules, the comparison with the conventional news baseline, and the feature attribution for BBC News Ukraine. These analyses address different parts of the pipeline. They show where extraction errors arise, how the full descriptive representation fares in classification, and what evidence is involved in a particular class explanation.
Inspecting annotation before writing rules
The examination of spaCy’s output identifies a specific route by which a linguistic error reaches the results. A word enters the custom rule stage with labels attached. A rule can select it based on those labels or based on supplementary evidence. If the word bears the wrong label and the relevant rule relies on it, the word may count toward a different category or fail to count where intended. The authors’ example involving a name provides an instance at the level of an individual token. It helps explain the decision to inspect forms and dependency relations when hand-writing some rules.
The inspection also distinguishes common types of errors. A mismatch in gender has consequences for gender metrics, while a mismatch in aspect concerns the way a verb form is analysed. An incorrect part of speech can have wider consequences if several rules first check whether a token belongs to a broad word class. The paper’s observations trace these problems qualitatively. They explain the design choice to make use of dependency relations and other kinds of evidence where possible. The effect of that choice on accuracy is unmeasured in a comparison with a version that uses the original tags alone.
A useful way to understand this evidence is to distinguish the object being inspected from the consequence for a document. The error on the name concerns an annotation. The deviation it might produce in a document score depends on how frequently comparable errors occur and which rules use that label. If a whole input contains many occurrences of a name, repeated errors can matter more to the document profile than an isolated occurrence elsewhere. The examples establish a mechanism, while the magnitude of its impact across the corpus remains outside the inspection.
Comparing the groups of metrics
The linguistic assessment offers a comparison across types of measurements. The part-of-speech group ranks highest in the reported scores. The authors explain its comparatively strong performance through the connection to the spaCy tagger. The syntactic group ranks lowest, and the discussion links that result to the difficulty of identifying constructions such as parataxis and apposition. This comparison is useful to readers deciding how to interpret the linguistic profiles. They can see that the confidence suggested by validation varies across groups and that broader constructions come with documented sources of error.
The groups differ in what their rules are asked to detect. Detecting an adverb as a word class and recovering the extent of a paratactic structure place different demands on the evidence. This limits any attempt to isolate the effect of a particular annotation source by comparing their reported accuracies. A controlled comparison of annotation sources would hold the target construction constant and vary the information available to the same rule. The reported contrast instead reflects the combined difficulty of the targets, the underlying linguistic analysis and the authors’ rule definitions.
The comparison also leaves the usefulness of individual metrics for prediction open. A group with a higher accuracy can contain features that vary little across outlets. A group with a lower accuracy can contain a feature that makes a substantial contribution on some articles. The paper’s parataxis result illustrates the distinction. Parataxis is cited as an example of the difficulty of syntactic extraction and appears in the explanation of the classifier’s BBC News Ukraine predictions. Those observations can coexist because one concerns identification of a construction and the other concerns predictive use of the resulting values.
What the classifier comparison and attribution isolate
The result against the Naïve Bayes–SVM baseline compares complete approaches. The StyloMetrix system changes the representation and uses a voting classifier that combines different learning algorithms. The authors also work from a different partition of the publicly accessible material. These differences matter when reading the direction of the reported result. It provides evidence about the competitiveness of the assembled feature-based approach in the case study. It leaves the relative contribution of the features, the voting method and the evaluation partition unresolved.
The Shapley analysis does offer evidence about particular features of the fitted classifier. For BBC News Ukraine, the paper identifies favourable and unfavourable contributions and ties them to phenomena a reader can recognize in text. That operation concerns the distribution of evidence in predictions from a classifier that already uses the full representation. Removing all syntax columns and learning a new classifier, for instance, would allow the remaining columns to take different roles. Its score would answer a different question about how the task could be solved with less information.
Related features also complicate attribution. A token can be a noun, masculine, plural and inanimate in the same occurrence. As a result, several feature columns can capture overlapping consequences of the way an article is written. A set of explanatory contributions can show that these properties participate in the prediction. It cannot establish that each property supplies fully independent information. The BBC News Ukraine example is accordingly best read as a linguistic account of evidence used for the reported class, with the class means available as a further way of investigating that evidence in the collection.
Limitations
Limits the authors identify
The authors name computational resources as a practical constraint. They discuss memory and GPU access and recommend the English and Ukrainian spaCy transformer pipelines. A GPU is hardware suited to carrying out many numerical operations in parallel. Because StyloMetrix depends on the annotation pipeline, the cost of producing the measurements includes running that pipeline over each document. The paper identifies resource availability as a consideration without giving timings, a hardware comparison or a quantitative estimate of the cost of processing a corpus. GPU & parallel computing
The authors also flag inconsistencies in metrics. spaCy may assign the wrong attributes, and the custom rules can then select an inappropriate token or omit a relevant one. Consulting affixes or dependency relations addresses some of these cases, with the paper still reporting errors involving lexical categories, declension and complex structures. The metric descriptions and examples make these issues inspectable. A researcher can trace a troubling count to the grammatical decisions behind it, which helps locate the error even when the numerical value by itself gives little indication of its source.
In the ethics discussion, the authors identify a possible path from inconsistent parsing and tagging to bias in systems that use language data downstream. The concern applies to analyses in which annotation mistakes fall unevenly across the material being compared. If something similar happened in the news collection, a classifier could respond to a difference in the way its inputs had been processed as well as to a difference in the articles themselves. The paper raises this possibility as a risk. It does not quantify unequal error rates across groups, texts or sources.
The authors describe their use of DALEX as an example of how the package might support further analysis and call for more rigorous study. They also see potential for comparing genres and languages, including across the Polish, English and Ukrainian versions. Those possibilities are part of the scope they give the package. The Ukrainian classification evidence concerns the particular news benchmark. Taking a named measurement into another genre or language raises the empirical question of whether the rule and the categories yield comparable profiles there.
Limits of the evidence
The linguistic validation provides a set of group scores and identifies phenomena responsible for some disagreements. The paper gives little detail about the size and composition of the material assessed by the linguist, how correct selections and omissions were used to calculate accuracy, or how the judgments would agree across annotators. The lexical figure is called weighted, but the basis of the weighting is unspecified in the description. These gaps limit how precisely a reader can reproduce the assessment or estimate how well a group score represents an individual metric in new text.
Group scores can also conceal variation within each category. A grammatical group covers multiple kinds of distinctions, and the paper specifically singles out declension as a problem area. A reader using a declension statistic needs evidence about that rule as well as the broader score for grammar. The same applies to a syntactic metric when the intended use depends on recognizing the full span of a construction. The paper’s examples let the reader inspect some positive selections, while a full account would need to cover correct outputs, erroneous outputs and relevant tokens or constructions that the rules missed.
The common denominator aids comparisons by normalizing for overall text length. It also determines what distinctions the measurement captures. An article can have a larger share of masculine noun tokens because it uses many nouns or because masculine nouns predominate within its nouns. Both possibilities are consistent with a score in which all document tokens form the denominator. For a construction such as parataxis, a larger share may reflect a more extensive selected span and also may reflect more occurrences. The linguistic interpretation therefore depends on what the numerator counts and how the resulting percentage relates to the question being studied.
The paper’s short-input claim also concerns the reach of the computation. In a single sentence, a construction can occupy a substantial part of the input; an adjacent sentence by the same writer can have a different score simply because it performs a different function. There is no comparison of stability across document lengths in the Ukrainian study. An interpretation about persistent style requires observations across enough material to distinguish stable tendencies from choices that happen to occur in the piece being measured.
Several limits arise from the classification setup. The starting collection is public, while the original train–test division used in the earlier benchmark is inaccessible to the authors. Their split supports an experiment with the available training sample, and the stated validation proportion leaves the exact assignment of examples unclear. The description also gives no per-class classification figures or estimates of variation across repeated partitions. A small macro-F1 advantage in the paper’s account supplies limited evidence about how consistently the classifier would outperform the reference under another split.
Source labels make the prediction problem useful for demonstration but leave several explanations for its success. An outlet may use particular constructions more frequently, may publish different kinds of articles, or may cover subject matter that affects the kinds of words and sentences that appear. For instance, the contribution of parataxis could be related to how articles handle speech, but its appearance in the explanation cannot identify a cause of the difference by itself. The paper establishes an association inside a prediction task with news-source labels. General claims about Ukrainian genres, author identification or editorial practice would require comparisons designed to distinguish those possibilities.
The BBC News Ukraine analysis likewise concerns the one class chosen for illustration. The authors explain how the CSV output can provide class means and emphasize the importance of comparing those averages across classes. The example gives the reader a route from a class prediction to a linguistic hypothesis. It leaves open how features behave for the other outlets and whether the direction of a contribution remains stable in other samples. A class-wide style account also needs evidence about the distribution of documents, since the same average can accompany different amounts of variation among articles.
Finally, the package’s scope and the classification evidence support different claims. The authors introduce Ukrainian metrics that can be computed for any text that the pipeline can process, and they illustrate the package with a source prediction task. The rule definitions and output format establish what can be measured. The validation addresses the quality of groups of those measurements. The news study addresses their usefulness in a particular application. Each finding has its own conditions, so the presence of features for describing varied texts provides broader coverage than the paper’s demonstrations of predictive performance.
What came after
Later applications of the Ukrainian StyloMetrix rules have yet to be documented in citing work associated with the paper. The authors close by identifying further study of feature importance and comparisons across genres and languages as directions for investigation. Those directions follow from the package’s ability to export the same named measurements for each text and from the news study’s demonstration that those measurements can be traced through a classifier’s decisions.
Cite
Cite as Daria Stetsenko and Inez Okulska. 2023. The Grammar and Syntax Based Corpus Analysis Tool For The Ukrainian Language. arXiv:2305.13530.
@misc{stetsenko2023grammar,
title = {{The Grammar and Syntax Based Corpus Analysis Tool For The Ukrainian Language}},
author = {Daria Stetsenko and Inez Okulska},
year = {2023},
doi = {10.48550/arxiv.2305.13530},
eprint = {2305.13530},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.2305.13530}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/stetsenko-2023-grammar-syntax-based-corpus-analysis/
References
- Bas Aarts, Charles F Meyer, Charles J Alderson, Caroline Clapham, Dianne Wall, and Robert Beard. Livres regus. Canadian Journal of Linguistics/Revue canadienne de linguistique, 40:0 3, 1995. OpenAlex ↗ · Scholar ↗
- Karin Aijmer and Bengt Altenberg. English corpus linguistics. Routledge, 2014. OpenAlex ↗ · Scholar ↗
- Hubert Baniecki, Wojciech Kretowicz, Piotr Piatyszek, Jakub Wisniewski, and Przemyslaw Biecek. dalex: Responsible machine learning with interactive explainability and fairness in python. Journal of Machine Learning Research, 220 (214):0 1–7, 2021. URL http://jmlr.org/papers/v22/20-1473.html. OpenAlex ↗ · Scholar ↗
- Douglas Biber. Corpus linguistics and the study of english grammar. Indonesian JELT: Indonesian Journal of English Language Teaching, 10 (1):0 1–22, 2005. OpenAlex ↗ · Scholar ↗
- Douglas Biber, Susan Conrad, and Randi Reppen. Corpus linguistics: Investigating language structure and use. Cambridge University Press, 1998. OpenAlex ↗ · Scholar ↗
- Dmytro Chaplynskyi. Introducing UberText 2.0: A corpus of modern Ukrainian at scale. In Proceedings of the Second Ukrainian Natural Language Processing Workshop, Dubrovnik, Croatia, May 2023. Association for Computational Linguistics. URL https://lang.org.ua/static/downloads/preprints/ubertext_paper.pdf. our card
- Rochelle Choenni and Ekaterina Shutova. What does it mean to be language-agnostic? probing multilingual sentence encoders for typological properties. arXiv preprint arXiv:2009.12862, 2020. OpenAlex ↗ · Scholar ↗
- Noam Chomsky. Generative grammar. Studies in English linguistics and literature, 1988. OpenAlex ↗ · Scholar ↗
- Peter Collins. It-clefts and wh-clefts: Prosody and pragmatics. Journal of Pragmatics, 380 (10):0 1706–1720, 2006. OpenAlex ↗ · Scholar ↗
- Maciej Eder, Jan Rybicki, and Mike Kestemont. Stylometry with r: a package for computational text analysis. The R Journal, 80 (1), 2016. OpenAlex ↗ · Scholar ↗
- Svitlana Galeshchuk, Arval BNP Paribas, and France Rueil-Malmaison. Abstractive summarization for the ukrainian language: Multi-task learning with hromadske. ua news dataset. In The Second Ukrainian Natural Language Processing Workshop (UNLP 2023), page 49, 2023. our card
- Arthur C Graesser, Danielle S McNamara, Max M Louwerse, and Zhiqiang Cai. Coh-metrix: Analysis of text on cohesion and language. Behavior research methods, instruments, & computers, 360 (2):0 193–202, 2004. OpenAlex ↗ · Scholar ↗
- Sylviane Granger. Automated retrieval of passives from native and learner corpora: precision and recall. Journal of English Linguistics, 250 (4):0 365–374, 1997. OpenAlex ↗ · Scholar ↗
- Sergiu Hart. Shapley value. Springer, 1989. OpenAlex ↗ · Scholar ↗
- Yurii Laba, Volodymyr Mudryi, Dmytro Chaplynskyi, Mariana Romanyshyn, and Oles Dobosevych. Contextual embeddings for ukrainian: A large language model approach to word sense disambiguation. In Proceedings of the Second Ukrainian Natural Language Processing Workshop (UNLP), pages 11–19, 2023. our card
- Piaseck Maciej, Walkowiak Tomasz, and Eder Maciej. Open stylometric system websty: Integrated language processing, analysis and visualisation. Computational Methods in Science and Technology, 24(1):0 43–58, 2018. . URL https://journal.r-project.org/archive/2016/RJ-2016-007/index.html. OpenAlex ↗ · Scholar ↗
- Christian Mair. Quantitative or qualitative corpus analysis? infinitival complement clauses in the survey of english usage corpus. Johansson and Stenström (eds.), pages 67–80, 1991. OpenAlex ↗ · Scholar ↗
- Danielle S McNamara, Arthur C Graesser, Philip M McCarthy, and Zhiqiang Cai. Automated evaluation of text and discourse with Coh-Metrix. Cambridge University Press, 2014. OpenAlex ↗ · Scholar ↗
- Rahul Mehta and Vasudeva Varma. Llm-rm at semeval-2023 task 2: Multilingual complex ner using xlm-roberta. arXiv preprint arXiv:2305.03300, 2023. OpenAlex ↗ · Scholar ↗
- Benjamin Minixhofer, Fabian Paischer, and Navid Rekabsaz. WECHSEL: Effective initialization of subword embeddings for cross-lingual transfer of monolingual language models. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 3992–4006, Seattle, United States, July 2022. Association for Computational Linguistics. . URL https://aclanthology.org/2022.naacl-main.293. our card
- Tempestt Neal, Kalaivani Sundararajan, Aneez Fatima, Yiming Yan, Yingfei Xiang, and Damon Woodard. Surveying stylometry techniques and applications. ACM Comput. Surv., 500 (6), nov 2017. ISSN 0360-0300. . URL https://doi.org/10.1145/3132039. OpenAlex ↗ · Scholar ↗
- Inez Okulska and Anna Zawadzka. Styles with benefits. the stylometrix vectors for stylistic and semantic text classification of small-scale datasets and different sample length. OpenAlex ↗ · Scholar ↗
- Lingwei Ouyang, Qianxi Lv, and Junying Liang. Coh-metrix model-based automatic assessment of interpreting quality. Testing and assessment of interpreting: Recent developments in China, pages 179–200, 2021. OpenAlex ↗ · Scholar ↗
- Dmytro Panchenko, Daniil Maksymenko, Olena Turuta, Mykyta Luzan, Stepan Tytarenko, and Oleksii Turuta. Ukrainian news corpus as text classification benchmark. In ICTERI 2021 Workshops: ITER, MROL, RMSEBT, TheRMIT, UNLP 2021, Kherson, Ukraine, September 28–October 2, 2021, Proceedings, pages 550–559. Springer, 2022. OpenAlex ↗ · Scholar ↗
- Andre Quispesaravia, Walter Perez, Marco Sobrevilla Cabezudo, and Fernando Alva-Manchego. Coh-metrix-esp: A complexity analysis tool for documents written in spanish. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), pages 4694–4698, 2016. OpenAlex ↗ · Scholar ↗
- Carolina Scarton and Sandra Maria Aluısio. Coh-metrix-port: a readability assessment tool for texts in brazilian portuguese. In Proceedings of the 9th International Conference on Computational Processing of the Portuguese Language, Extended Activities Proceedings, PROPOR, volume 10. sn, 2010. OpenAlex ↗ · Scholar ↗
- Stefan Schweter. Ukrainian electra model, November 2020. URL https://doi.org/10.5281/zenodo.4267880. OpenAlex ↗ · Scholar ↗
- Oleksiy Syvokon and Olena Nahorna. Ua-gec: Grammatical error correction and fluency corpus for the ukrainian language, 2021. OpenAlex ↗ · Scholar ↗
- A Tallón-Ballesteros and C Chen. Explainable ai: Using shapley value to explain complex anomaly detection ml-based systems. Machine learning and artificial intelligence, 332:0 152, 2020. OpenAlex ↗ · Scholar ↗
- Gunnel Tottie. Lexical diffusion in syntactic change: Frequency as a determinant of linguistic conservatism in the development of negation in english. Historical English syntax, pages 439–467, 1991. OpenAlex ↗ · Scholar ↗
- Peter A. Whigham, Caitlin A. Owen, and Stephen G. Macdonell. A baseline model for software effort estimation. ACM Trans. Softw. Eng. Methodol., 240 (3), may 2015. ISSN 1049-331X. . URL https://doi.org/10.1145/2738037. OpenAlex ↗ · Scholar ↗