Package: ua-gec
УкраїнськоюUA-GEC: Grammatical Error Correction and Fluency Corpus for the Ukrainian LanguageThis repository contains UA-GEC data and an accompanying Python library.What's newNovember 2022: Version 2.0 released, featuring more data and detailed annotations.January 2021: Initial release.SeeCHANGELOG.mdfor detailed updates.DataAll corpus data and metadata stay under the./data. It has two subfolders
forgec-fluency and gec-only corpus versionsBoth corpus versions contain two subfolderstrain and test splitswith different data
representations:./data/{gec-fluency,gec-only}/{train,test}/annotatedstores documents in theannotated format./data/{gec-fluency,gec-only}/{train,test}/sourceand./data/{gec-fluency,gec-only}/{train,test}/targetstore the
original and the corrected versions of documents. Text files in these
directories are plain text with no annotation markup. These files were
produced from the annotated data and are, in some way, redundant. We keep them
because this format is convenient in some use cases.Metadata./data/metadata.csvstores per-document metadata. It's a CSV file with
the following fields:id(str): document identifier;author_id(str): document author identifier;is_native(int): 1 if the author is native-speaker, 0 otherwise;region(str): the author's region of birth. A special value "Інше"
is used both for authors who were born outside Ukraine and authors
who preferred not to specify their region.gender(str): could be "Жіноча" (female), "Чоловіча" (male), or "Інша" (other);occupation(str): one of "Технічна", "Гуманітарна", "Природнича", "Інша";submission_type(str): one of "essay", "translation", or "text_donation";source_language(str): for submissions of the "translation" type, this field
indicates the source language of the translated text. Possible values are
"de", "en", "fr", "ru", and "pl";annotator_id(int): ID of the annotator who corrected the document;partition(str): one of "test" or "train";is_sensitive(int): 1 if the document contains profanity or offensive language.Annotation formatAnnotated files are text files that use the following in-text annotation format:{error=>edit:::error_type=Tag}, whereerrorandeditstand for a text item before
and after correction respectively, andTagdenotes an error category and an error subcategory in case of Grammar- and Fluency-related errors.Example of an annotated sentence:I {likes=>like:::error_type=G/Number} turtles.Below you can see a list of error types presented in the corpus:Spelling: spelling errors;Punctuation: punctuation errors.Grammar-related errors:G/Case: incorrect usage of case of any notional part of speech;G/Gender: incorrect usage of gender of any notional part of speech;G/Number: incorrect usage of number of any notional part of speech;G/Aspect: incorrect usage of verb aspect;G/Tense: incorrect usage of verb tense;G/VerbVoice: incorrect usage of verb voice;G/PartVoice:  incorrect usage of participle voice;G/VerbAForm:  incorrect usage of an analytical verb form;G/Prep: incorrect preposition usage;G/Participle: incorrect usage of participles;G/UngrammaticalStructure: digression from syntactic norms;G/Comparison: incorrect formation of comparison degrees of adjectives and adverbs;G/Conjunction: incorrect usage of conjunctions;G/Other: other grammatical errors.Fluency-related errors:F/Style: style errors;F/Calque: word-for-word translation from other languages;F/Collocation: unnatural collocations;F/PoorFlow: unnatural sentence flow;F/Repetition: repetition of words;F/Other: other fluency errors.An accompanying Python package,ua_gec, provides many tools for working with
annotated texts. See its documentation for details.Train-test splitWe expect users of the corpus to train and tune their models on thetrainsplit
only. Feel free to further split it into train-dev (or use cross-validation).Please use thetestsplit only for reporting scores of your final model.
In particular, never optimize on the test set. Do not tune hyperparameters on
it. Do not use it for model selection in any way.Next section lists the per-split statistics.StatisticsUA-GEC contains:GEC+FluencySplitDocumentsSentencesTokensAuthorsErrorstrain1,70631,038457,01775238,213test1662,69743,601767,858TOTAL1,87233,735500,61882846,071Seestats.gec-fluency.txtfor detailed statistics.GEC-onlySplitDocumentsSentencesTokensAuthorsErrorstrain1,70631,046457,00475230,049test1662,70443,605766,169TOTAL1,87233,750500,60982836,218Seestats.gec-only.txtfor detailed statistics.Python libraryAlternatively to operating on data files directly, you may use a Python package
calledua_gec. This package includes the data and has classes to iterate over
documents, read metadata, work with annotations, etc.Getting startedThe package can be easily installed bypip:$ pip install ua_gecAlternatively, you can install it from the source code:$ cd python
    $ python setup.py developIterating through corpusOnce installed, you may get annotated documents from the Python code:>>>fromua_gecimportCorpus>>>corpus=Corpus(partition="train",annotation_layer="gec-only")>>>fordocincorpus:...print(doc.source)# "I likes it."...print(doc.target)# "I like it."...print(doc.annotated)# <AnnotatedText("I {likes=>like} it.")...print(doc.meta.region)# "Київська"Note that thedoc.annotatedproperty is of typeAnnotatedText. This
class is described in thenext sectionWorking with annotationsua_gec.AnnotatedTextis a class that provides tools for processing
annotated texts. It can iterate over annotations, get annotation error
type, remove some of the annotations, and more.Here is an example to get you started. It will remove all F/Style annotations from a text:>>>fromua_gecimportAnnotatedText>>>text=AnnotatedText("I {likes=>like:::error_type=G/Number} it.")>>>forannintext.iter_annotations():...print(ann.source_text)# likes...print(ann.top_suggestion)# like...print(ann.meta)# {'error_type': 'Grammar'}...ifann.meta["error_type"]=="F/Style":...text.remove(ann)# or `text.apply(ann)`Multiple annotatorsSome documents are annotated with multiple annotators. Such documents
sharedoc_idbut differ indoc.meta.annotator_id.Currently, test sets for gec-fluency and gec-only are annotated by two annotators.
The train sets contain 45 double-annotated docs.ContributingData and code improvements are welcomed. Please submit a pull request.CitationTheaccompanying paperis:@misc{syvokon2021uagec,
      title={UA-GEC: Grammatical Error Correction and Fluency Corpus for the Ukrainian Language},
      author={Oleksiy Syvokon and Olena Nahorna},
      year={2021},
      eprint={2103.16997},
      archivePrefix={arXiv},
      primaryClass={cs.CL}}Contactsnastasiya.osidach@grammarly.comolena.nahorna@grammarly.comoleksiy.syvokon@gmail.compavlo.kuchmiichuk@gmail.com