entropy/entropyCalculator.go
func SequenceEntropy(match match.Match, dictionaryLength int, ascending bool) float64 {
	firstChar := match.Token[0]
	baseEntropy := float64(0)
	if string(firstChar) == "a" || string(firstChar) == "1" {
		baseEntropy = float64(0)
	} else {
		baseEntropy = math.Log2(float64(dictionaryLength))
		//TODO: should this be just the first or any char?
		if unicode.IsUpper(rune(firstChar)) {
			baseEntropy++
		}
	}

	if !ascending {
		baseEntropy++
	}
	return baseEntropy + math.Log2(float64(len(match.Token)))
}
func SequenceEntropy(match match.Match, dictionaryLength int, ascending bool) float64 {
	firstChar := match.Token[0]
	baseEntropy := float64(0)
	if string(firstChar) == "a" || string(firstChar) == "1" {
		baseEntropy = float64(0)
	} else {
		baseEntropy = math.Log2(float64(dictionaryLength))
		//TODO: should this be just the first or any char?
		if unicode.IsUpper(rune(firstChar)) {
			baseEntropy++
		}
	}

	if !ascending {
		baseEntropy++
	}
	return baseEntropy + math.Log2(float64(len(match.Token)))
}
func SequenceEntropy ( match match . Match , dictionaryLength int , ascending bool ) float64 { firstChar := match . Token [ 0 ] baseEntropy := float64 ( 0 ) if string ( firstChar ) == " " || string ( firstChar ) == " " { baseEntropy = float64 ( 0 ) } else { baseEntropy = math . Log2 ( float64 ( dictionaryLength ) ) //TODO: should this be just the first or any char? if unicode . IsUpper ( rune ( firstChar ) ) { baseEntropy ++ } } if ! ascending { baseEntropy ++ } return baseEntropy + math . Log2 ( float64 ( len ( match . Token ) ) ) }
// SequenceEntropy calculates the entropy for sequences such as 4567 or cdef
SequenceEntropy calculates the entropy for sequences such as 4567 or cdef