An English Dictionary Implementation using, * requests * bs4 * sqlite3
The main method extracts the meaning of the word from the Cambridge Univ.site, if the meaning doesn't exist in the dictionary database. After parsing from the site, it prints the meaning and inserts the parsed values into the dictionary database. Once the meaning has been inserted into the dictionary database, look up takes O(1) time.
-
Download the package or on the command line type
pip install eng-dictionary
-
After successful installation,On the Python shell :
>>>import dictionary >>>obj = dictionary.Dictinary() >>>print(obj.lookup('<word you want to look up meaning for>')
-
To Use bs4 Component
>>> from dictionary import BrowseMeaning >>> obj = BrowseMeaning() >>> print(obj.search('<word you want to browse meaning for>'))
1. requests : To fetch the resources from Cambridge university url for Word meaning
2. bs4: To parse the innerHTML for the word's meaning from the Cambridge University site
3. sqlite3: To lookup for the meaning of the word in the database if it exists else, for parsing and inserting into the database
- Code Base Quality improved with unittest test cases.
- Extension & segregation of components in the eng_dictionary package
- Extension & Compatibility with Redis.