Skip to content

Instantly share code, notes, and snippets.

@Abdur-rahmaanJ
Forked from Dhrumilcse/dictionary_4-1.py
Created December 21, 2018 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Abdur-rahmaanJ/058e167a1ee2d5830e0deb797fe90438 to your computer and use it in GitHub Desktop.
Save Abdur-rahmaanJ/058e167a1ee2d5830e0deb797fe90438 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 Services', 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