Grammatical-Error-Correction is an NLP-based spelling and grammar correction tool that accepts articles as well as raw text and returns a corrected sentence. Grammatical-Error-Correction is built using Python, powered by data and makes use of core NLP techniques. It is mainly based on AllenNLP
and transformers
.
Grammatical-Error-Correction can correct the spelling and grammar of sentences.
he go to scholl -> He goes to school
The first run will download the model. You will find the following information in the console.
Downloading grammatical error correction model [bert_0_gector]! Please wait a minute!
>>> from src.checker import GrammarCorrection
>>> grammar_correction = GrammarCorrection()
>>> input_sentence = 'he go to scholl'
>>> correct_sentence = grammar_correction.correct_sentence(input_sentence)
>>> correct_sentence
'He goes to school'
curl -X POST -H "Content-Type: application/json" -d '{"text":"he go to a school by bika every day."}' http://127.0.0.1:21046/api/texts
#return -> He goes to school by bike every day.
#environment python3.6
git clone https://github.com/imdreamer2018/Grammatical-Error-Correction.git
pip install -r requirements.txt
python app.py
click http://127.0.0.1:21046
- python3.6
- Java8
You can build your docker images or pull my docker images.
docker build .
docker run -itd --name grammatical-error-correction -p 21046:21046 -d [your docker image id]
docker pull imdreamer/grammatical-error-correction:v1.0
docker run -itd --name grammatical-error-correction -p 21046:21046 -d [your docker image id]
.
├── Dockerfile
├── README.md
├── app.py
├── data
│ ├── output_vocabulary
│ ├── predict_for_file
│ └── verb-form-vocab.txt
├── gector
│ ├── bert_token_embedder.py
│ ├── datareader.py
│ ├── gec_model.py
│ ├── seq2labels_model.py
│ ├── trainer.py
│ └── wordpiece_indexer.py
├── model
│ └── bert_0_gector.th
├── requirements.txt
├── src
│ └── checker.py
├── templates
│ └── index.html
└── utils
├── helpers.py
├── prepare_clc_fce_data.py
└── preprocess_data.py
- language_check (great spelling-correction library with extensive support for simple grammar suggestions, punctuation errors)
- GECToR(training and testing state-of-the-art models for grammatical error correction with the official PyTorch)
MIT © Imdreamer