textrank

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package textrank 包含提取关键词

Index

Constants

View Source
const (
	// DEFAULT_MAX_ITER 默认maxIter
	DEFAULT_MAX_ITER int = 100
	// DEFAULT_TOL 默认tol
	DEFAULT_TOL float64 = 0.0001
	// DEFALUT_WINDOW 默认window
	DEFAULT_WINDOW int = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Keywords

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

Keywords 提取关键词类

func NewKeywords

func NewKeywords(seg *segment.Segment, stwords *stopwords.Stopwords) *Keywords

New 初始化

func (*Keywords) AddStopwords

func (k *Keywords) AddStopwords(keywords []string)

AddStopwords 添加stopword

func (*Keywords) DelStopwords

func (k *Keywords) DelStopwords(keywords []string)

DelStopwords 删除stopword

func (*Keywords) Extract

func (k *Keywords) Extract(txt string, n int) []string

Extract 提取关键词

func (*Keywords) LoadStopwords

func (k *Keywords) LoadStopwords(r io.Reader) error

LoadStopwords 加载stopwords

func (*Keywords) LoadStopwrdsFile

func (k *Keywords) LoadStopwrdsFile(filename string) error

LoadStopwordsFile 加载stopwords文件

func (*Keywords) SetMaxIter

func (k *Keywords) SetMaxIter(maxIter int)

SetMaxIter 设置maxIter

func (*Keywords) SetTol

func (k *Keywords) SetTol(tol float64)

SetTol 设置tol

func (*Keywords) SetWindow

func (k *Keywords) SetWindow(window int)

SetWindow 设置window

type Score

type Score struct {
	Idx   int
	Value float64
}

type ScoreSlice

type ScoreSlice []Score

func NewScoreSlice

func NewScoreSlice(scores []float64) ScoreSlice

func (ScoreSlice) Len

func (s ScoreSlice) Len() int

func (ScoreSlice) Less

func (s ScoreSlice) Less(i, j int) bool

func (ScoreSlice) Swap

func (s ScoreSlice) Swap(i, j int)

type Summarize

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

func NewSummarize

func NewSummarize(seg *segment.Segment, stwords *stopwords.Stopwords) *Summarize

New 初始化

func (*Summarize) AddStopwords

func (s *Summarize) AddStopwords(keywords []string)

AddStopwords 添加stopword

func (*Summarize) DelStopwords

func (s *Summarize) DelStopwords(keywords []string)

DelStopwords 删除stopword

func (*Summarize) LoadStopwords

func (s *Summarize) LoadStopwords(r io.Reader) error

LoadStopwords 加载stopwords

func (*Summarize) LoadStopwordsFile

func (s *Summarize) LoadStopwordsFile(filename string) error

LoadStopwordsFile 加载stopwords文件

func (*Summarize) SetMaxIter

func (s *Summarize) SetMaxIter(maxIter int)

SetMaxIter 设置maxIter

func (*Summarize) SetTol

func (s *Summarize) SetTol(tol float64)

SetTol 设置tol

func (*Summarize) Summary

func (s *Summarize) Summary(txt string, n int) []string

Summary 生成摘要

Jump to

Keyboard shortcuts

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