Documentation ¶
Index ¶
- Constants
- Variables
- func AppendOne(password string) string
- func ApplyCorrectionFunction(corrector string, password string) string
- func ApplyInverseCorrectionFunction(corrector string, password string) []string
- func CapitalToUpper(password string) string
- func ConvertLastNumberToSymbol(password string) string
- func ConvertLastSymbolToNumber(password string) string
- func DeleteEmpty(s []string) []string
- func GetBall(password string, correctors []string) []string
- func GetBallWithCorrectionType(password string, correctors []string) map[string]string
- func GetNBestCorrectors(n int, typoFrequency map[string]int) []string
- func InverseRemoveFirst(password string) []string
- func InverseRemoveLast(password string) []string
- func RemoveFirstChar(password string) string
- func RemoveLastChar(password string) string
- func Same(password string) string
- func StringInSlice(s string, list []string) bool
- func SwitchCaseAll(password string) string
- func SwitchCaseFirstLetter(password string) string
- func SwitchShiftLastCharacter(password string) string
- func SwitchShiftLastNCharacters(password string, n int) string
- func UpperToCapital(password string) string
- type KeyValue
Constants ¶
const ( SwitchAll = "swc-all" RemoveLast = "rm-last" SwitchFirst = "swc-first" RemoveFirst = "rm-first" SwitchLast = "sws-last1" SwitchLastN = "sws-lastn" UpperNCapital = "upncap" NumberToSymbolLast = "n2s-last" Capital2Upper = "cap2up" AddOneLast = "add1-last" )
Corrector constants
Variables ¶
var LetterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`1234567890-=[]\\;',./~!@#$%^&*()_+{}|:\"<>?")
TODO extend to use any rune instead of US alphanumerics
Functions ¶
func ApplyCorrectionFunction ¶
ApplyCorrectionFunction applies the appropriate corrector function given it's config name
func ApplyInverseCorrectionFunction ¶
ApplyInverseCorrectionFunction applies the appropriate corrector function given it's config name
func CapitalToUpper ¶
CapitalToUpper returns the password with every letter capitalised. For when users press shift-key instead of caps-lock cap2up
func ConvertLastNumberToSymbol ¶
ConvertLastNumberToSymbol converts the last number to a symbol - TODO should depend on keyboard layout n2s-last
func ConvertLastSymbolToNumber ¶
ConvertLastNumberToSymbol converts the last number to a symbol - TODO should depend on keyboard layout s2n-last
func DeleteEmpty ¶
DeleteEmpty remove all empty strings from a slice
func GetBallWithCorrectionType ¶
GetBallWithCorrectionType returns the ball with the correction type string
func GetNBestCorrectors ¶
GetNBestCorrectors returns the n best correctors in order, determined by the typo frequency
func InverseRemoveFirst ¶
InverseRemoveFirst prepends every rune to the password
func InverseRemoveLast ¶
InverseRemoveLast appends every rune to the password
func RemoveFirstChar ¶
RemoveFirstChar removes the first character from the string rm-first
func RemoveLastChar ¶
RemoveLastChar removes the last character from the string rm-last
func StringInSlice ¶
StringInSlice returns true if s in is list
func SwitchCaseAll ¶
SwitchCaseAll switches the case of all the letters in the string swc-all
func SwitchCaseFirstLetter ¶
SwitchCaseFirstLetter switches the case of the first letter in the string to upper case swc-first
func SwitchShiftLastCharacter ¶
SwitchShiftLastCharacter changes the last character according to the appropriate shift modifier sws-last1
func SwitchShiftLastNCharacters ¶
SwitchShiftLastNCharacters changes the last n characters according to the appropriate shift modifier sws-lastn
func UpperToCapital ¶
UpperToCapital returns the password with every letter capitalised. For when users press caps-lock instead of shift up2cap