document

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Config

type Config func(cfgs *Configs)

A Config represents a setting that changes the summarization process. For example, it may configure a custom token filter:

doc := document.Create(..., document.WithCustomFilter(filter))

func WithConjunctions added in v0.1.3

func WithConjunctions() Config

WithConjunctions disables removing conjunctions from the start of sentences.

func WithCustomKWFilter added in v0.2.0

func WithCustomKWFilter(filter basically.TokenFilter) Config

WithCustomKWFilter allows for a custom (black/white) token filter to be set for keyword extraction.

func WithCustomSFilter added in v0.2.0

func WithCustomSFilter(filter basically.TokenFilter) Config

WithCustomSFilter allows for a custom (black/white) token filter to be set for sentence extraction.

func WithCustomSimilarity added in v0.1.2

func WithCustomSimilarity(similarity basically.Similarity) Config

WithCustomSimilarity allows for a custom similarity function to be set.

func WithCustomThreshold added in v0.1.2

func WithCustomThreshold(threshold float64) Config

WithCustomThreshold sets the similarity threshold as per the specification. Lower threshold values correspond with sparser graphs, and higher threshold values correspond with denser graphs.

func WithoutFocus

func WithoutFocus() Config

WithoutFocus disables the use of a focus for ranking sentence scores.

func WithoutMergeQuotations

func WithoutMergeQuotations() Config

WithoutMergeQuotations disables merging sentences within quotations.

type Configs

type Configs struct {
	// contains filtered or unexported fields
}

Configs control the summarization process.

type Document

type Document struct {
	// Configurations and dependency injection.
	Configs     *Configs
	Summarizer  basically.Summarizer
	Highlighter basically.Highlighter
	Parser      basically.Parser
	// Document related information.
	Sentences []*basically.Sentence
	Words     []*basically.Token
	CharCount int
	SummCount int
}

Document is an implementation of basically.Document.

func (*Document) Characters added in v0.2.1

func (doc *Document) Characters() (int, int)

Characters returns the character count of the original text, and the summarized text (if any).

func (*Document) Highlight added in v0.2.0

func (doc *Document) Highlight(length int, merge bool) ([]*basically.Keyword, error)

Highlight returns a list of the keywords in the document.

func (*Document) Summarize

func (doc *Document) Summarize(length int, threshold float64, raw string) ([]*basically.Sentence, error)

Summarize returns a summary of given length corresponding to the top relevant phrases. A focus string may be provided to adjust the summary contents.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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