summarize

package
v0.0.0-...-3e2dd4c Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2015 License: MIT Imports: 7 Imported by: 3

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) 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
}

type Summarize

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

func New

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

func NewFromString

func NewFromString(title, text string) 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