helpers

package
v0.0.0-...-e5872de Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTopWords

func GetTopWords(words map[string]int, n int) []models.WordCount

GetTopWords Get top n words from map and return in WorCount struct format

func IsValidWord

func IsValidWord(word string) bool

IsValidWord Helper function to check if the word is valid by the next rules: 1. Contain at least 3 characters. 2. Contain only alphabetic characters.

func MergeWordCountResults

func MergeWordCountResults(target map[string]int, source map[string]int)

MergeWordCountResults Merging one map to the other

func ScanFileAndLoadIntoCache

func ScanFileAndLoadIntoCache(logger *zap.SugaredLogger, fileName string, cachePointer *cache.Cache, shouldValidate bool, validationFunc func(string) bool) (int, float64, error)

ScanFileAndLoadIntoCache Will scan all the words/urls from a file and will perform validation if necessary (validationFunc must be provided)

Types

This section is empty.

Jump to

Keyboard shortcuts

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