Skip to content

Repository files navigation

Korektor Czech Check API

Lightweight HTTP API wrapper around Korektor for Czech spellchecking.

Uses Korektor to generate corrected text and exposes structured matches similar to LanguageTool.


Features

  • Czech spellchecking using Korektor
  • Returns corrected text and structured matches
  • Match format includes offset, length, original text, and replacement
  • Docker-ready
  • Simple health check endpoint

API Overview

POST /check

Check text and return suggested corrections.

Request

{
  "text": "Tohle je spatne napsana veta."
}

Response

{
  "text": "Tohle je spatne napsana veta.",
  "corrected_text": "Tohle je spatně napsaná veta.",
  "matches": [
    {
      "message": "Replace \"spatne\" with \"spatně\".",
      "offset": 8,
      "length": 6,
      "original": "spatne",
      "replacement": "spatně",
      "issue_type": "misspelling"
    }
  ]
}

GET /health

Health check endpoint.

{
  "ok": true
}

Behavior

Korektor produces a corrected sentence.
This API compares the original and corrected text and extracts differences as structured matches.

  • Changes are expanded to whole words
  • Multiple character edits inside one word are merged

Issue Types

  • misspelling – word-level correction
  • punctuation – punctuation changes
  • spacing – whitespace adjustments
  • unknown – fallback category

Running with Docker

Build:

docker build -t korektor-service .

Run:

docker run -p 8010:8010 korektor-service

Custom port:

docker run -e PORT=8080 -p 8080:8080 korektor-service

Running with Docker Compose

docker compose up --build

Testing

Linux / macOS:

curl -X POST http://localhost:8010/check \
  -H "Content-Type: application/json" \
  -d '{"text":"Tohle je spatne napsana veta."}'

Windows (CMD):

curl -X POST http://localhost:8010/check -H "Content-Type: application/json" -d "{\"text\":\"Tohle je spatne napsana veta.\"}"

Limitations

  • Korektor provides only one corrected variant
  • No grammar explanations
  • Diff-based matching may be imperfect for complex rewrites
  • Designed for suggestions, not full grammar validation

Credits

This service uses Korektor developed by the Institute of Formal and Applied Linguistics, Charles University.


License

  • Korektor: BSD-2-Clause
  • Czech models: check UFAL license (may be non-commercial)

About

Lightweight Dockerized wrapper around Korektor by Institute of Formal and Applied Linguistics. Provides a simple HTTP API for Czech spellchecking and basic grammar correction.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages