Object PageSummaryIndexService
-
- All Implemented Interfaces:
public class PageSummaryIndexServiceWeb Page Summary Index (WPSI) — generates a compressed, AI-readable YAML summary from a parsed FeaturedDocument.
The summary is typically 0.1%–1% the size of the original HTML while preserving:
Page metadata and type inference
Landmark structure (header, nav, main, footer, etc.)
Scored key content nodes with CSS selector hints
Repeated structure detection (lists, tables)
Aggregated statistics
Every summary node carries its
viattribute (bounding box) so it can be traced back to the original DOM element.The algorithm is fully deterministic — no AI model is involved.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classPageSummaryIndexService.SummaryIndexedNodeIndexed DOM node, identified by its
viattribute (bounding box).public final classPageSummaryIndexService.SummaryScoredNodepublic final classPageSummaryIndexService.SummaryListGrouppublic final classPageSummaryIndexService.SummaryTableInfopublic final classPageSummaryIndexService.SummaryStatspublic final classPageSummaryIndexService.LinkInfoA single extracted link within a sample item.
public final classPageSummaryIndexService.LinkGroupItemOne sample item from a link group.
public final classPageSummaryIndexService.SummaryLinkGroupA detected link group — repeating visual card pattern containing links.
-
Field Summary
Fields Modifier and Type Field Description public final static PageSummaryIndexServiceINSTANCE
-
Method Summary
Modifier and Type Method Description final Stringgenerate(FeaturedDocument document, String pageUrl, String title)Generate a WPSI YAML summary from a FeaturedDocument. final List<PageSummaryIndexService.SummaryLinkGroup>detectLinkGroups(FeaturedDocument document)Detect link groups — coherent collections of item cards where each card contains one or more links. -
-
Method Detail
-
generate
final String generate(FeaturedDocument document, String pageUrl, String title)
Generate a WPSI YAML summary from a FeaturedDocument.
- Parameters:
document- The parsed DOM document (never mutated — the algorithm works on a clone).pageUrl- The normalized page URL.title- The page title (from FeaturedDocument.title).- Returns:
A YAML string suitable for saving to a
.ymlfile.
-
detectLinkGroups
final List<PageSummaryIndexService.SummaryLinkGroup> detectLinkGroups(FeaturedDocument document)
Detect link groups — coherent collections of item cards where each card contains one or more links.
Algorithm: cluster by visual geometry (bounding box), then walk up the DOM to find the nearest container element.
-
-
-
-