Git Product home page Git Product logo

oxford-dictionary's Introduction

Oxford-Dictionary

This is a Dictionary written in python, you can search for meanings of any word which is on your mind

This is Program in python to basically search for the meaning of any word you wish to search. I have also added an additional feature to the program ie:- It also shows you suggestion for the closet word for your searched word if in any case you have misspelled or the word does not exist in the dictionary,it will show you the recommendation for that word

This is a simple program where I have used the json module(To import json file) and the get_close_matches function(To find the closest match) of the difflib module. The word user is searched in the json file which I am importing in the program and returns the exact meaning of the word searched.

I have uploaded the json file through file upload,feel free to use it.

Code-

import json
from difflib import get_close_matches

def dictionary(word):
 	if word in Jdata:
 		return (Jdata[word])

 	elif word.title() in Jdata:
 		return (Jdata(word.title()))
 	elif word.upper() in Jdata:
 		return (Jdata[word.upper()])
 	elif len(get_close_matches(word,Jdata.keys())) > 0:
 		print("Did you mean %s ???"%get_close_matches(word,Jdata.keys())[0])
 		ask=input("If Yes press y or else press n for No :")
 		if ask == "y":
 			print(get_close_matches(word,Jdata.keys())[0])
 			inst=get_close_matches(word,Jdata.keys())[0]
 			if inst in Jdata:
 				return (Jdata[inst])		
 		elif ask == "n":
 			print("Sorry,could'nt find the word in the dictionary")
 		else:
 			print("You have entered a wrong  input")
 	else:
 		print("Sorry,could'nt find the word in the dictionary")

pass

Jdata=json.load(open('C:/Users/91787/Desktop/Python_Udemy/Dictionary_Content.json'))
word=input("Please enter the word you want to search:")
output=dictionary(word)
if type(output)== list:
	for item in output:
		print(item)
else:
	print(output)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.