GithubHelp home page GithubHelp logo

fasttext-spell-checker's Introduction

SPELL CHECKER deployed as a REST API using Flask

Classical probabilistic approaches have dominated spell checkings. This project uses a deep learning based approach to suggest upto three correct spelling recommendations for any given word.

Dataset for training

Web Inventory of Transcribed and Translated Talks; it is a ready-to-use version for research purposes of the multilingual transcriptions of TED talks.

Model architecture

The network architecture makes use of the architecture FastText, developed by Facebook. It has the advantage of traditional word vectors like Glove, word2vec etc in the sense that it can produce word vectors even for out-of-sample words. Also, for rare words it has been found be much more impactful than word vector representations.

Every word is represented in a 100-dimensional feature space and the model is trained on the data with window_size=5 and min_count=5 with the help of gensim library. The trained model contains 100-D representation of all possible unique characters of the training dataset.

Procedure

  • Start a virtual environment and install requirements
  • Run the file model.py. This will download your training data as well as train the FastText model on it, learn the representations and save them as model.bin
  • Write app.py which is the API application that will be deployed
  • Test the API

Testing the API

  1. Run the Flask API locally for testing. Go to directory with app.py
python app.py

This outputs

  * Serving Flask app "app" (lazy loading)
  * Environment: production
  * WARNING: Do not use the development server in a production environment.
  * Use a production WSGI server instead.
  * Debug mode: on
  * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
  * Restarting with stat
  * Debugger is active!
  * Debugger PIN: 154-300-115
  1. Using curl in a new terminal to make a GET request at the URL of the API
curl -X GET http://127.0.0.1:5000/spellCorrect -d query='sellection'
  1. Example of successful output
{
    "prediction": [
        "selection"
    ]
}

References

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.