Expand description
Full-featured extractive and abstractive-style document summarization.
DocumentSummarizer implements five summarization strategies driven by TF-IDF,
position bias, sentence length heuristics, and optional embedding centrality:
- Extractive — score every sentence and return the top-k in original order.
- Keyphrase — extract the most significant 2–4-word n-gram keyphrases.
- Headline — return the single most important sentence, truncated.
- Abstractive — concatenate top-3 sentences with transition words stripped, trimmed to a target word count.
- Hierarchical — cluster sentences and pick one representative per cluster.
Re-exports§
pub use ds_types::DocumentChunk;pub use ds_types::SentenceScore;pub use ds_types::SummarizerConfig;pub use ds_types::SummarizerError;pub use ds_types::SummarizerStats;pub use ds_types::SummaryResult;pub use ds_types::SummaryStyle;
Modules§
- ds_
types - Type definitions for the document summarizer.
Structs§
- Document
Summarizer - Production-quality document summarizer supporting five summarization strategies.
Functions§
- cosine_
similarity - Cosine similarity between two f64 slices; returns 0.0 on dimension mismatch or zero norm.
- split_
sentences - Split
textinto sentences on'. ','! ','? ', and'\n\n'boundaries. - tf_idf
- Compute TF-IDF for
termgiven the tokens of its document and the full corpus. - tokenize
- Tokenize
textinto lowercase alphanumeric tokens. - xorshift64
- Minimal xorshift64 PRNG; used in tests to avoid the
randcrate.