Deep Learning Model to correct a sentence grammatically. Uses Seq2Seq model with Monotonic Attention.

Image credits

Table of Contents

  1. Dataset creation
  2. Attention mechanism
  3. Monotonic attention
  4. Implementation and Code Walkthrough
  5. Inference → Beam Search v/s Greedy Search
  6. Results and Error Analysis
  7. End to End Pipeline


Sequence-to-Sequence models are proving to be one of the best applications of Artificial Intelligence in the field of Natural Language Processing. Attention mechanism has improved the seq2seq models a lot by a simple concept of mimicking the human way of understanding a sentence.

In this blog, I have build a machine learning model which corrects basic grammatical mistakes in a sentence using Monotonic Attention.

Some of the perturbations addressed by my model are-

  1. Correcting…

Steps undertaken during preprocessing using regex

  1. Extracting Email
  2. Extracting Subject
  3. Decontractions
  4. Removing Write to: , From: , or:
  5. Removing data within brackets <> , ()
  6. Removing newlines, tabs
  7. Preprocessing person and city name with Chunking
  8. Removing digits
  9. Replacing “_word_” , “_word” , “word_” to word using Match Captures
  10. Miscellaneous


Natural language processing is a branch of AI which deals with language data. It basically is a branch where interaction between humans and achine is researched. Machine translation, text to speech, text classification — these are some of the applications of Natural Language Processing.

In this article, I am going…

Image courtesy of Wikimedia Commons

Table of Contents

  1. Understanding the Data
  2. Exploratory Data Analysis
  3. Feature engineering
  4. Relation between Geo locations with LSTMs
  5. Description of Methodology
  6. Final Preprocessed Data
  7. Training and Evaluation
  8. Conclusion
  9. References


As we are diving deep into the field of artificial intelligence, we are coming across ways in which AI can leverage human life and potentially save them from disasters in the coming future. One such small step towards this far but promising future is to use data from past and find some patterns which are universal in nature and which can promise some accurate prediction thereby helping humans minimize the effects of disaster. In…

Rishang Prashnani

Starting my career with Data Science.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store