Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions sourcecodes/Interactive Dictionary/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Interactive Dictionary

## About

This is an interactive dictionary which gives definition of words inputted by the user

## Modules included

**json**

Python has a built-in package called json, which can be used to work with JSON data.

**difflib**

The difflib module contains tools for computing and working with differences between sequences. It is especially useful for comparing text, and includes functions that produce reports using several common difference formats.
1 change: 1 addition & 0 deletions sourcecodes/Interactive Dictionary/data.json

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions sourcecodes/Interactive Dictionary/interactive_dict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import json
from difflib import get_close_matches

data=json.load(open("data.json"))

def definition(w):
w=w.lower()
title=w.title()
W=w.upper()
if w in data:
return data[w]
elif title in data:
return data[title]
elif W in data:
return data[W]
elif len(get_close_matches(w,data.keys(),cutoff=0.75))>0 :
ans=input( "Did you mean {} . type 'Y' if you mean it or type 'N' for no : ".format(get_close_matches(w,data.keys(),cutoff=0.75)[0].upper()))
if ans.lower()=='y':
return definition(get_close_matches(w,data.keys(),cutoff=0.75)[0])
else:
return "The word doesn't exist"
else:
return "The word doesn't exist . Please verify it"


word = input("Enter the word: ")

output=definition(word)

if type(output)==list:
for i in output:
print(i)
else:
print(output)


7 changes: 7 additions & 0 deletions sourcecodes/Interactive Dictionary/untitled0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

import tensorflow as tf
a= tf.constant(6,name='a_cons')
b=tf.constant(3,name='b_cons')
div=tf.div(a,b,name='div')
sess=tf.Session()
sess.run(div)