Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Summarizer AI Block for Svelte

A summarizer with an editable source text and a summary of 2, 4 or 6 sentences as a paragraph or bullets, picked by word frequency in the browser, with the reduction counted and the picked sentences markable.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Make a long text shorter by choice, with this summarizer for Svelte with Ark UI. A compact header names Gistmoor, a reading assistant, and a hairline frame with a plus mark on each corner holds a Toggle Group for the length (Short 2, Medium 4, Long 6 sentences), another for the format (paragraph or bullets) and a Switch, Show picked sentences. Under them a Textarea at the start holds a typed 221-word article about a library's late reading room, editable, and the summary sits at the end. The summary is worked out in the browser: each sentence is scored by how often its content words appear in the whole text, the best ones are kept in their original order and quoted as written, so it never rewrites anything. "Reduced by 58%" is counted from the words on both sides, the switch swaps the field for the same text with the picked sentences marked and numbered, and a Copy Button puts the summary on the clipboard. Guides draw the frame. For reading tools, newsletters and any place a long text needs a shorter view.

FAQ

What stays in the page, and how do I make it real?

Everything. The summary is computed in your browser from the text in the field; nothing is sent and no model runs. The article is typed in the file. To wire a real model in, send the text to it where you read source and show its answer in the same box; the length and format controls and the Copy button need no change.

How does it pick sentences?

It splits the text after each full stop, question mark or exclamation mark, counts the words that remain once common words such as the and of are ignored, and gives each sentence the sum of its words' counts divided by the square root of how many it has. The highest scores win, and the winners are shown in the order they were written. It is a classic extractive method: simple, repeatable and easy to explain, but not a reader.

Where does it go wrong?

It treats a full stop followed by a space as the end of a sentence, so an abbreviation can split a sentence in two, and it knows nothing about meaning, so it may keep a sentence that only repeats a frequent word. It works best on plain prose of a few paragraphs.

What does Reduced by mean, and what do the marks show?

The share of the source's words that the summary leaves out, rounded: a 221-word text summarised to 92 words reads "Reduced by 58%". With Show picked sentences on, the field is replaced by the same text where each picked sentence is tinted and numbered in summary order, and screen readers hear "Picked sentence 2". Turning it off brings the editable field back with your text.

How does it work from the keyboard?

Both groups take the arrow keys, Space or Enter picks an option, and one option is always on. The switch, the field, the Sample text button and Copy summary are ordinary controls, and a polite status line says what changed, including "Copied the summary."

Does it work in a right-to-left language?

Yes. The source and the summary follow the direction of the text, the source sits at the start and the summary at the end, and counts and percentages keep their order. The word list that ignores common words is English, so another language will summarise less well until you replace it.