Created
November 18, 2018 08:08
-
-
Save Dhrumilcse/66c8c6e50c216d38ce78a1190a885d24 to your computer and use it in GitHub Desktop.
Dictionary Part 4.1
This file contains 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
#Import library | |
import json | |
# This is a python library for 'Text Processing Serveices', as the offcial site suggests. | |
import difflib | |
from difflib import SequenceMatcher | |
#Let's load the same data again | |
data = json.load(open("dictionary.json")) | |
#Run a Sequence Matcher | |
#First parameter is 'Junk' which includes white spaces, blank lines and so onself. | |
#Second and third parameters are the words you want to find similarities in-between. | |
#Ratio is used to find how close those two words are in numerical terms | |
value = SequenceMatcher(None, "rainn", "rain").ratio() | |
#Print out the value | |
print(value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment