💾 Archived View for godocs.io › github.com › afjoseph › RAKE.Go captured on 2021-12-05 at 23:47:19. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-04)

➡️ Next capture (2023-09-28)

🚧 View Differences

-=-=-=-=-=-=-

Package rake - godocs.io

import "github.com/afjoseph/RAKE.Go"

Variables

var StopWordsSlice = []string{ /* 571 elements not displayed */

}

stop word list from SMART (Salton,1971). Available at ftp://ftp.cs.cornell.edu/pub/smart/english.stop

Functions

func CalculateWordScores

func CalculateWordScores(phraseList []string) map[string]float64

CalculateWordScores returns a map of (string,float64) that maps to a candidate word and its score in the text

func GenerateCandidateKeywordScores

func GenerateCandidateKeywordScores(phraseList []string, wordScore map[string]float64) map[string]float64

GenerateCandidateKeywordScores returns a map of (string,float64) that contains keywords and their score in the text

func GenerateCandidateKeywords

func GenerateCandidateKeywords(sentenceList []string, stopWordPattern *regexp.Regexp) []string

GenerateCandidateKeywords returns a slice of candidate keywords from a slice of sentences and a stop-words regex

func IsNumber

func IsNumber(str string) bool

IsNumber returns true if the supplied string is a number

func RegexSplitSentences

func RegexSplitSentences() *regexp.Regexp

RegexSplitSentences returns a regexp object that detects punctuation marks

func RegexSplitWords

func RegexSplitWords() *regexp.Regexp

RegexSplitWords returns a regexp object that split words

func RegexStopWords

func RegexStopWords(stopWordsSlice []string) *regexp.Regexp

RegexStopWords builds "stop-words" regex based on a slice of "stop-words"

func SeperateWords

func SeperateWords(text string) []string

SeperateWords returns a slice of all words that have a length greater than a specified number of characters.

func SetDefaultStringFloat64

func SetDefaultStringFloat64(h map[string]float64, k string, v float64) (set bool, r float64)

SetDefaultStringFloat64 is a util function that serves as a Go replacement for Python's `setDefault`: https://docs.python.org/2/library/stdtypes.html#dict.setdefault Basically, if key is in the dictionary, return its value. If not, insert key with a value of default and return default. default defaults to None.

func SetDefaultStringInt

func SetDefaultStringInt(h map[string]int, k string, v int) (set bool, r int)

SetDefaultStringInt is a util function that serves as a Go replacement for Python's `setDefault`: https://docs.python.org/2/library/stdtypes.html#dict.setdefault Basically, if key is in the dictionary, return its value. If not, insert key with a value of default and return default. default defaults to None.

func SplitSentences

func SplitSentences(text string) []string

SplitSentences returns a slice of sentences.

Types

type Pair

type Pair struct {
    Key   string
    Value float64
}

Pair is a simple struct for a key-value pair of string and float64

type PairList

type PairList []Pair

PairList is just a slice of Pairs

func RunRake

func RunRake(text string) PairList

RunRake wraps RunRakeI18N to respect API

func RunRakeI18N

func RunRakeI18N(text string, stopWords []string) PairList

RunRakeI18N returns a slice of key-value pairs (PairList) of a keyword and its score after running the RAKE algorithm on a given text

func (PairList) Len

func (p PairList) Len() int

func (PairList) Less

func (p PairList) Less(i, j int) bool

func (PairList) Swap

func (p PairList) Swap(i, j int)

Details

Version v0.0.0-20191109090147-068a9e43b194 (latest)

Imports 5 packages

Refresh now

Back to home

Search