Project - RC Wordbook v1
Project - RC Wordbook v1
Akiatan
Year & Section: BSCE CEM 2A
SUBJECT: COMPUTER PROGRAMMING 2
PROJECT CODE:
FINAL ACTIVITY
https://replit.com/@rodmancarlot/FINAL-ACTIVITY
COMPILATION
https://replit.com/@rodmancarlot/Compilation#COMPILATION/activity6.py
HOW TO USE:
1. Open replit website
2. Click the code and run the program
3. Enter a word that you that you want to search and see its definitions
4. Definitions will show
5. click x if you are done searching the definition that you want.
TECHNICAL DETAILES
- the merriam webster dictionary api is a powerful tool for accessing a vast repository of
words and their meanings. here are some technical details about the api:
-
- api endpoint: the api endpoint is
https://www.dictionaryapi.com/api/v3/references/thesaurus/json/.
-
- api key: to use the api, you need to obtain an api key, which is required in the request url.
for example,
https://www.dictionaryapi.com/api/v3/references/thesaurus/json/umpire?key=yourkey
- response format: the api response is in json format.
- top-level keys: the response contains five top-level keys: meta, hwi, fl, def, and shortdef.
- meta: the meta key contains metadata about the word, including id, uuid, src, section,
stems, and syns.
- hwi: the hwi key contains headword information, including the hw string headword.
- fl: the fl key contains functional label information, which tells the grammatical function
of the word (e.g., noun, adjective, etc.).
- def: the def key contains definition information, including sense sequences and verb
dividers (transitive/intransitive). each sense sequence contains a series of senses, and
each sense contains a defining text array with the definition of the word and verbal
illustrations (example sentences).
FUTURE PLANS
- Creating an online dictionary is an ambitious and rewarding project that can serve a wide
audience. Here's an explanation of your future plans for the online dictionary you have
created:
- Vision and Purpose, The primary vision for the online dictionary is to provide a
comprehensive, user-friendly, and reliable resource for anyone seeking to understand
and use words effectively. The purpose is to make language learning and usage accessible
to everyone, regardless of their background or language proficiency.
- Features and Functionality, Extensive Word Database: The dictionary will feature a vast
database of words, including definitions, pronunciations, synonyms, antonyms, and
usage examples. Regular updates will ensure that the dictionary remains current and
relevant.
- User Interface and Experience: A clean, intuitive user interface will make it easy for users
to search for words, navigate through related terms, and explore the richness of the
language. Mobile optimization is a priority to ensure accessibility on various devices.
PHYTHON CODE:
import requests
def get_word_definition(word):
api_key = "2f27baff-7de7-4780-82a6-8bd26e2ade09"
url = f"https://www.dictionaryapi.com/api/v3/references/collegiate/json/{word}?key={api_key}"
try:
response = requests.get(url)
data = response.json()
if isinstance(data, list):
definition = data[0].get("shortdef")
if definition:
return definition[0]
else:
else:
except requests.exceptions.RequestException as e:
definition = get_word_definition(word_to_define)
print(definition)