This repository was archived by the owner on May 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Created spellchecker.py in Spell_checker folder #243
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
projects/Spell_checker/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Script Title | ||
<!--Remove the below lines and add yours --> | ||
Here, you can input any word and check if it is having a correct spelling or not. | ||
|
||
### Prerequisites | ||
<!--Remove the below lines and add yours --> | ||
First thing which you need to install is textblob library | ||
<!--Install library--> | ||
>pip install textblob | ||
<!--For jupyter nb--> | ||
You need to run this command in your terminal or your ide terminal. | ||
<!--for jp nb--> | ||
If you are using Jupyter Notebook you need to use the below command | ||
<!--for jp nb--> | ||
>import sys | ||
<!--command--> | ||
>!{sys.executable} -m pip install textblob | ||
|
||
### How to run the script | ||
<!--Remove the below lines and add yours --> | ||
You can first install the textblob library and then you can run the python script. | ||
|
||
## *Author Name* | ||
<!--Remove the below lines and add yours --> | ||
[Hariom1509](https://github.com/Hariom1509) |
12 changes: 12 additions & 0 deletions
projects/Spell_checker/spell_checker.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from textblob import TextBlob # importing textblob library | ||
|
||
t = 1 | ||
while t: | ||
a = input("Enter the word to be checked:- ") # incorrect spelling | ||
print("original text: "+str(a)) #printing original text | ||
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of asking for a word to be checked, ask for an input string; words = list(a.split()) |
||
|
||
b = TextBlob(a) #correcting the text | ||
|
||
Comment on lines
+7
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now, you can simply edit this: b = [] for word in a: b.append(TextBlob(word).correct()) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I will commit this👍 |
||
# prints the corrected spelling | ||
print("corrected text: "+str(b.correct())) | ||
Comment on lines
+10
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And finally: print("Corrected string: " + str(b.join(" ")) |
||
t = int(input("Try Again? 1 : 0 ")) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.