Skip to content

Latest commit

 

History

History
101 lines (80 loc) · 1.89 KB

File metadata and controls

101 lines (80 loc) · 1.89 KB

Lexicon - WordNet API Service

A lightweight REST API service providing WordNet dictionary lookup functionality, built with Bun and PostgreSQL.

Features

  • ⚡ Fast word lookup with fuzzy matching
  • Returns detailed word information including:
    • Definitions
    • Part of speech
    • Pronunciations
    • Examples
    • Synonyms
    • Antonyms
    • Similar words

Prerequisites

Setup

  1. Install dependencies:
bun install
  1. Create a .env file in the project root vyntr/.env:

Read the main README.md for instructions.

  1. Prepare the WordNet data:
    • Place WordNet XML file as wn.xml in the tools/src directory
    • Sync uv:
    cd tools/src
    uv sync
    • Run the conversion script:
    python convert_wn_xml_to_json.py
    • Load the data into PostgreSQL:
    python load_wordnet_into_db.py

API

Start the API server:

bun run index.ts

API Endpoints

GET /lookup/{word}

Look up a word with fuzzy matching support.

Parameters:

  • word (path parameter): The word to look up

Response:

[
  {
    "similarity": 1.0,
    "entry": {
      "id": "string",
      "word": "string",
      "partOfSpeech": "string",
      "pronunciations": ["string"],
      "definitions": [
        {
          "pos": "string",
          "gloss": "string",
          "source": "string"
        }
      ],
      "examples": ["string"],
      "synonyms": ["string"],
      "antonyms": ["string"],
      "similarWords": ["string"]
    }
  }
]

GET /health

Health check endpoint.

Response:

  • 200 OK with body: "OK"

License

This project uses WordNet data which is subject to the WordNet 1 License 2.