Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f808efb

Browse files
Merge pull request #91 from SaiSrichandra/spell-corrector
Spell corrector
2 parents 2f88ef6 + 38c7374 commit f808efb

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

‎spellingcorrector/README.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SpellCorrector
2+
This is a basic spelling corrector which works on command line. You have to give text input as a command line argument
3+
## Prerequisites
4+
5+
**Python 3.8.x**
6+
**textblob package**
7+
8+
Install the requirements:
9+
10+
`python -m pip install -r requirements.txt --user`
11+
12+
Then you can run the script!
13+
14+
## Instructions to run the script
15+
16+
`python SpellCorrector.py text_input`

‎spellingcorrector/SpellCorrector.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Title :- Spell Corrector
2+
# The Spell Corrector is an application which takes text input from the user and corrects spelling errors in it
3+
4+
from textblob import TextBlob
5+
import sys
6+
7+
# Function for correcting spelling errors
8+
9+
10+
def spell_correct(text):
11+
spell = TextBlob(text)
12+
# Using TextBlob.correct() method to correct spelling errors
13+
after_correction = spell.correct()
14+
return after_correction
15+
16+
# Takes text input from user and call the spell_correct() function
17+
18+
19+
def main():
20+
after_correction = ""
21+
for text in map(spell_correct, sys.argv[1:]):
22+
after_correction += str(text) + ' '
23+
print(after_correction)
24+
25+
# Running the main() function
26+
27+
28+
if __name__ == '__main__':
29+
30+
main()

‎spellingcorrector/requirements.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
textblob

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /