summarize

package module
v0.0.0-...-bfd4466 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonPair

type CommonPair struct {
	Text  string
	Count int
}

type CommonPairs

type CommonPairs []CommonPair

func (CommonPairs) Len

func (c CommonPairs) Len() int

func (CommonPairs) Less

func (c CommonPairs) Less(i, j int) bool

func (CommonPairs) Swap

func (c CommonPairs) Swap(i, j int)

type DefaultStopWords

type DefaultStopWords struct{}

func (DefaultStopWords) AppendStopWords

func (d DefaultStopWords) AppendStopWords(stopWords []string)

func (DefaultStopWords) IsStopWord

func (d DefaultStopWords) IsStopWord(word string) bool

func (DefaultStopWords) SetLanguage

func (d DefaultStopWords) SetLanguage(lang string)

type DefaultTextSplitter

type DefaultTextSplitter struct {
	Punctuations []rune
}

func (DefaultTextSplitter) Sentences

func (d DefaultTextSplitter) Sentences(text string) []string

func (DefaultTextSplitter) Words

func (d DefaultTextSplitter) Words(text string) []string

type StopWordsProvider

type StopWordsProvider interface {
	SetLanguage(string)
	IsStopWord(string) bool
	AppendStopWords([]string)
}

type StringTextSplitter

type StringTextSplitter struct {
	Punctuations []string
}

func (StringTextSplitter) OneOfPunct

func (d StringTextSplitter) OneOfPunct(r string, punct []string) bool

func (StringTextSplitter) OneOfStartQuote

func (d StringTextSplitter) OneOfStartQuote(r string, quotes [][]string) int

func (StringTextSplitter) Sentences

func (d StringTextSplitter) Sentences(text string) []string

func (StringTextSplitter) Words

func (d StringTextSplitter) Words(text string) []string

type Summarize

type Summarize struct {
	Title             string
	Text              string
	Language          string
	StopWordsProvider StopWordsProvider
	TextSplitter      TextSplitter
	EndSentenceRunes  []rune
	QuoteTuples       [][]rune
	IdealWordCount    int
	MaxSentences      int
}

func New

func New(title string, r io.Reader) Summarize

func NewFromString

func NewFromString(title, text string) Summarize

func NewFromStringWithOptions

func NewFromStringWithOptions(title, text string, stopWords []string, maxSentences int) Summarize

func (Summarize) KeyPoints

func (s Summarize) KeyPoints() []string

type TextCounter

type TextCounter map[string]int

func NewTextCounterFromPairs

func NewTextCounterFromPairs(pairs CommonPairs) TextCounter

func NewTextCounterFromSlice

func NewTextCounterFromSlice(words []string) TextCounter

func (TextCounter) Add

func (tc TextCounter) Add(text string, score ...int)

func (TextCounter) MostCommon

func (tc TextCounter) MostCommon(limit ...int) CommonPairs

type TextSplitter

type TextSplitter interface {
	Sentences(string) []string
	Words(string) []string
}

Jump to

Keyboard shortcuts

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