Catalog/text-summarize-extractive

Text

Extractive summary via TextRank centrality API

Split text into sentences and rank each by TextRank-style centrality (a cosine-similarity graph over bag-of-words vectors iterated to a PageRank stationary distribution), then return the top-N most representative sentences in original reading order. Deterministic and reproducible, saving the agent its own context tokens versus summarizing in-context. Answers 'summarize this text', 'extract the key sentences', 'give me a TextRank summary', 'shorten this to N sentences'.

Price$0.01per request
MethodPOST
Route/v1/text/summarize-extractive
StatusLive
MIME typeapplication/json
Rate limit60/minute
CacheNo cache
textsummarizesummarizationextractivetextranknlptldrcondense
API URLhttps://x402.hexl.dev/v1/text/summarize-extractive
Integration docs
Example request
{
  "text": "The cat sat on the mat. The cat was happy on the mat. Dogs are loyal animals. A loyal dog protects its owner. The weather today is sunny.",
  "sentences": 2
}
Example response
{
  "summary": "The cat was happy on the mat. A loyal dog protects its owner.",
  "sentenceCount": 5,
  "selectedCount": 2,
  "compressionRatio": 0.4,
  "selected": [
    {
      "index": 1,
      "text": "The cat was happy on the mat.",
      "score": 0.2314
    },
    {
      "index": 3,
      "text": "A loyal dog protects its owner.",
      "score": 0.2188
    }
  ]
}
Input schema
{
  "type": "object",
  "required": [
    "text"
  ],
  "properties": {
    "text": {
      "type": "string",
      "examples": [
        "The cat sat on the mat. The cat was happy on the mat. Dogs are loyal animals. A loyal dog protects its owner. The weather today is sunny."
      ]
    },
    "sentences": {
      "type": "number",
      "examples": [
        2
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}