textrank

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AB_ACRONYM_LETTERS = regexp.MustCompile(`([a-zA-Z])\.([a-zA-Z])\.`)
View Source
var REGEX_EMAIL = regexp.MustCompile("[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*")

Functions

func Contains

func Contains(s string, a []string) bool

Contains checks if a string 's' is present in array of strings 'a'

func CountCommonWords

func CountCommonWords(set1, set2 stringSet) int

func Intersect

func Intersect(set1, set2 stringSet) stringSet

func NewGraphForSentences

func NewGraphForSentences(sentences []sentence) graph

func NewStringSet

func NewStringSet(words []string) stringSet

func PickTopSentence

func PickTopSentence(scores []ScoreSentence) string

func PickTopSentencesByRatio

func PickTopSentencesByRatio(scores []ScoreSentence, ratio float64) []string

func PickTopSentencesByWordCount added in v0.3.0

func PickTopSentencesByWordCount(scores []ScoreSentence, wordCount int) []string

func PreProcessSentence

func PreProcessSentence(text string, language string, additionalStopWords []string) sentence

func PreProcessSentences

func PreProcessSentences(sentences []string, language string, additionalStopWords []string) []sentence

func PreProcessWords

func PreProcessWords(text, language string, deaccent bool, additionalStopWords []string) []word

func ScoreSentenceToText

func ScoreSentenceToText(scores []ScoreSentence) []string

Types

type Options

type Options struct {
	Debug               bool
	Language            string
	AdditionalStopWords []string
	DeAccent            bool
}

type ScoreSentence

type ScoreSentence struct {
	Score float64
	Text  string
	Index int
}

func Keywords

func Keywords(text string, options Options, ratio float64, numOutputWords int) ([]ScoreSentence, error)

func SummarizeSentences

func SummarizeSentences(sentencetexts []string, options Options) ([]ScoreSentence, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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