Error Detection in English Writing | iNNovationMerge

Error Detection in English Writing


  • This Article on iNNovationMerge blog is for demonstration purpose.
  • Each demonstration presents risk and hazards that must be fully understood before attempting
  • It should be performed only by trained professionals
  • iNNovationMerge is not responsible for any loss or damage whatsoever caused
  • Before attempting understand the Experiment completely or Contact iNNovationMerge for any clarification to get started.

For Feedbacks | Enquiries | Questions | Comments - Contact us @


  • This article explains how we can build open source English Grammar Checker using Nodejs and HTML.


  • We may need someone to check our Grammar when we write a English sentences. This article may help you to write good English.


Software’s Required:

Network Requirements

  • Internet to download packages


Block Diagram

  • Block Diagram (Source: iNNovationMerge)

Package Information

  • There are several node packages available in node package manager(npm) as English Linter.
  • One of the package is Write-good. It has writeGood function that takes a string and returns an array of suggestions.
  • It checks for following suggestions
    • passive - Checks for passive voice.
    • illusion - Checks for lexical illusions – cases where a word is repeated.
    • so - Checks for so at the beginning of the sentence.
    • thereIs - Checks for there is or there are at the beginning of the sentence.
    • weasel - Checks for “weasel words.”
    • adverb - Checks for adverbs that can weaken meaning: really, very, extremely, etc.
    • tooWordy - Checks for wordy phrases and unnecessary words.
    • cliches - Checks for common cliches.

Setup Environment

  • Create a directory with the name detectEnglishError
  • Inside the created directory create following files

Create Backend Service using ExpressJS - index.js

  • The backend service uses express node package to create http server
  • It has two routes
    • / - To render index.html on request(http://localhost:3000/) from browser.
    • /getResult - This function receives English sentence from JavaScript in JSON format and passes it to write-good package to get and send the suggestions to HTML again.
const express = require('express')
const app = express()
var path = require('path');
var bodyParser = require('body-parser')
const port = 3000
var writeGood = require('write-good');
// parse application/json

//default route
app.get('/', (req, res) => res.sendFile(path.join(__dirname+'/index.html')))

//recieve text and detect English'/getResult', function(req, res, next) {
    var suggestions = writeGood(req.body.nnmTextArea);
app.listen(port, () => console.log(`App listening at http://localhost:${port}`))

Create Frontend using HTML, CSS and JS - index.html

  • The below HTML code has textarea to write a English sentences.
  • On click of button Detect Errors, javascript function(detectEnglish()) will be called.
  • function will capture the text written in textarea and sends as JSON to an backend node POST service getResult() .
  • The getResult() node service will return the suggestions and it will be displayed as alert in browser.
<!DOCTYPE html>
        .button {
          background-color: #4CAF50; /* Green */
          border: none;
          color: white;
          padding: 15px 32px;
          text-align: center;
          text-decoration: none;
          display: inline-block;
          font-size: 16px;
          margin: 4px 2px;
          cursor: pointer;
        .button2 {background-color: #008CBA;} /* Blue */

    <h1>iNNovation Merge Blog: Write good English</h1>

    <label for="sentence">Enter Your Sentence</label>
    <textarea id="nnmTextArea" rows="6" cols="100">

    <button class="button button2" onclick="detectEnglish()">Detect Errors</button>

    <script type = "text/JavaScript">
        function detectEnglish() {
            nnmTextArea = document.getElementById("nnmTextArea").value
            var xhttp = new XMLHttpRequest();
            xhttp.onreadystatechange = function() {
                if (this.readyState == 4 && this.status == 200) {
                    resultjson = JSON.parse(this.responseText)
                    if(resultjson.length > 0){
                        var resultString = ""
                            position = resultjson[k]['index']+resultjson[k]['offset']
                            resultString = resultString + "Position: "+ position + "\n" + "Reason: "+ resultjson[k]['reason'] + "\n\n"
                        alert("Great, No errors in sentence")
                    //document.getElementById("demo").innerHTML = this.responseText;
      "POST", "/getResult", true);
                xhttp.setRequestHeader("Content-type", "application/json");

install following packages

  • npm install express
  • npm install body-parser
  • npm install write-good

Run the code

  • Open command prompt from project directory
  • Run command - node index.js
  • open browser and open URL http://localhost:3000/
  • Great, Now start writing and get the suggestions from Frontend

Clone and Run the project

Download/Clone code