Documentation
¶
Index ¶
- func CalculateWordScores(phraseList []string) map[string]float64
- func GenerateCandidateKeywordScores(phraseList []string, wordScore map[string]float64) map[string]float64
- func GenerateCandidateKeywords(sentenceList []string, stopWordPattern *regexp.Regexp) []string
- func IsNumber(str string) bool
- func LoadStopWords() []string
- func RegexSplitSentences() *regexp.Regexp
- func RegexSplitWords() *regexp.Regexp
- func RegexStopWords() *regexp.Regexp
- func SeperateWords(text string) []string
- func SetDefaultStringFloat64(h map[string]float64, k string, v float64) (set bool, r float64)
- func SetDefaultStringInt(h map[string]int, k string, v int) (set bool, r int)
- func SplitSentences(text string) []string
- type Pair
- type PairList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateWordScores ¶
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 ¶
GenerateCandidateKeywords returns a slice of candidate keywords from a slice of sentences and a stop-words regex
func LoadStopWords ¶
func LoadStopWords() []string
LoadStopWords is a Utility function to split the long string of stop words a slice of stop words
func RegexSplitSentences ¶
RegexSplitSentences returns a regexp object that detects punctuation marks
func RegexSplitWords ¶
RegexSplitWords returns a regexp object that split words
func RegexStopWords ¶
RegexStopWords builds "stop-words" regex based on a slice of "stop-words"
func SeperateWords ¶
SeperateWords returns a slice of all words that have a length greater than a specified number of characters.
func SetDefaultStringFloat64 ¶
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 ¶
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 ¶
SplitSentences returns a slice of sentences.