summary

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

ABOUTME: This file provides automatic content summary generation from HTML content. ABOUTME: It supports extracting summaries based on sentence count with intelligent fallbacks.

Index

Constants

View Source
const DefaultCharacterFallback = 150

DefaultCharacterFallback is the fallback character limit when sentence extraction fails.

View Source
const DefaultSummaryLength = 2

DefaultSummaryLength is the default number of sentences to extract for summaries.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	// SentenceCount is the number of sentences to extract for summaries
	SentenceCount int
	// CharacterFallback is the character limit for fallback summaries
	CharacterFallback int
}

Generator handles summary generation from HTML content.

func New

func New() *Generator

New creates a new summary generator with default settings.

func (*Generator) Generate

func (g *Generator) Generate(description string, htmlContent template.HTML) string

Generate creates a summary from HTML content. It follows this priority: 1. Manual override (description parameter) - if provided, use it 2. Auto-extract first N sentences from HTML content 3. Fallback to first N characters with ellipsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL