Giter Site home page Giter Site logo

wordfacenet's Introduction

Transformer-Encoder generated context-aware embeddings for spell correction

Official implementation

To train the model:

python train --input input_file.csv --eval eval_file.csv --epochs 100 --batch_size 128

The default arguments were optimized for NVIDIA RTC 1080 Ti GPU. Additional configuration details can be found in config.py.

Dockerfile can be used to replicate the running environment.

To monitor the training:

tensorboard --logdir output/{runid}/log

The runid can be found and modified in config.py

Abstract

In this paper, we propose a novel approach for context-aware spell correction in text documents. We present a deep learning model that learns a context-aware character-level mapping of words to a compact embedding space. In the embedding space, a word and its spell variations are mapped close to each other in Euclidean distance. After we develop this mapping for all words in the dataset’s vocabulary, it is possible identify and correct wrongly spelt words by comparing the distances of their mappings with those of the correctly spelt words. In this space, Euclidean distance can be deemed as a context-aware string similarity metric. Further, the embeddings also capture context of the word, which enables us to identify contextual misspellings like their/there, your/you’re, piece/peace etc and correct them.

We employ a transformer-encoder model that takes character-level input of words and their context to achieve this. The embeddings are generated as output of the model. The model is then trained to minimize triplet loss, which ensures that spell variants of a word are embedded close to the word, and that unrelated words are embedded farther away. Since our model also captures context, words that have similar spellings when spelt correctly but appear in different contexts (e.g., piece/peace) would not be close-by in the embedding space. We further improve the efficiency of training by using a hard triplet mining approach.

Authors

  1. Noufal [email protected]
  2. Dr. Hani Ragab [email protected]

wordfacenet's People

Contributors

kvsnoufal avatar

Stargazers

Uyghur avatar

Watchers

James Cloos avatar  avatar

Forkers

gheyret

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.