Home Applications simple-spellchecker


This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
1 reviews
IPM installs
Pull requests
Norvig inspired simple spell checker implementation in InterSystems IRIS

What's new in this version

Add train by text

Simple Spell Checker

Can be used to suggest the correct spelling of text similar to Google “Did you mean” but based on a pure InterSystems IRIS ObjectScript implementation of Peter Norvig correct spelling suggestion algorithm.
You can read more about the approach in the original article.
It takes a given word and returns a suggestion of the probable correct spelling of the word.

The API can build a dictionary with correctly spelled words.


Make sure you have git and Docker desktop installed.


Open terminal and clone/git pull the repo into any local directory as shown below:

$ git clone https://github.com/henryhamon/simple-spellchecker

Open the terminal in this directory and run:

cd irisapp
$ docker-compose build

Installation with ZPM

zpm:USER>install simple-spellchecker

How to Test

Unit Test

Open IRIS terminal:

$ docker-compose exec iris iris session iris
IRISAPP>Set ^UnitTestRoot = "/opt/irisapp/src/SimpleSpellchecker/UnitTests/"
IRISAPP>Do ##class(%UnitTest.Manager).RunTest("","/loadudl")

Testing POST request

POST request are used to train the model, this REST API exposes two POST requests:

  1. To add words to dictionary
  2. To train using a text

1. To add words to dictionary

Prepare a collection of terms, e.g. in Postman with raw data in JSON. e.g.


Adjust the authorisation if needed - it is basic for container with default login and password for IRIS Community edition container

and send the POST request to localhost:52773/simplespellchecker/train/

This will build a dictionary with correctly spelled words.

2. To train using a text

Train a dictionary from a text document, just prepare the JSON with a text, e.g.

{"text":"A very long text here."}

In Assert folder has a sample training text document, obtained from Peter Norvig site that you can use to train the language model, it is a concatenation of public domain book excerpts from Project Gutenberg.

Testing PUT request

PUT request could be used to add a single term to dictionary.
E.g. we want to add the word spelling Prepare in Postman and send the put request to:


Testing DELETE request

Delete will completely remove a term from dictionary.
For delete request this REST API expects only the word to delete. E.g. if the spelling the following DELETE call will delete the record:


Testing GET requests

To spell check test GET you need to train the dictionary. You can create it with POST request (see above)

This REST API exposes two GET requests:

  1. The spell check
  2. A Frequency of a word in the dictionary

To spell check:


E.g. To get the correct word for speling


This will return JSON data for the suggestion word, something like that:

{"suggest": "spelling"}

To check the frequency of a particular word in the dictionary, a GET request like ‘localhost:52773/simplespellchecker/train/word’ . E.g.:


This will return JSON data with the frequency of this term in the dictionary , something like that:

    "frequency": 40,
    "actions": [
            "title": "Remove term from Trained Model",
            "method": "DELETE",
            "href": "/simplespellchecker/train/spelling",
            "fields": []

You can get swagger Open API 2.0 documentation on:



  • Henry “HammZ” Hamon Pereira github
Made with
zpm install simple-spellchecker download archive
1.0.125 Apr, 2020
Developer Environment
Works with
InterSystems IRISInterSystems IRIS for Health
First published
25 Apr, 2020
Last checked by moderator
27 Jun, 2023Works