Skip to content

This project explores sequence-to-sequence models for accurate grammar correction, designed to support various text inputs. Ideal for applications in automated writing feedback and language processing tasks.

License

Notifications You must be signed in to change notification settings

davidomanovic/nlp-lstm-grammar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grammar Checker with LSTM

This project is a simple implementation of a Grammar Checker using a Long Short-Term Memory (LSTM) neural network model. It uses PyTorch for deep learning, and the goal is to classify whether the individual words in a sentence are grammatically correct or incorrect. This is compatible with VSCode, or you can directly run in terminal :)

Project Structure

  • data/: Contains all training data and example sentences. Play around and edit them to your liking (just make sure they are reasonably similar to the vocabulary in the test set)!
  • src/: Contains the core logic including the LSTM model, data preprocessing, training, and saving the model. If you want to train the model, you have to run the train.py
  • tests/: Contains a testing script that loads the trained model, runs predictions, and prints the results.
  • models/: Contains the model of the Grammar Checker using the LSTM model

Requirements

  1. This project requires Python 3. You can install the required dependencies by running:
pip install -r requirements.txt
  1. Prepare your text data in the data/sentences.txt file. I have prefilled 30 sentences, and also test sentences.

  2. To train the model, run:

python src/train.py
  1. The model will be saved to the models/grammar_checker_model.pth directory.

  2. In tests/ you can simply run the code after training the model and generating the aforementioned file.

About

This project explores sequence-to-sequence models for accurate grammar correction, designed to support various text inputs. Ideal for applications in automated writing feedback and language processing tasks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published