Giter Site home page Giter Site logo

sh-wordautocorrect's Introduction

WordAutoCorrect

Auto Correct words based on Shakespeare corpus

The code checks your given word is correct based on Shakespeare's corpus or needs to be replaced.

Instructions:

1- The function 'Deleted_letter' returns all of the possible permutation(whether meaningful or meaningless) of your given word by subtracting one letter.

Deleted_letter('ate')
Output = ['at','te','ae']

2- The function 'Replace_letter' returns all of the possible words(whether meaningful or meaningless) that will create by replacing one letter of your given word.

Replace_letter('at')
Output = ['aa','ab',...,'zt']

3- The function 'Insert_letter' return all of the possible words(whether meaningful or meaningless) that will create by adding one letter to your given word.

Insert_letter('as')
Output = ['asa','aas' , 'abs' , ... ]

4- The function 'edit_one_letter' return all possible permutations of your given word with above three functions as a dictionary.
5- The function 'edit_two_letter' return all possible permutations of your given word using exactly two stacked above functions as a dictionary.
6- If the words in two dictionaries didn't exist in Shakespeare's corpus then we remove them from the dictionaries.
7- Every generated word has unique cost:

  • if the word is created by Deleted_letter & Insert_letter functions then it has cost 1.
  • if the word is created by Replace_letter fucntion, it has cost 2.

8- Now we choose one word with minimum cost as a replacement for the given word.
9- If more than one word has the same minimum cost, we calculate the unigram of them then choose the word with a maximum occurrence probability.

Example : 
Your word: flw
The code output: flow.

sh-wordautocorrect's People

Contributors

iamjalipo avatar

Stargazers

 avatar Amin avatar Arman Yekkehkhani avatar

Watchers

 avatar

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.