Skip to content

Repository files navigation

sumer-banner

"The site of the earliest known civilization, located in the southernmost part of Mesopotamia, between the Tigris and Euphrates rivers, in the area that later became Babylonia and is now southern Iraq, from around Baghdad to the Persian Gulf."

Sumer

A Go library and command line utility for creating a summary from HTML or plain text files. This package also contains a simple evaluation framework for evaluating the various methods to generate text summaries.

Installation

go get github.com/chasedputnam/sumer

Usage

package main

import (
    "fmt"
    "github.com/chasedputnam/sumer"
    "github.com/chasedputnam/sumer/nlp"
)

func main() {
    // Create a parser and summarizer
    tok := nlp.NewTokenizer("english")
    parser := nlp.NewParser(tok)
    
    summarizer, err := sumer.NewSummarizer("lsa", "english")
    if err != nil {
        panic(err)
    }
    
    // Parse and summarize text
    doc := parser.Parse("Your text content here...")
    sentences := summarizer.Summarize(doc, 1)
    
    for _, s := range sentences {
        fmt.Println(s.Text())
    }
}

Supported Algorithms

  • lsa - Latent Semantic Analysis (default)
  • lexrank - LexRank graph-based ranking
  • textrank - TextRank graph-based ranking
  • luhn - Luhn's classic algorithm (1958)
  • edmundson - Weighted heuristics (cue, key, title, location)
  • sumbasic - Greedy probability maximization
  • kl - KL-divergence minimization
  • reduction - Pairwise word overlap
  • random - Random baseline

Architecture

See ARCHITECTURE.md for detailed documentation on the implementation.

License

MIT

About

Sumer — A pure-Go extractive text summarization library. Implements LSA, LexRank, TextRank, Luhn, Edmundson, SumBasic, KL-Sum, and Reduction algorithms with embedded stopword lists and Snowball stemming.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages