Catalog/rag-keyword-overlap

Retrieval

Query-doc keyword overlap API

Returns shared keywords, overlap coefficient, and query coverage between a query and a document. Answers 'Which query keywords appear in this document?', 'What fraction of my query does this doc cover?'.

Price$0.01per request
MethodPOST
Route/v1/retrieval/keyword-overlap
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
keywordoverlaplexicalcoveragequerydocumentretrievalrag
API URLhttps://x402.hexl.dev/v1/retrieval/keyword-overlap
Integration docs
Example request
{
  "query": "machine learning models",
  "document": "deep learning neural models"
}
Example response
{
  "sharedTerms": [
    "learning",
    "models"
  ],
  "sharedCount": 2,
  "queryTerms": 3,
  "documentTerms": 4,
  "overlapCoefficient": 0.66666667,
  "queryCoverage": 0.66666667,
  "formula": "overlap = |Q∩D| / min(|Q|,|D|)"
}
Input schema
{
  "type": "object",
  "required": [
    "query",
    "document"
  ],
  "properties": {
    "query": {
      "type": "string"
    },
    "document": {
      "type": "string"
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}