Skip to content

a google chrome extension for instant word definitions from wiktionary

Notifications You must be signed in to change notification settings

danialjivraj/word-definition-extension

Repository files navigation

word-definition-extension

dictionary image This Google Chrome extension provides quick access to word definitions from Wiktionary.
The local server must be running for the definitions to display in the extension, as, instead of relying on a public API, the word definitions are retrieved from a large JSON file within the project.

Functionality

The extension includes four tabs:

  • Definition

    • Search for a word
    • Select a word in your browser, and opening the extension will display its definition
    • Listen to its pronunciation by pressing the speech synthesis volume icon
    • Mark words as favorites
  • Favourite

    • View and manage your favorite words
    • Remove words from the favorites list
    • Click on a word to see its definition, which will redirect you to the Definition tab
  • Word of the Day

    • Discover a new word every day as this tab retrieves the daily word from word-of-the-day.json
  • Settings

    • Case sensitivity checkbox
    • Translation checkbox

Preview

searching for normal words with their respective meanings: searchingWords same word but with case sensitivity on, showcasing different meanings: searchingWords non-existent word in the english dictionary, without and with translation on: searchingWords other different tabs: searchingWords

Dependencies

To install all dependencies, run:

npm install

Running the Server

Download the JSONL data for all word senses in the English dictionary (≈2GB) and rename it to english-dictionary.json
Once downloaded, place it in the following directory: backend/dictionary/

To run the server, execute the following command:

node .\server.js

Note: Make sure you're in the backend directory to run the command.
          You will need Node.js installed to be able to run the server.

Add Extension to Google Chrome

In the browser, go to chrome://extensions/, click on Load unpacked (Developer mode must be on) and select the word-definition-extension folder.
The extension should be loaded successfully. You might need to click the puzzle icon to see it!

Tests

To run all tests, execute:

npm test

To run a specific test, use:

npm test -- --testNamePattern="name of the test here"

Docker

You can run the tests within Docker by executing the following script:

.\run-tests.bat

Note: Make sure you're in the backend\scripts directory to run the script.
          The script is only compatible with Windows because it is a .bat file.