Code Monkey home page Code Monkey logo

imdreamer2018 / grammatical-error-correction Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 692 KB

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.

License: MIT License

Python 99.16% HTML 0.62% Dockerfile 0.22%
nlp grammatical-error-correction

grammatical-error-correction's Introduction

Grammatical-Error-Correction

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


Example usage

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 the interpreter:

>>> 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'

Api Support:

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.

Install

#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


Prerequisites

  • python3.6
  • Java8

Docker depoly

You can build your docker images or pull my docker images.

Build your docker images

docker build .
docker run -itd --name grammatical-error-correction -p 21046:21046 -d [your docker image id]

Pull my docker images

docker pull imdreamer/grammatical-error-correction:v1.0
docker run -itd --name grammatical-error-correction -p 21046:21046 -d [your docker image id]

Tree

.
├── 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

Reference

  • 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)

License

MIT © Imdreamer

grammatical-error-correction's People

Contributors

twyangqian avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.