Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions spellingcorrector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SpellCorrector
This is a basic spelling corrector which works on command line. You have to give text input as a command line argument
## Prerequisites

**Python 3.8.x**
**textblob package**

Install the requirements:

`python -m pip install -r requirements.txt --user`

Then you can run the script!

## Instructions to run the script

`python SpellCorrector.py text_input`
30 changes: 30 additions & 0 deletions spellingcorrector/SpellCorrector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Title :- Spell Corrector
# The Spell Corrector is an application which takes text input from the user and corrects spelling errors in it

from textblob import TextBlob
import sys

# Function for correcting spelling errors


def spell_correct(text):
spell = TextBlob(text)
# Using TextBlob.correct() method to correct spelling errors
after_correction = spell.correct()
return after_correction

# Takes text input from user and call the spell_correct() function


def main():
after_correction = ""
for text in map(spell_correct, sys.argv[1:]):
after_correction += str(text) + ' '
print(after_correction)

# Running the main() function


if __name__ == '__main__':

main()
1 change: 1 addition & 0 deletions spellingcorrector/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
textblob