ALLECS : A Lightweight Language Error Correction System (2023)

Abstract: In this paper, we present ALLECS, a lightweight web application to serve grammatical error correction (GEC) systems so that they can be easily used by the general public. We design ALLECS to be accessible to as many users as possible, including users who have a slow Internet connection and who use mobile phones as their main devices to connect to the Internet. ALLECS provides three state-of-the-art base GEC systems using two approaches (sequence-to-sequence generation and sequence tagging), as well as two state-of-the-art GEC system combination methods using two approaches (edit-based and text-based). ALLECS can be accessed at https://sterling8.d2.comp.nus.edu.sg/gec-demo/

## introduction english has become the de facto language for international discourse, spoken by approximately more than 1.4 billion speakers, with almost 75% of them being non-native speakers @xcite . as the number of english-as-a-second-language (esl) and english-as-a-foreign-language (efl) speakers keeps increasing, the need for automated tools to assist esl and efl speakers in learning and writing english also increases in tandem. grammatical error correction (gec) is a task that aims to automatically detect and correct errors that are present in a text, including grammatical errors, orthographic errors, misspellings, word choice errors, etc. @xcite . gec tools have a wide range of applications, including helping native speakers to correct their occasional mistakes, assisting language learners @xcite @xcite , and improving the quality of other 1 the source code and a video demonstration of allecs can be accessed at https://github.com/nusnlp/allecs . gec experienced significant progress in the last decade thanks to the hoo @xcite , @xcite , @xcite , and bea-2019 @xcite shared tasks. @xcite reported that state-of-the-art gec systems have exceeded human-level performance based on the standard evaluation metric, f 0.5 score. with the rapid progress in gec, different approaches emerged to achieve state-of-the-art performance, including system combination @xcite , sequence tagging @xcite , and sequence-to-sequence generation @xcite . even though many gec systems publicly publish their source code along with their trained models, these systems can typically only be run through a command-line interface on a highly capable computing resource. command-line interface is not easy to navigate for non-technical people and few people have access to a capable computing resource. these factors become a formidable barrier for the general public to benefit from the research progress of gec. in this paper, we present allecs (a lightweight language error correction system), a simple system to release gec models to the general public with a lightweight web-based interface. our web interface only requires 2.5 kb of data transfer overhead for each run. this means that allecs can be readily used by users in developing countries with slow internet connections @xcite . furthermore, we use a responsive design for the web interface, allowing it to be run comfortably on devices with various screen dimensions and sizes. this allows users to use the system through a mobile phone, which is the dominant device type to connect to the internet in developing countries @xcite . usability is important for people living in developing countries, as they are the ones who can benefit the most from a gec system. allecs can easily host gec systems using different approaches, including system combination. currently, allecs hosts two sequence-tagging base models, one sequence-to-sequence generation base model, and two combination methods. we briefly explain the base systems we use in al-lecs in section 3. allecs also easily allows the addition of other base models. to the best of our knowledge, allecs is the first web application with a graphical user interface for gec system combination methods. ## system overview the interface of allecs consists of five components, which are base model selection, combination method selection, output mode, input text box, and output text box. the user interface of allecs is shown in figure 1 . ## gec base systems and combination methods in allecs, we provide three base systems and two system combination methods. the base systems we provide come from two approaches, sequence-to-sequence generation (t5-large) and sequence tagging (gector). the combination methods we provide also come from two approaches, edit-based (esc) and text-based (memt) combination. the performance of the base systems and the combination methods on the bea-2019 development set, conll-2014 test set, and bea-2019 test set is presented in ## system design and implementation to make allecs more modular, we design it to have two parts: the web interface (front-end) and the base models' api (back-end). the web interface accepts a user's input text and handles the pre-processing and post-processing, while the base models' api focuses on generating a corrected sentence from the pre-processed input. this separation allows the base models' api to run on a gpu-powered server while the web interface runs on a cpu-focused server. however, both parts can also be run on the same server. as python has become the dominant programming language of choice for most nlp research projects, we develop allecs in python. this makes allecs highly extensible such that it can be used to host new gec systems in the future. the separation between the front-end and backend parts also allows allecs to host other base models that are written in a different programming language or use different library dependencies. this also allows the web interface to work with other closed-source gec models, as long as a gec model provides an api to generate a corrected sentence. we describe the process flow of allecs in figure 3 . all inputs are first split by line and segmented into sentences. the line index for each sentence is recorded to retain the text structure in the output. then, the web interface tokenizes the sentences and combines them into mini-batches to be sent to the base models' api. if the user chooses to highlight the corrections or combine multiple base models with esc, the web interface will also use errant to parse the input sentences. after receiving the output sentences from each base model, the interface will then parse the base models' outputs using errant if the user chooses to highlight corrections or use esc. if not, the outputs are sent to memt if the user chooses to combine the models with memt. otherwise, the output sentences are directly detokenized. detokenization also applies to the combination method's output if the user selects more than one base model. the correction speed of allecs is fast. running on an nvidia titan x gpu server with 12gb memory, gector roberta can correct text at a speed of 723 words per second, gector xlnet at 640 words per second, and t5-large at 37 words per second. using esc to combine base systems only adds a small amount of overhead. for example, using esc to combine gector roberta and t5-large can correct text at a speed of 32 words per second, marginally slower than using t5-large alone. ## related work there are some ready-to-use web services for correcting english text such as services from gram-11 conforming to wcag 2.1 orientation recommendation https://www.w3.org/tr/wcag/#orientation 12 https://flask-restful.readthedocs.io/en/ latest/ marly foot_6 and john snow labs foot_7 , but those web services are not open-source. thus, they are not customizable for deploying different gec systems. in this section, we will discuss the comparison of allecs to other open-source english correction tools, namely gecko+ @xcite and miss @xcite . ## conclusion we have presented allecs, a web-based application for gec that can be easily used by the general public. we design allecs to be accessible to as many users as possible, including users who have a slow internet connection and who use mobile phones as their main devices to connect to the internet. in allecs, we provide three base gec systems using two types of approaches, sequence-tosequence generation and sequence tagging, as well as two gec system combination methods from two types of approaches, edit-based and text-based combination. allecs is separated into two parts to make the application modular and easily extensible to other base gec systems.