Documentation
¶
Index ¶
- func GetTopWords(words map[string]int, n int) []models.WordCount
- func IsValidWord(word string) bool
- func MergeWordCountResults(target map[string]int, source map[string]int)
- func ScanFileAndLoadIntoCache(logger *zap.SugaredLogger, fileName string, cachePointer *cache.Cache, ...) (int, float64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTopWords ¶
GetTopWords Get top n words from map and return in WorCount struct format
func IsValidWord ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.