Skip to content

Instantly share code, notes, and snippets.

@Dhrumilcse
Created November 18, 2018 08:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Dhrumilcse/66c8c6e50c216d38ce78a1190a885d24 to your computer and use it in GitHub Desktop.
Save Dhrumilcse/66c8c6e50c216d38ce78a1190a885d24 to your computer and use it in GitHub Desktop.
Dictionary Part 4.1
#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