textkit

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package textkit provides helpers to normalize and process text.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeHTMLToText

func NormalizeHTMLToText(htmlDocument string) string

func Summarize

func Summarize(text string, keepIfUnder int, truncateAfter int) string

Summarize returns a summary of the given text.

If the text is shorter than keepIfUnder characters, it is returned as is. The summary is then built by keeping the first paragraphs, up to truncateAfter characters.

Types

type TextRanker

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

A TextRanker normalizes and processes text to extract the top ranking phrases and keywords.

func NewTextRanker

func NewTextRanker() *TextRanker

NewTextRanker initializes and returns a new TextRanker.

func (*TextRanker) RankTopNPhrases

func (t *TextRanker) RankTopNPhrases(text string, topN int) []string

RankTopNPhrases extracts the top N ranking phrases using TextRank.

func (*TextRanker) RankTopNWords

func (t *TextRanker) RankTopNWords(text string, topN int) []string

Jump to

Keyboard shortcuts

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