Documentation
¶
Overview ¶
Package strutil provides utilities for string manipulation and analysis. functions are available as part of a functional api as well as a fluent builder api
This package includes functions for:
- String generation
- Lorem Ipsum Generation
- Text manipulation
- Text sanitizing functions
- Text comparisonData
Performance Considerations ¶
Most functions are designed for moderate-sized strings. For large text processing, consider streaming approaches.
Index ¶
- Constants
- Variables
- func AppendString(s string, suffix string, sep string) string
- func Capitalize(s string) string
- func CheckRunes(s string, set RuneSet) bool
- func CheckRunesBySetName(s string, set string) bool
- func CollapseWhitespace(s string) string
- func CollapseWhitespaceWithIgnore(s string, ignore string) string
- func CompareSlices(a, b []string, nulls bool) bool
- func CompareStringBuilderSlices(a, b []StringBuilder, nulls bool) bool
- func Contains(s string, substr string) bool
- func ContainsAll(s string, substrs []string) bool
- func ContainsAllIgnoreCase(s string, substrs []string) bool
- func ContainsAny(s string, substrs []string) bool
- func ContainsAnyIgnoreCase(s string, substrs []string) bool
- func ContainsIgnoreCase(s string, substr string) bool
- func EscapeHTML(s string) string
- func GenerateUUID() string
- func GenerateUUIDV7() string
- func HasPrefix(s string, prefix string) bool
- func HasSuffix(s string, suffix string) bool
- func IsAlphaNumericRune(r rune) bool
- func IsAlphaNumericString(s string) bool
- func IsAlphaString(s string) bool
- func IsDomain(domain string) bool
- func IsEmail(s string) bool
- func IsEmpty(s string) bool
- func IsEmptyNormalized(s string) bool
- func IsNormalizedUnicode(s string, format NormalizationFormat) bool
- func IsURL(s string) bool
- func IsUUID(s string) bool
- func IsValidLength(s string, min, max int) bool
- func LoremDomain() string
- func LoremEmail() string
- func LoremParagraph() string
- func LoremParagraphs(count int) string
- func LoremSentence() string
- func LoremSentenceCustom(count int) string
- func LoremSentences(count int) string
- func LoremSentencesCustom(count int, length int) string
- func LoremSentencesVariable(count, min, max int) string
- func LoremURL() string
- func LoremWord() string
- func LoremWords(count int) string
- func NormalizeDiacritics(s string) string
- func NormalizeUnicode(s string, form NormalizationFormat) string
- func NormalizeWhitespace(s string, whitespace rune) string
- func NormalizeWhitespaceWithIgnore(s string, whitespace rune, ignoreWhitespace string) string
- func PrependString(s string, prefix string, sep string) string
- func RandomAlphaNumericString(length int) string
- func RandomAlphaString(length int) string
- func RandomHex(length int) string
- func RandomString(length int, charSet CharacterSet) string
- func RandomStringFromCustomCharset(length int, customCharset string) string
- func RandomUrlSafe(length int) string
- func RemoveANSIEscapeCodes(s string) string
- func RemoveHTML(s string, preserveSpace bool) string
- func RemoveNonAlpha(s string, ws bool) string
- func RemoveNonAlphaNumeric(s string, ws bool) string
- func RemoveNonPrintable(s string) string
- func RemovePrefix(s string, prefix string) string
- func RemovePrefixWithResult(s string, prefix string) (string, bool)
- func RemoveSuffix(s string, suffix string) string
- func RemoveSuffixWithResult(s string, suffix string) (string, bool)
- func RemoveWhitespace(s string) string
- func RemoveWhitespaceWithIgnore(s string, charset string) string
- func ReplaceNonAlpha(s string, replacement string) string
- func ReplaceNonAlphaNumeric(s string, replacement string) string
- func ReplaceNonAlphaNumericWithIgnore(s string, replacement string, ignore string) string
- func ReplaceNonAlphaWithIgnore(s string, replacement string, ignore string) string
- func ReplaceSpaces(s string, replacement string) string
- func ReplaceWhitespace(s string, replacement string) string
- func ReplaceWhitespaceWithIgnore(s string, replacement string, ignore string) string
- func SanitizeHTML(s string) string
- func Slugify(s string, length int) string
- func SplitCamelCase(s string) string
- func SplitPascalCase(s string) string
- func ToCamelCase(s string) string
- func ToDelimited(s string, delim uint8, ignore string, scream bool) string
- func ToKebabCase(s string, scream bool) string
- func ToLower(s string) string
- func ToPascalCase(s string) string
- func ToSnakeCase(s string, scream bool) string
- func ToSnakeCaseWithIgnore(s string, scream bool, ignore string) string
- func ToTitleCase(s string) string
- func ToUpper(s string) string
- func Trim(s string) string
- func TrimChars(s string, chars string) string
- func TrimCharsLeft(s string, chars string) string
- func TrimCharsRight(s string, chars string) string
- func TrimLeft(s string) string
- func TrimRight(s string) string
- func Truncate(s string, length int, suffix string) string
- func Uncapitalize(s string) string
- type Algorithm
- type CharacterSet
- type ComparisonManager
- func (cm *ComparisonManager) AddComparisonResult(result ComparisonResult)
- func (cm *ComparisonManager) AddLCSResult(result LCSResult)
- func (cm *ComparisonManager) AddShingleResult(result ShingleResult)
- func (cm *ComparisonManager) AddSimilarityResult(result SimilarityResult)
- func (cm *ComparisonManager) CopyComparisonResultsMap() ComparisonResultsMap
- func (cm *ComparisonManager) CopyLCSResultsMap() LCSResultsMap
- func (cm *ComparisonManager) CopyShingleResultsMap() ShingleResultsMap
- func (cm *ComparisonManager) CopySimilarityResultsMap() SimilarityResultsMap
- func (cm *ComparisonManager) FilterComparisonResultsByComparisonString(compStr string) ComparisonResultsMap
- func (cm *ComparisonManager) FilterComparisonResultsByType(compType ComparisonResultType) ComparisonResultsMap
- func (cm *ComparisonManager) FilterLCSResultsByComparisonString(compStr string) LCSResultsMap
- func (cm *ComparisonManager) FilterLCSResultsByType(lcsType LCSResultType) LCSResultsMap
- func (cm *ComparisonManager) FilterShingleResultsByNGramLength(ngramLength int) ShingleResultsMap
- func (cm *ComparisonManager) FilterShingleResultsByType(resType ShingleResultType) ShingleResultsMap
- func (cm *ComparisonManager) FilterSimilarityResultsByComparisonString(compStr string) SimilarityResultsMap
- func (cm *ComparisonManager) FilterSimilarityResultsByType(algo Algorithm) SimilarityResultsMap
- func (cm *ComparisonManager) GetComparisonResult(compResType ComparisonResultType, compStr string) ComparisonResult
- func (cm *ComparisonManager) GetComparisonResultsByString(compStr string) []ComparisonResult
- func (cm *ComparisonManager) GetComparisonResultsByType(compResType ComparisonResultType) []ComparisonResult
- func (cm *ComparisonManager) GetComparisonResultsMap() ComparisonResultsMap
- func (cm *ComparisonManager) GetLCSResult(lcsType LCSResultType, inputStr string) *LCSResult
- func (cm *ComparisonManager) GetLCSResultsByComparisonString(compStr string) []LCSResult
- func (cm *ComparisonManager) GetLCSResultsByType(lcsType LCSResultType) []LCSResult
- func (cm *ComparisonManager) GetLCSResultsMap() LCSResultsMap
- func (cm *ComparisonManager) GetShingleResult(resType ShingleResultType, ngramLength int) ShingleResult
- func (cm *ComparisonManager) GetShingleResultsByNGramLength(ngramLength int) []ShingleResult
- func (cm *ComparisonManager) GetShingleResultsByType(resType ShingleResultType) []ShingleResult
- func (cm *ComparisonManager) GetShingleResultsMap() ShingleResultsMap
- func (cm *ComparisonManager) GetSimilarityResult(algo Algorithm, compStr string) *SimilarityResult
- func (cm *ComparisonManager) GetSimilarityResultsByComparisonString(compStr string) []SimilarityResult
- func (cm *ComparisonManager) GetSimilarityResultsByType(algo Algorithm) []SimilarityResult
- func (cm *ComparisonManager) GetSimilarityResultsMap() SimilarityResultsMap
- type ComparisonResult
- type ComparisonResultFloat
- func CosineSimilarity(s1, s2 string, splitLength int) *ComparisonResultFloat
- func JaccardSimilarity(s1, s2 string, splitLength int) *ComparisonResultFloat
- func JaroSimilarity(s1, s2 string) *ComparisonResultFloat
- func JaroWinklerSimilarity(s1, s2 string) *ComparisonResultFloat
- func NewComparisonResultFloat(comparisonType ComparisonResultType, string1 string, string2 string, ...) *ComparisonResultFloat
- func QgramSimilarity(s1, s2 string, q int) *ComparisonResultFloat
- func SorensenDiceCoefficient(s1, s2 string, splitLength int) *ComparisonResultFloat
- func (c *ComparisonResultFloat) GetError() error
- func (c *ComparisonResultFloat) GetScoreFloat() (float32, error)
- func (c *ComparisonResultFloat) GetSplitLength() (int, error)
- func (c *ComparisonResultFloat) GetString1() string
- func (c *ComparisonResultFloat) GetString2() string
- func (c *ComparisonResultFloat) GetStrings() (string, string)
- func (c *ComparisonResultFloat) GetType() ComparisonResultType
- func (c *ComparisonResultFloat) GetTypeName() string
- func (c *ComparisonResultFloat) IsMatch(other ComparisonResult) bool
- func (c *ComparisonResultFloat) Print(v bool)
- type ComparisonResultInt
- func DamerauLevenshteinDistance(s1, s2 string) *ComparisonResultInt
- func HammingDistance(s1, s2 string) *ComparisonResultInt
- func LCS(s1, s2 string) *ComparisonResultInt
- func LCSEditDistance(s1, s2 string) *ComparisonResultInt
- func LevenshteinDistance(s1, s2 string) *ComparisonResultInt
- func NewComparisonResultInt(comparisonType ComparisonResultType, string1 string, string2 string, ...) *ComparisonResultInt
- func OSADamerauLevenshteinDistance(s1, s2 string) *ComparisonResultInt
- func QgramDistance(s1, s2 string, q int) *ComparisonResultInt
- func QgramDistanceCustomNgram(nmap1, nmap2 map[string]int, customName string) *ComparisonResultInt
- func (c *ComparisonResultInt) GetError() error
- func (c *ComparisonResultInt) GetScoreInt() (int, error)
- func (c *ComparisonResultInt) GetSplitLength() (int, error)
- func (c *ComparisonResultInt) GetString1() string
- func (c *ComparisonResultInt) GetString2() string
- func (c *ComparisonResultInt) GetStrings() (string, string)
- func (c *ComparisonResultInt) GetType() ComparisonResultType
- func (c *ComparisonResultInt) GetTypeName() string
- func (c *ComparisonResultInt) IsMatch(other ComparisonResult) bool
- func (c *ComparisonResultInt) Print(v bool)
- type ComparisonResultScore
- type ComparisonResultType
- type ComparisonResultsMap
- func (crm ComparisonResultsMap) Add(result ComparisonResult)
- func (crm ComparisonResultsMap) EntryCount() int
- func (crm ComparisonResultsMap) FilterByComparisonString(compStr string) ComparisonResultsMap
- func (crm ComparisonResultsMap) FilterByType(compResType ComparisonResultType) ComparisonResultsMap
- func (crm ComparisonResultsMap) Get(compResType ComparisonResultType, compStr string) ComparisonResult
- func (crm ComparisonResultsMap) GetByComparisonString(compStr string) []ComparisonResult
- func (crm ComparisonResultsMap) GetByType(compResType ComparisonResultType) []ComparisonResult
- func (crm ComparisonResultsMap) GetCopy() ComparisonResultsMap
- func (crm ComparisonResultsMap) IsMatch(other ComparisonResultsMap) bool
- func (crm ComparisonResultsMap) Print(verbose bool) ComparisonResultsMap
- func (crm ComparisonResultsMap) TypeCount() int
- type LCSResult
- func (lcs *LCSResult) GetError() error
- func (lcs *LCSResult) GetResult() []string
- func (lcs *LCSResult) GetString1() string
- func (lcs *LCSResult) GetString2() string
- func (lcs *LCSResult) GetStrings() (string, string)
- func (lcs *LCSResult) GetType() LCSResultType
- func (lcs *LCSResult) GetTypeName() string
- func (lcs *LCSResult) IsMatch(other *LCSResult) bool
- func (lcs *LCSResult) Print(v bool)
- type LCSResultType
- type LCSResultsMap
- func (lrm LCSResultsMap) Add(result LCSResult)
- func (lrm LCSResultsMap) EntryCount() int
- func (lrm LCSResultsMap) FilterByComparisonString(compStr string) LCSResultsMap
- func (lrm LCSResultsMap) FilterByType(resType LCSResultType) LCSResultsMap
- func (lrm LCSResultsMap) Get(resType LCSResultType, compStr string) *LCSResult
- func (lrm LCSResultsMap) GetByComparisonString(compStr string) []LCSResult
- func (lrm LCSResultsMap) GetByType(resType LCSResultType) []LCSResult
- func (lrm LCSResultsMap) GetCopy() LCSResultsMap
- func (lrm LCSResultsMap) IsMatch(other LCSResultsMap) bool
- func (lrm LCSResultsMap) Print(v bool) LCSResultsMap
- func (lrm LCSResultsMap) TypeCount() int
- type NormalizationFormat
- type RuneSet
- type ShingleMapResult
- func (s *ShingleMapResult) GetError() error
- func (s *ShingleMapResult) GetInput() string
- func (s *ShingleMapResult) GetNgramLength() int
- func (s *ShingleMapResult) GetShinglesMap() map[string]int
- func (s *ShingleMapResult) GetType() ShingleResultType
- func (s *ShingleMapResult) GetTypeName() string
- func (s *ShingleMapResult) IsMatch(other ShingleResult) bool
- func (s *ShingleMapResult) Print(v bool)
- type ShingleResult
- type ShingleResultType
- type ShingleResultsMap
- func (srm ShingleResultsMap) Add(result ShingleResult)
- func (srm ShingleResultsMap) EntryCount() int
- func (srm ShingleResultsMap) FilterByNGramLength(ngramLength int) ShingleResultsMap
- func (srm ShingleResultsMap) FilterByType(resType ShingleResultType) ShingleResultsMap
- func (srm ShingleResultsMap) Get(resType ShingleResultType, ngramLength int) ShingleResult
- func (srm ShingleResultsMap) GetByNGramLength(ngramLength int) []ShingleResult
- func (srm ShingleResultsMap) GetByType(resType ShingleResultType) []ShingleResult
- func (srm ShingleResultsMap) GetCopy() ShingleResultsMap
- func (srm ShingleResultsMap) IsMatch(other ShingleResultsMap) bool
- func (srm ShingleResultsMap) Print(v bool) ShingleResultsMap
- func (srm ShingleResultsMap) TypeCount() int
- type ShingleSliceResult
- func (s *ShingleSliceResult) GetError() error
- func (s *ShingleSliceResult) GetInput() string
- func (s *ShingleSliceResult) GetNgramLength() int
- func (s *ShingleSliceResult) GetShinglesSlice() []string
- func (s *ShingleSliceResult) GetType() ShingleResultType
- func (s *ShingleSliceResult) GetTypeName() string
- func (s *ShingleSliceResult) IsMatch(other ShingleResult) bool
- func (s *ShingleSliceResult) Print(v bool)
- type SimilarityResult
- func (sr *SimilarityResult) GetAlgorithm() Algorithm
- func (sr *SimilarityResult) GetAlgorithmName() string
- func (sr *SimilarityResult) GetError() error
- func (sr *SimilarityResult) GetScore() (float32, error)
- func (sr *SimilarityResult) GetString1() string
- func (sr *SimilarityResult) GetString2() string
- func (sr *SimilarityResult) GetStrings() (string, string)
- func (sr *SimilarityResult) IsMatch(other *SimilarityResult) bool
- func (sr *SimilarityResult) Print(v bool)
- type SimilarityResultsMap
- func (smr SimilarityResultsMap) Add(result SimilarityResult)
- func (smr SimilarityResultsMap) EntryCount() int
- func (smr SimilarityResultsMap) FilterByComparisonString(compStr string) SimilarityResultsMap
- func (smr SimilarityResultsMap) FilterByType(algo Algorithm) SimilarityResultsMap
- func (smr SimilarityResultsMap) Get(algo Algorithm, compStr string) *SimilarityResult
- func (smr SimilarityResultsMap) GetByComparisonString(compStr string) []SimilarityResult
- func (smr SimilarityResultsMap) GetByType(algo Algorithm) []SimilarityResult
- func (smr SimilarityResultsMap) GetCopy() SimilarityResultsMap
- func (smr SimilarityResultsMap) IsMatch(other SimilarityResultsMap) bool
- func (smr SimilarityResultsMap) Print(v bool) SimilarityResultsMap
- func (smr SimilarityResultsMap) TypeCount() int
- type StringBuilder
- func New(s string) *StringBuilder
- func NewLoremDomain() *StringBuilder
- func NewLoremEmail() *StringBuilder
- func NewLoremParagraph() *StringBuilder
- func NewLoremParagraphs(count int) *StringBuilder
- func NewLoremSentence() *StringBuilder
- func NewLoremSentenceCustom(length int) *StringBuilder
- func NewLoremSentences(count int) *StringBuilder
- func NewLoremSentencesCustom(count int, length int) *StringBuilder
- func NewLoremSentencesVariable(count int, min int, max int) *StringBuilder
- func NewLoremURL() *StringBuilder
- func NewLoremWord() *StringBuilder
- func NewLoremWords(count int) *StringBuilder
- func NewRandom(length int, charSet CharacterSet) *StringBuilder
- func NewRandomAlpha(length int) *StringBuilder
- func NewRandomAlphaNumeric(length int) *StringBuilder
- func NewRandomFromCustomCharSet(length int, charSet string) *StringBuilder
- func NewRandomHex(length int) *StringBuilder
- func NewRandomURLSafe(length int) *StringBuilder
- func NewUUID() *StringBuilder
- func NewUUIDV7() *StringBuilder
- func (sb *StringBuilder) Append(s string, sep string) *StringBuilder
- func (sb *StringBuilder) Build() (string, error)
- func (sb *StringBuilder) Capitalize() *StringBuilder
- func (sb *StringBuilder) CollapseWhitespace() *StringBuilder
- func (sb *StringBuilder) CollapseWhitespaceWithIgnore(ignoreChars string) *StringBuilder
- func (sb *StringBuilder) CosineSimilarity(other string, splitLength int) *StringBuilder
- func (sb *StringBuilder) DamerauLevenshteinDistance(other string) *StringBuilder
- func (sb *StringBuilder) Error() error
- func (sb *StringBuilder) EscapeHTML() *StringBuilder
- func (sb *StringBuilder) GetComparisonManager() *ComparisonManager
- func (sb *StringBuilder) GetHistory() *StringHistory
- func (sb *StringBuilder) GetOriginalValue() string
- func (sb *StringBuilder) HammingDistance(other string) *StringBuilder
- func (sb *StringBuilder) If(condition bool, fn func(string) string) *StringBuilder
- func (sb *StringBuilder) JaccardSimilarity(other string, splitLength int) *StringBuilder
- func (sb *StringBuilder) JaroSimilarity(other string) *StringBuilder
- func (sb *StringBuilder) JaroWinklerSimilarity(other string) *StringBuilder
- func (sb *StringBuilder) LCS(other string) *StringBuilder
- func (sb *StringBuilder) LCSBacktrack(other string) *StringBuilder
- func (sb *StringBuilder) LCSBacktrackAll(other string) *StringBuilder
- func (sb *StringBuilder) LCSDiff(other string) *StringBuilder
- func (sb *StringBuilder) LCSEditDistance(other string) *StringBuilder
- func (sb *StringBuilder) LevenshteinDistance(other string) *StringBuilder
- func (sb *StringBuilder) NormalizeDiacritics() *StringBuilder
- func (sb *StringBuilder) NormalizeUnicode(form NormalizationFormat) *StringBuilder
- func (sb *StringBuilder) NormalizeWhitespace(whitespace rune) *StringBuilder
- func (sb *StringBuilder) NormalizeWhitespaceWithIgnore(whitespace rune, ignoreChars string) *StringBuilder
- func (sb *StringBuilder) OSADamerauLevenshteinDistance(other string) *StringBuilder
- func (sb *StringBuilder) Prepend(s string, ser string) *StringBuilder
- func (sb *StringBuilder) Print() *StringBuilder
- func (sb *StringBuilder) QgramDistance(other string, q int) *StringBuilder
- func (sb *StringBuilder) QgramDistanceCustomNgram(nmapOther map[string]int, customName string) *StringBuilder
- func (sb *StringBuilder) QgramSimilarity(other string, q int) *StringBuilder
- func (sb *StringBuilder) RemoveANSIEscapeCodes() *StringBuilder
- func (sb *StringBuilder) RemoveHTML(preserveSpace bool) *StringBuilder
- func (sb *StringBuilder) RemoveNonAlpha(ws bool) *StringBuilder
- func (sb *StringBuilder) RemoveNonAlphaNumeric(ws bool) *StringBuilder
- func (sb *StringBuilder) RemoveNonPrintable() *StringBuilder
- func (sb *StringBuilder) RemovePrefix(prefix string) *StringBuilder
- func (sb *StringBuilder) RemovePrefixWithResult(prefix string) (*StringBuilder, bool)
- func (sb *StringBuilder) RemoveSuffix(suffix string) *StringBuilder
- func (sb *StringBuilder) RemoveSuffixWithResult(suffix string) (*StringBuilder, bool)
- func (sb *StringBuilder) RemoveWhitespace() *StringBuilder
- func (sb *StringBuilder) RemoveWhitespaceWithIgnore(charset string) *StringBuilder
- func (sb *StringBuilder) ReplaceNonAlpha(replacement string) *StringBuilder
- func (sb *StringBuilder) ReplaceNonAlphaNumeric(replacement string) *StringBuilder
- func (sb *StringBuilder) ReplaceNonAlphaNumericWithIgnore(replacement string, ignoreChars string) *StringBuilder
- func (sb *StringBuilder) ReplaceNonAlphaWithIgnore(replacement string, ignoreChars string) *StringBuilder
- func (sb *StringBuilder) ReplaceSpaces(replacement string) *StringBuilder
- func (sb *StringBuilder) ReplaceWhitespace(replacement string) *StringBuilder
- func (sb *StringBuilder) ReplaceWhitespaceWithIgnore(replacement string, ignoreChars string) *StringBuilder
- func (sb *StringBuilder) RequireAlpha() *StringBuilder
- func (sb *StringBuilder) RequireAlphaNumeric() *StringBuilder
- func (sb *StringBuilder) RequireContains(substr string) *StringBuilder
- func (sb *StringBuilder) RequireContainsAll(substrs []string) *StringBuilder
- func (sb *StringBuilder) RequireContainsAllIgnoreCase(substrs []string) *StringBuilder
- func (sb *StringBuilder) RequireContainsAny(substrs []string) *StringBuilder
- func (sb *StringBuilder) RequireContainsAnyIgnoreCase(substrs []string) *StringBuilder
- func (sb *StringBuilder) RequireContainsIgnoreCase(substr string) *StringBuilder
- func (sb *StringBuilder) RequireDomain() *StringBuilder
- func (sb *StringBuilder) RequireEmail() *StringBuilder
- func (sb *StringBuilder) RequireHasPrefix(prefix string) *StringBuilder
- func (sb *StringBuilder) RequireHasSuffix(suffix string) *StringBuilder
- func (sb *StringBuilder) RequireLength(min, max int) *StringBuilder
- func (sb *StringBuilder) RequireNormalizedUnicode(format NormalizationFormat) *StringBuilder
- func (sb *StringBuilder) RequireNotEmpty() *StringBuilder
- func (sb *StringBuilder) RequireNotEmptyNormalized() *StringBuilder
- func (sb *StringBuilder) RequireURL() *StringBuilder
- func (sb *StringBuilder) RequireUUID() *StringBuilder
- func (sb *StringBuilder) Result() (string, error)
- func (sb *StringBuilder) RevertToIndex(index int) *StringBuilder
- func (sb *StringBuilder) RevertToOriginal() *StringBuilder
- func (sb *StringBuilder) RevertToPrevious() *StringBuilder
- func (sb *StringBuilder) RevertWithFunction(fn func(history *StringHistory) int) *StringBuilder
- func (sb *StringBuilder) SanitizeHTML() *StringBuilder
- func (sb *StringBuilder) Shingle(k int) *StringBuilder
- func (sb *StringBuilder) ShingleSlice(k int) *StringBuilder
- func (sb *StringBuilder) Similarity(other string, algorithm Algorithm) *StringBuilder
- func (sb *StringBuilder) Slugify(length int) *StringBuilder
- func (sb *StringBuilder) SorensenDiceCoefficient(other string, splitLength int) *StringBuilder
- func (sb *StringBuilder) SplitCamelCase() *StringBuilder
- func (sb *StringBuilder) SplitPascalCase() *StringBuilder
- func (sb *StringBuilder) String() string
- func (sb *StringBuilder) ToCamelCase() *StringBuilder
- func (sb *StringBuilder) ToDelimited(delim uint8, ignore string, scream bool) *StringBuilder
- func (sb *StringBuilder) ToKebabCase(scream bool) *StringBuilder
- func (sb *StringBuilder) ToLower() *StringBuilder
- func (sb *StringBuilder) ToPascalCase() *StringBuilder
- func (sb *StringBuilder) ToSnakeCase(scream bool) *StringBuilder
- func (sb *StringBuilder) ToSnakeCaseWithIgnore(scream bool, ignore string) *StringBuilder
- func (sb *StringBuilder) ToTitleCase() *StringBuilder
- func (sb *StringBuilder) ToUpper() *StringBuilder
- func (sb *StringBuilder) Transform(fn func(string) string) *StringBuilder
- func (sb *StringBuilder) Trim() *StringBuilder
- func (sb *StringBuilder) TrimChars(chars string) *StringBuilder
- func (sb *StringBuilder) TrimCharsLeft(chars string) *StringBuilder
- func (sb *StringBuilder) TrimCharsRight(chars string) *StringBuilder
- func (sb *StringBuilder) TrimLeft() *StringBuilder
- func (sb *StringBuilder) TrimRight() *StringBuilder
- func (sb *StringBuilder) Truncate(length int, suffix string) *StringBuilder
- func (sb *StringBuilder) Uncapitalize() *StringBuilder
- func (sb *StringBuilder) WithComparisonManager() *StringBuilder
- func (sb *StringBuilder) WithHistory(limit int) *StringBuilder
- type StringHistory
Examples ¶
Constants ¶
const ( // AlphaNumericChars represents a string containing all uppercase letters, lowercase letters, and numeric digits (0-9). AlphaNumericChars CharacterSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" // Alpha represents a string containing all uppercase and lowercase letters of the English alphabet. Alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // HexChars represents the hexadecimal character set containing digits 0-9 and letters a-f. HexChars = "0123456789abcdef" // URLSafe defines a set of characters considered safe for use in URLs, including alphanumeric characters and "-_". URLSafe = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_" // WhiteSpaceChars represents a string containing common whitespace characters: space, tab, newline, carriage return, // vertical tab, and form feed. WhiteSpaceChars = " \t\n\r\v\f" )
const ( NFC = NormalizationFormat(norm.NFC) NFD = NormalizationFormat(norm.NFD) NFKC = NormalizationFormat(norm.NFKC) NFKD = NormalizationFormat(norm.NFKD) )
NFC represents the Canonical Composition normalization format (NFC). NFD represents the Canonical Decomposition normalization format (NFD). NFKC represents the Compatibility Composition normalization format (NFKC). NFKD represents the Compatibility Decomposition normalization format (NFKD).
const ( Levenshtein = Algorithm(edlib.Levenshtein) DamerauLevenshtein = Algorithm(edlib.DamerauLevenshtein) OSADamerauLevenshtein = Algorithm(edlib.OSADamerauLevenshtein) Lcs = Algorithm(edlib.Lcs) Hamming = Algorithm(edlib.Hamming) Jaro = Algorithm(edlib.Jaro) JaroWinkler = Algorithm(edlib.JaroWinkler) Cosine = Algorithm(edlib.Cosine) Jaccard = Algorithm(edlib.Jaccard) SorensenDice = Algorithm(edlib.SorensenDice) QGram = Algorithm(edlib.Qgram) )
Levenshtein represents the Levenshtein distance algorithm for string score measurement. DamerauLevenshtein represents the Damerau-Levenshtein algorithm for string score measurement. OSADamerauLevenshtein represents the Optimal String Alignment (OSA) Damerau-Levenshtein algorithm. Lcs represents the Longest Common Subsequence algorithm for string score measurement. Hamming represents the Hamming distance algorithm for string score measurement. Jaro represents the Jaro distance algorithm for string score measurement. JaroWinkler represents the Jaro-Winkler distance algorithm for string score measurement. Cosine represents the Cosine score algorithm used for vector-based string comparison. Jaccard represents the Jaccard score algorithm for set-based string comparison. SorensenDice represents the Sørensen-Dice coefficient for string score measurement. QGram represents the Q-Gram algorithm for string score measurement.
Variables ¶
var ( // LabelRegex defines a regular expression for validating domain labels, ensuring they meet DNS hostname requirements. LabelRegex = `[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?` // TLDRegex is a regular expression that matches valid top-level domain (TLD) strings // consisting of 2 or more alphabetic characters. TLDRegex = `[a-zA-Z]{2,}` // DomainRegex is a compiled regular expression validating fully qualified domain names (FQDN) based on DNS rules. DomainRegex = regexp.MustCompile(`^(` + LabelRegex + `\.)+` + TLDRegex + `$`) // CamelCaseRegex is a regular expression used to identify transitions between lowercase // and uppercase characters or consecutive capitals in camelCase or PascalCase strings. CamelCaseRegex = regexp.MustCompile(`([a-z0-9])([A-Z])|([A-Z])([A-Z][a-z])`) // WhiteSpaceRegex is a compiled regular expression that matches one or more whitespace characters. WhiteSpaceRegex = regexp.MustCompile(`\s+`) )
var ( // StrictPolicy is a sanitizer instance that removes all HTML tags // and only allows plain text content for strict enforcement. StrictPolicy = bluemonday.StrictPolicy() // StrictPolicyWithSpaces is a sanitizer that removes all HTML tags but //retains spaces when stripping tags for better readability. StrictPolicyWithSpaces = bluemonday.StrictPolicy().AddSpaceWhenStrippingTag(true) // UGCPolicy defines a bluemonday policy specifically designed for user-generated content sanitization. UGCPolicy = bluemonday.UGCPolicy() )
var AlgorithmTypeMap = map[Algorithm]string{ Levenshtein: "Levenshtein", DamerauLevenshtein: "Damerau-Levenshtein", OSADamerauLevenshtein: "OSA Damerau-Levenshtein", Lcs: "LCS", Hamming: "Hamming", Jaro: "Jaro", JaroWinkler: "Jaro-Winkler", Cosine: "Cosine", Jaccard: "Jaccard", SorensenDice: "Sorensen-Dice", QGram: "Q-Gram", }
AlgorithmTypeMap maps edlib.Algorithm constants to their corresponding string representations for display purposes.
var ComparisonResultTypeMap = map[ComparisonResultType]string{ LCSLength: "LCS Length", LCSDist: "LCS Distance", LevDist: "Levenshtein Distance", DamLevDist: "Damerau-Levenshtein Distance", OSADamLevDist: "OSA Damerau-Levenshtein Distance", HammingDist: "Hamming Distance", JaroSim: "Jaro Similarity", JaroWinklerSim: "Jaro-Winkler Similarity", JaccardSim: "Jaccard Similarity", CosineSim: "Cosine Similarity", SorensenDiceCo: "Sorensen-Dice Coefficient", QGramDist: "Q-Gram Distance", QGramDistCust: "Q-Gram Distance Custom", QGramSim: "Q-Gram Similarity", }
var LCSResultTypeMap = map[LCSResultType]string{ LCSBacktrackWord: "LCS Backtrack", LCSBacktrackWordAll: "LCS Backtrack All", LCSDiffSlice: "LCS Diff", }
LCSResultTypeMap maps LCSResultType constants to their corresponding string representations.
var RuneSetNames = map[string]RuneSet{ "Letter": Letter, "Digit": Digit, "Number": Number, "AlphaNumericChars": AlphaNumeric, "WhiteSpaceChars": WhiteSpace, "Punctuation": Punctuation, "Symbol": Symbol, "Upper": Upper, "Lower": Lower, "Title": Title, "Control": Control, "Graphic": Graphic, "Mark": Mark, "Printable": Printable, }
RuneSetNames is a map associating string keys with predefined RuneSet constants for categorizing runes.
var RuneSets = map[RuneSet]func(rune) bool{ Letter: unicode.IsLetter, Digit: unicode.IsDigit, Number: unicode.IsNumber, AlphaNumeric: IsAlphaNumericRune, WhiteSpace: unicode.IsSpace, Punctuation: unicode.IsPunct, Symbol: unicode.IsSymbol, Upper: unicode.IsUpper, Lower: unicode.IsLower, Title: unicode.IsTitle, Control: unicode.IsControl, Graphic: unicode.IsGraphic, Mark: unicode.IsMark, Printable: unicode.IsPrint, }
RuneSets maps predefined RuneSet constants to their respective rune classification functions.
var ShingleResultTypeMap = map[ShingleResultType]string{ ShinglesMap: "Shingle Map", ShinglesSlice: "Shingle Slice", }
ShingleResultTypeMap maps ShingleResultType constants to their corresponding descriptive string representations.
Functions ¶
func AppendString ¶
AppendString concatenates the input string `s` with `suffix`, using `sep` as the separator, and returns the resulting string.
Example ¶
s := AppendString("v0.1.0", "removeNonAlpha", "-")
fmt.Printf("%s", s)
Output: v0.1.0-removeNonAlpha
func Capitalize ¶
Capitalize returns the input string with the first character converted to uppercase while preserving the rest as is.
func CheckRunes ¶
CheckRunes determines if a string contains any rune that matches the function associated with the specified RuneSet.
func CheckRunesBySetName ¶
CheckRunesBySetName checks if a rune in the string belongs to the rune set identified by the set name. Returns a boolean result.
func CollapseWhitespace ¶
CollapseWhitespace reduces all consecutive whitespace characters in a string to a single space, preserving leading and trailing whitespace.
func CollapseWhitespaceWithIgnore ¶
CollapseWhitespaceWithIgnore reduces consecutive whitespace to a single space while ignoring whitespace in the 'ignore' string.
func CompareSlices ¶
CompareSlices compares two slices of strings for equality, with an option to treat nil slices as equal if nulls is set to true.
func CompareStringBuilderSlices ¶
func CompareStringBuilderSlices(a, b []StringBuilder, nulls bool) bool
CompareStringBuilderSlices compares two slices of StringBuilder for equality, optionally allowing nil slices to be considered equal. The order of elements in the slices does not affect the comparisonData, and the 'nulls' flag determines nil-handling behavior.
func Contains ¶ added in v0.2.0
Contains checks if the substring `substr` is present within the string `s` and returns true if found, otherwise false.
func ContainsAll ¶ added in v0.2.0
ContainsAll checks if all strings in the slice substrs are present within the string s, returning true if found.
func ContainsAllIgnoreCase ¶ added in v0.2.0
ContainsAllIgnoreCase checks if all substrings in the provided slice are found in the string, ignoring case sensitivity.
func ContainsAny ¶ added in v0.2.0
ContainsAny checks if any substring in the slice `substrs` exists in the string `s` and returns true if found.
func ContainsAnyIgnoreCase ¶ added in v0.2.0
ContainsAnyIgnoreCase checks if the input string contains any of the provided substrings, ignoring case sensitivity.
func ContainsIgnoreCase ¶ added in v0.2.0
ContainsIgnoreCase checks if substr is present in s, ignoring case sensitivity. Returns true if found.
func EscapeHTML ¶
EscapeHTML escapes special HTML characters in a string, replacing them with their corresponding HTML entity codes.
func GenerateUUID ¶
func GenerateUUID() string
GenerateUUID generates and returns a new random UUID as a string.
func GenerateUUIDV7 ¶
func GenerateUUIDV7() string
GenerateUUIDV7 generates and returns a new random UUID as a string using UUID V7 It is recommended to use V7 unless legacy compatibility is required
func HasPrefix ¶ added in v0.2.0
HasPrefix reports whether the string s begins with the specified prefix. Returns true if it does, otherwise false.
func HasSuffix ¶ added in v0.2.0
HasSuffix reports whether the string `s` ends with the specified `suffix`.
func IsAlphaNumericRune ¶
IsAlphaNumericRune determines if the given rune is an alphanumeric character (letter or digit).
func IsAlphaNumericString ¶
IsAlphaNumericString checks if the input string consists only of alphanumeric characters (letters and digits).
func IsAlphaString ¶
IsAlphaString checks if the given string contains only alphabetic characters. Returns true if all characters are letters.
func IsDomain ¶
IsDomain checks if a given string is a valid domain name format as per defined rules.
func IsEmail ¶
IsEmail checks if the input string is in a valid email address format and returns true if valid, false otherwise.
func IsEmpty ¶
IsEmpty checks if the provided string is empty and returns true if it is, otherwise false.
func IsEmptyNormalized ¶
IsEmptyNormalized checks if the normalized version of the input string is empty after trimming and collapsing whitespace.
func IsNormalizedUnicode ¶
func IsNormalizedUnicode(s string, format NormalizationFormat) bool
IsNormalizedUnicode checks if the given string is normalized according to the specified Unicode normalization format.
func IsURL ¶
IsURL determines whether the input string is a valid URL with a scheme and host. Returns true if valid, otherwise false.
func IsUUID ¶
IsUUID verifies if the provided string has a valid UUID format. Returns true if valid, false otherwise.
func IsValidLength ¶
IsValidLength checks if the length of the given string s is within the inclusive range defined by min and max values.
func LoremDomain ¶
func LoremDomain() string
LoremDomain generates and returns a placeholder domain name in string format.
func LoremEmail ¶
func LoremEmail() string
LoremEmail generates and returns a placeholder or mock email address as a string.
func LoremParagraph ¶
func LoremParagraph() string
LoremParagraph generates and returns a string containing a randomly generated Lorem Ipsum paragraph of 45 words.
func LoremParagraphs ¶
LoremParagraphs generates and returns a specified number of lorem ipsum paragraphs as a single string. The parameter 'count' specifies the number of paragraphs to generate.
func LoremSentence ¶
func LoremSentence() string
LoremSentence generates and returns a placeholder sentence of 8 words using lorem ipsum text.
func LoremSentenceCustom ¶
LoremSentenceCustom generates a lorem ipsum sentence with the specified word count. Returns the generated string.
func LoremSentences ¶
LoremSentences generates a string containing the specified number of 8 word lorem ipsum sentences.
func LoremSentencesCustom ¶
LoremSentencesCustom generates multiple lorem ipsum sentences with the specified sentence count and word length per sentence.
func LoremSentencesVariable ¶
LoremSentencesVariable generates variable length lorem sentences with lengths between specified min and max values. The parameter 'count' specifies the number of sentences to generate.
func LoremURL ¶
func LoremURL() string
LoremURL generates and returns a string representing a placeholder or mock URL, intended for testing or default usage.
func LoremWord ¶
func LoremWord() string
LoremWord generates and returns a random lorem ipsum word as a string.
func LoremWords ¶
LoremWords generates a string containing the specified number of lorem ipsum words.
func NormalizeDiacritics ¶
NormalizeDiacritics removes diacritical marks (accents) from the input string and returns the normalized version.
func NormalizeUnicode ¶
func NormalizeUnicode(s string, form NormalizationFormat) string
NormalizeUnicode normalizes a string to the specified Unicode normalization form (NFC, NFD, NFKC, or NFKD).
func NormalizeWhitespace ¶
NormalizeWhitespace removes excess whitespace by trimming and collapsing multiple whitespace characters into single spaces.
func NormalizeWhitespaceWithIgnore ¶
NormalizeWhitespaceWithIgnore replaces all whitespace in a string with the specified rune, excluding ignored ones.
func PrependString ¶
PrependString adds a prefix and separator to the beginning of the given string and returns the resulting string.
Example ¶
s := PrependString("ENV_VAR", "APP", "_")
fmt.Printf("%s", s)
Output: APP_ENV_VAR
func RandomAlphaNumericString ¶
RandomAlphaNumericString generates a random alphanumeric string of the specified length using the AlphaNumericChars character set. This uses math/rand and is NOT cryptographically secure. For security-sensitive applications, use crypto/rand directly.
func RandomAlphaString ¶
RandomAlphaString generates a random string of the specified length containing only alphabetic characters (A-Za-z).
func RandomString ¶
func RandomString(length int, charSet CharacterSet) string
RandomString generates a random string of the specified length using the provided CharacterSet.
func RandomStringFromCustomCharset ¶
RandomStringFromCustomCharset generates a random string of a given length using a specified custom character set.
func RandomUrlSafe ¶
RandomUrlSafe generates a random URL-safe string of the specified length using characters suitable for URLs.
func RemoveANSIEscapeCodes ¶
RemoveANSIEscapeCodes removes ANSI escape codes from the input string, returning a cleaned version without formatting sequences.
func RemoveHTML ¶
RemoveHTML removes all HTML tags from the input string and sanitizes it to ensure safe content.
func RemoveNonAlpha ¶
RemoveNonAlpha removes all non-alphabetic characters from the input string, optionally keeping whitespace if ws is true.
func RemoveNonAlphaNumeric ¶
RemoveNonAlphaNumeric removes all non-alphanumeric characters from the input string, optionally preserving whitespace if ws is true.
func RemoveNonPrintable ¶
RemoveNonPrintable removes non-printable characters from a string and substitutes them with '_'.
func RemovePrefix ¶ added in v0.3.0
RemovePrefix removes the specified prefix from a string and returns the resulting string.
func RemovePrefixWithResult ¶ added in v0.3.0
RemovePrefixWithResult removes the specified prefix from the input string and returns the modified string and a boolean. The boolean indicates whether the prefix was found and removed.
func RemoveSuffix ¶ added in v0.3.0
RemoveSuffix removes the specified suffix from the input string if it exists and returns the resulting string.
func RemoveSuffixWithResult ¶ added in v0.3.0
RemoveSuffixWithResult removes the specified suffix from the input string and returns the modified string and a boolean. The boolean indicates whether the suffix was found and removed.
func RemoveWhitespace ¶
RemoveWhitespace removes all whitespace characters (spaces, tabs, newlines, etc.) from the input string and returns the result.
func RemoveWhitespaceWithIgnore ¶
RemoveWhitespaceWithIgnore removes whitespace from the input string while ignoring whitespace characters specified in the charset string. Whitespace Chars: '\t', '\n', '\v', '\f', '\r', ' ', U+0085 (NEL), U+00A0 (NBSP)
func ReplaceNonAlpha ¶
ReplaceNonAlpha replaces all non-alphabetic characters in the input string with the specified replacement string.
func ReplaceNonAlphaNumeric ¶
ReplaceNonAlphaNumeric replaces all non-alphanumeric characters in the input string with the specified replacement string.
func ReplaceNonAlphaNumericWithIgnore ¶
ReplaceNonAlphaNumericWithIgnore replaces non-alphanumeric characters in the input string with the replacement string, while preserving characters specified in the ignore string.
func ReplaceNonAlphaWithIgnore ¶
ReplaceNonAlphaWithIgnore replaces non-alphabetic characters in a string with a replacement string, excluding specified ignores.
func ReplaceSpaces ¶
ReplaceSpaces replaces all spaces in the input string with the specified replacement string.
func ReplaceWhitespace ¶
ReplaceWhitespace replaces all whitespace characters in the input string with the given replacement string.
func ReplaceWhitespaceWithIgnore ¶
ReplaceWhitespaceWithIgnore replaces all whitespace in the input string with the specified replacement, ignoring characters present in the ignore string.
func SanitizeHTML ¶
SanitizeHTML removes potentially unsafe or harmful content from the input HTML string.
func Slugify ¶
Slugify converts a string to a URL-friendly slug, ensuring lowercase, trimming, truncation, and replacing non-alphanumerics.
Example ¶
slug := Slugify("The Life and Strange Surprising Adventures of Robinson Crusoe, Of York, Mariner", 50)
fmt.Printf("%s", slug)
Output: the-life-and-strange-surprising-adventures-of-robi
func SplitCamelCase ¶
SplitCamelCase splits a CamelCase string into separate words with spaces between them.
func SplitPascalCase ¶
SplitPascalCase splits a PascalCase or camelCase string into space-separated words.
func ToCamelCase ¶
ToCamelCase converts a string to camel case format where the first letter is lowercase and subsequent words are capitalized.
func ToDelimited ¶
ToDelimited converts a string into a delimited format based on the specified delimiter and casing options.
func ToKebabCase ¶
ToKebabCase converts a string to kebab-case or screaming-kebab-case based on the scream flag. Diacritics in the input string are normalized before conversion.
func ToLower ¶
ToLower converts all characters in the input string to lowercase and returns the resulting string.
func ToPascalCase ¶
ToPascalCase converts a given string to PascalCase format, capitalizing the first letter of each word.
func ToSnakeCase ¶
ToSnakeCase converts a string to snake_case format. If scream is true, the output will be in SCREAMING_SNAKE_CASE.
func ToSnakeCaseWithIgnore ¶
ToSnakeCaseWithIgnore converts a string to snake_case format, optionally in uppercase, ignoring specified characters.
func ToTitleCase ¶
ToTitleCase converts the input string to title case, capitalizing the first letter of each word following English rules.
func Trim ¶
Trim removes all leading and trailing white spaces from the given string and returns the trimmed result.
func TrimChars ¶
TrimChars removes all leading and trailing occurrences of specified characters from the input string.
func TrimCharsLeft ¶
TrimCharsLeft removes all leading characters specified in 'chars' from the input string 's'.
func TrimCharsRight ¶
TrimCharsRight removes all specified characters from the end of the given string.
func Truncate ¶
Truncate shortens the input string s to the specified length and appends the given suffix if truncation occurs.
func Uncapitalize ¶
Uncapitalize takes a string and returns a new string with the first character converted to lowercase.
Types ¶
type Algorithm ¶
Algorithm represents a type of string score or distance algorithm used for comparison.
type CharacterSet ¶
type CharacterSet string
CharacterSet defines a custom type representing sets of characters fit for various uses.
Options: AlphaNumericChars, Alpha, HexChars, URLSafe, WhiteSpaceChars
type ComparisonManager ¶
type ComparisonManager struct {
ComparisonResults ComparisonResultsMap
SimilarityResults SimilarityResultsMap
ShingleResults ShingleResultsMap
LCSResults LCSResultsMap
}
ComparisonManager is a structure for managing comparison, score, shingle, and LCS results.
func NewComparisonManager ¶
func NewComparisonManager() *ComparisonManager
NewComparisonManager initializes and returns a new instance of ComparisonManager with empty result maps.
func (*ComparisonManager) AddComparisonResult ¶
func (cm *ComparisonManager) AddComparisonResult(result ComparisonResult)
AddComparisonResult inserts a ComparisonResult into the ComparisonResultsMap, organizing it by type and first string.
func (*ComparisonManager) AddLCSResult ¶
func (cm *ComparisonManager) AddLCSResult(result LCSResult)
AddLCSResult adds an LCSResult to the LCSResults map in the ComparisonManager, organizing it by type and input string.
func (*ComparisonManager) AddShingleResult ¶
func (cm *ComparisonManager) AddShingleResult(result ShingleResult)
AddShingleResult inserts a ShingleResult into the ShingleResults map organized by type and n-gram length.
func (*ComparisonManager) AddSimilarityResult ¶
func (cm *ComparisonManager) AddSimilarityResult(result SimilarityResult)
AddSimilarityResult adds a given SimilarityResult to the SimilarityResultsMap of the ComparisonManager instance.
func (*ComparisonManager) CopyComparisonResultsMap ¶
func (cm *ComparisonManager) CopyComparisonResultsMap() ComparisonResultsMap
CopyComparisonResultsMap returns a copy of the ComparisonResultsMap from the ComparisonManager instance.
func (*ComparisonManager) CopyLCSResultsMap ¶
func (cm *ComparisonManager) CopyLCSResultsMap() LCSResultsMap
CopyLCSResultsMap returns a copy of the LCSResultsMap from the ComparisonManager, or nil if LCSResults is uninitialized.
func (*ComparisonManager) CopyShingleResultsMap ¶
func (cm *ComparisonManager) CopyShingleResultsMap() ShingleResultsMap
CopyShingleResultsMap returns a copy of the ShingleResultsMap if it exists; otherwise, it returns nil.
func (*ComparisonManager) CopySimilarityResultsMap ¶
func (cm *ComparisonManager) CopySimilarityResultsMap() SimilarityResultsMap
CopySimilarityResultsMap returns a copy of the SimilarityResultsMap held by the ComparisonManager instance. If the SimilarityResults map is nil, it returns nil.
func (*ComparisonManager) FilterComparisonResultsByComparisonString ¶
func (cm *ComparisonManager) FilterComparisonResultsByComparisonString(compStr string) ComparisonResultsMap
FilterComparisonResultsByComparisonString filters and returns a ComparisonResultsMap containing entries matching compStr.
func (*ComparisonManager) FilterComparisonResultsByType ¶
func (cm *ComparisonManager) FilterComparisonResultsByType(compType ComparisonResultType) ComparisonResultsMap
FilterComparisonResultsByType filters and returns a map of ComparisonResults matching the specified type.
func (*ComparisonManager) FilterLCSResultsByComparisonString ¶
func (cm *ComparisonManager) FilterLCSResultsByComparisonString(compStr string) LCSResultsMap
FilterLCSResultsByComparisonString filters LCS results based on the provided comparison string and returns a filtered map.
func (*ComparisonManager) FilterLCSResultsByType ¶
func (cm *ComparisonManager) FilterLCSResultsByType(lcsType LCSResultType) LCSResultsMap
FilterLCSResultsByType filters the LCS results based on the given LCSResultType and returns the filtered results map.
func (*ComparisonManager) FilterShingleResultsByNGramLength ¶
func (cm *ComparisonManager) FilterShingleResultsByNGramLength(ngramLength int) ShingleResultsMap
FilterShingleResultsByNGramLength filters ShingleResultsMap to include entries matching the specified n-gram length.
func (*ComparisonManager) FilterShingleResultsByType ¶
func (cm *ComparisonManager) FilterShingleResultsByType(resType ShingleResultType) ShingleResultsMap
FilterShingleResultsByType filters the ShingleResultsMap to include entries matching the specified ShingleResultType.
func (*ComparisonManager) FilterSimilarityResultsByComparisonString ¶
func (cm *ComparisonManager) FilterSimilarityResultsByComparisonString(compStr string) SimilarityResultsMap
FilterSimilarityResultsByComparisonString filters the SimilarityResultsMap based on a given comparison string.
func (*ComparisonManager) FilterSimilarityResultsByType ¶
func (cm *ComparisonManager) FilterSimilarityResultsByType(algo Algorithm) SimilarityResultsMap
FilterSimilarityResultsByType filters the SimilarityResultsMap to include entries matching the specified algorithm type.
func (*ComparisonManager) GetComparisonResult ¶
func (cm *ComparisonManager) GetComparisonResult(compResType ComparisonResultType, compStr string) ComparisonResult
GetComparisonResult retrieves a ComparisonResult from the ComparisonResults map based on the provided type and string key.
func (*ComparisonManager) GetComparisonResultsByString ¶
func (cm *ComparisonManager) GetComparisonResultsByString(compStr string) []ComparisonResult
GetComparisonResultsByString retrieves all ComparisonResult objects associated with the given string key from ComparisonResults.
func (*ComparisonManager) GetComparisonResultsByType ¶
func (cm *ComparisonManager) GetComparisonResultsByType(compResType ComparisonResultType) []ComparisonResult
GetComparisonResultsByType retrieves all ComparisonResults of the specified ComparisonResultType from the ComparisonResults map.
func (*ComparisonManager) GetComparisonResultsMap ¶
func (cm *ComparisonManager) GetComparisonResultsMap() ComparisonResultsMap
GetComparisonResultsMap returns the ComparisonResultsMap from the ComparisonManager instance.
func (*ComparisonManager) GetLCSResult ¶
func (cm *ComparisonManager) GetLCSResult(lcsType LCSResultType, inputStr string) *LCSResult
GetLCSResult retrieves the LCSResult object based on the provided LCSResultType and input string. Returns nil if the LCSResults map is uninitialized.
func (*ComparisonManager) GetLCSResultsByComparisonString ¶
func (cm *ComparisonManager) GetLCSResultsByComparisonString(compStr string) []LCSResult
GetLCSResultsByComparisonString retrieves LCS results that match the provided comparison string. It returns a slice of LCSResult or nil if no results are available.
func (*ComparisonManager) GetLCSResultsByType ¶
func (cm *ComparisonManager) GetLCSResultsByType(lcsType LCSResultType) []LCSResult
GetLCSResultsByType retrieves LCSResults filtered by the specified LCSResultType from the ComparisonManager.
func (*ComparisonManager) GetLCSResultsMap ¶
func (cm *ComparisonManager) GetLCSResultsMap() LCSResultsMap
GetLCSResultsMap retrieves the LCSResultsMap containing LCS results organized by type and input string.
func (*ComparisonManager) GetShingleResult ¶
func (cm *ComparisonManager) GetShingleResult(resType ShingleResultType, ngramLength int) ShingleResult
GetShingleResult retrieves a ShingleResult based on the specified ShingleResultType and n-gram length. Returns nil if no matching result exists or if the ShingleResults map is uninitialized.
func (*ComparisonManager) GetShingleResultsByNGramLength ¶
func (cm *ComparisonManager) GetShingleResultsByNGramLength(ngramLength int) []ShingleResult
GetShingleResultsByNGramLength retrieves a slice of ShingleResult based on the specified n-gram length. Returns nil if no ShingleResults are available.
func (*ComparisonManager) GetShingleResultsByType ¶
func (cm *ComparisonManager) GetShingleResultsByType(resType ShingleResultType) []ShingleResult
GetShingleResultsByType retrieves all ShingleResults of the specified ShingleResultType from the ShingleResults map.
func (*ComparisonManager) GetShingleResultsMap ¶
func (cm *ComparisonManager) GetShingleResultsMap() ShingleResultsMap
GetShingleResultsMap retrieves the ShingleResultsMap from the ComparisonManager instance.
func (*ComparisonManager) GetSimilarityResult ¶
func (cm *ComparisonManager) GetSimilarityResult(algo Algorithm, compStr string) *SimilarityResult
GetSimilarityResult retrieves a SimilarityResult for the specified algorithm and comparison string. Returns nil if no results are found.
func (*ComparisonManager) GetSimilarityResultsByComparisonString ¶
func (cm *ComparisonManager) GetSimilarityResultsByComparisonString(compStr string) []SimilarityResult
GetSimilarityResultsByComparisonString retrieves a slice of SimilarityResult associated with the given comparison string.
func (*ComparisonManager) GetSimilarityResultsByType ¶
func (cm *ComparisonManager) GetSimilarityResultsByType(algo Algorithm) []SimilarityResult
GetSimilarityResultsByType retrieves all SimilarityResults corresponding to the specified Algorithm type.
func (*ComparisonManager) GetSimilarityResultsMap ¶
func (cm *ComparisonManager) GetSimilarityResultsMap() SimilarityResultsMap
GetSimilarityResultsMap retrieves the SimilarityResultsMap, containing score results organized by algorithm and comparison string.
type ComparisonResult ¶
type ComparisonResult interface {
GetType() ComparisonResultType
GetTypeName() string
GetString1() string
GetString2() string
GetStrings() (string, string)
GetSplitLength() (int, error)
GetError() error
IsMatch(other ComparisonResult) bool
Print(v bool)
}
ComparisonResult defines an interface for comparing two strings and retrieving results, types, and errors.
func CastComparisonResult ¶
func CastComparisonResult(raw *ComparisonResult) ComparisonResult
CastComparisonResult converts a raw ComparisonResult pointer into a specific type based on the ComparisonResultType input. Returns ComparisonResultInt for integer-based types, ComparisonResultFloat for float-based types, or the raw result otherwise. Returns nil if the input raw ComparisonResult pointer is nil.
type ComparisonResultFloat ¶
type ComparisonResultFloat struct {
// contains filtered or unexported fields
}
ComparisonResultFloat represents the result of a comparison operation, including its type, input strings, score, and an optional error.
func CosineSimilarity ¶
func CosineSimilarity(s1, s2 string, splitLength int) *ComparisonResultFloat
CosineSimilarity computes the cosine score between two strings using the specified n-gram split length. Returns a pointer to the score score or nil if the split length is negative. If the split length is zero, it splits the strings on whitespaces.
Cosine score is the cosine of the angle between the vectors.
Additional Info: https://en.wikipedia.org/wiki/Cosine_similarity/
func JaccardSimilarity ¶
func JaccardSimilarity(s1, s2 string, splitLength int) *ComparisonResultFloat
JaccardSimilarity computes the Jaccard score coefficient between two strings, using k-grams of the given split length. For splitLength = 0, the strings are split on whitespaces
The Jaccard index is defined as the size of the intersection divided by the size of the union for two given finite, non-empty sets
Additional Info: https://en.wikipedia.org/wiki/Jaccard_index
func JaroSimilarity ¶
func JaroSimilarity(s1, s2 string) *ComparisonResultFloat
JaroSimilarity calculates the Jaro score between two strings, returns a ComparisonResultFloat pointer
The higher the value, the more similar the strings are. The score is normalized such that 0 equates to no similarities and 1 is an exact match
Additional Info: https://rosettacode.org/wiki/Jaro_similarity
func JaroWinklerSimilarity ¶
func JaroWinklerSimilarity(s1, s2 string) *ComparisonResultFloat
JaroWinklerSimilarity computes the Jaro-Winkler score between two strings and returns a ComparisonResultFloat pointer.
Uses Jaro score with a more favorable weighting for similar common prefixes.
Additional Info: https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance#Jaro%E2%80%93Winkler_similarity
func NewComparisonResultFloat ¶
func NewComparisonResultFloat(comparisonType ComparisonResultType, string1 string, string2 string, splitLength *int, score *float32, error error) *ComparisonResultFloat
func QgramSimilarity ¶
func QgramSimilarity(s1, s2 string, q int) *ComparisonResultFloat
QgramSimilarity calculates the q-gram score between two strings using the specified q-gram size. Returns a pointer to the score score or nil if the q-gram size is less than 1.
func SorensenDiceCoefficient ¶
func SorensenDiceCoefficient(s1, s2 string, splitLength int) *ComparisonResultFloat
SorensenDiceCoefficient computes the Sørensen–Dice coefficient for two strings using a given n-gram split length. Returns a pointer to the coefficient value or nil if the splitLength is negative.
The Sørensen index equals twice the number of elements common to both sets divided by the sum of the number of elements in each set.
Additional Info: https://en.wikipedia.org/wiki/Dice-S%C3%B8rensen_coefficient
func (*ComparisonResultFloat) GetError ¶
func (c *ComparisonResultFloat) GetError() error
GetError returns the error encountered during the comparison, or nil if no error occurred.
func (*ComparisonResultFloat) GetScoreFloat ¶
func (c *ComparisonResultFloat) GetScoreFloat() (float32, error)
GetScoreFloat retrieves the comparison score as a float32 and any associated error. Returns 0.00 and an error if unavailable.
func (*ComparisonResultFloat) GetSplitLength ¶
func (c *ComparisonResultFloat) GetSplitLength() (int, error)
GetSplitLength retrieves the value of the splitLength field as a pointer to an integer.
func (*ComparisonResultFloat) GetString1 ¶
func (c *ComparisonResultFloat) GetString1() string
GetString1 returns the first string (string1) stored in the ComparisonResultFloat instance.
func (*ComparisonResultFloat) GetString2 ¶
func (c *ComparisonResultFloat) GetString2() string
GetString2 returns the second string associated with the ComparisonResultFloat instance.
func (*ComparisonResultFloat) GetStrings ¶
func (c *ComparisonResultFloat) GetStrings() (string, string)
GetStrings returns the two strings stored in the ComparisonResultFloat instance.
func (*ComparisonResultFloat) GetType ¶
func (c *ComparisonResultFloat) GetType() ComparisonResultType
GetType returns the type of comparison as a value of ComparisonResultType.
func (*ComparisonResultFloat) GetTypeName ¶
func (c *ComparisonResultFloat) GetTypeName() string
GetTypeName returns the string representation of the comparison type from the comparisonType field.
func (*ComparisonResultFloat) IsMatch ¶
func (c *ComparisonResultFloat) IsMatch(other ComparisonResult) bool
IsMatch compares another ComparisonResult instance to determine equivalence based on type, fields, and score criteria.
func (*ComparisonResultFloat) Print ¶
func (c *ComparisonResultFloat) Print(v bool)
Print outputs the formatted comparison result or error details depending on the verbosity flag (v).
type ComparisonResultInt ¶
type ComparisonResultInt struct {
// contains filtered or unexported fields
}
ComparisonResultInt represents the result of a comparison between two strings, including type, score, and error details.
func DamerauLevenshteinDistance ¶
func DamerauLevenshteinDistance(s1, s2 string) *ComparisonResultInt
DamerauLevenshteinDistance calculates the Damerau-Levenshtein distance between two strings to measure their score.
func HammingDistance ¶
func HammingDistance(s1, s2 string) *ComparisonResultInt
HammingDistance computes the Hamming distance between two strings s1 and s2, returning a ComparisonResultInt and an error if the strings are of unequal length.
The Hamming distance between two equal-length strings of symbols is the number of positions at which the corresponding symbols are different.
Additional Info: https://en.wikipedia.org/wiki/Hamming_distance
func LCS ¶
func LCS(s1, s2 string) *ComparisonResultInt
LCS calculates the length of the longest common subsequence between two input strings s1 and s2.
func LCSEditDistance ¶
func LCSEditDistance(s1, s2 string) *ComparisonResultInt
LCSEditDistance computes the edit distance between two strings using the Longest Common Subsequence (LCS) method.
func LevenshteinDistance ¶
func LevenshteinDistance(s1, s2 string) *ComparisonResultInt
LevenshteinDistance calculates the Levenshtein distance between two strings and returns a ComparisonResultInt. It determines the minimum number of single-character edits (insertions, deletions, or substitutions) required.
func NewComparisonResultInt ¶
func NewComparisonResultInt(comparisonType ComparisonResultType, string1 string, string2 string, splitLength *int, score *int, error error) *ComparisonResultInt
func OSADamerauLevenshteinDistance ¶
func OSADamerauLevenshteinDistance(s1, s2 string) *ComparisonResultInt
OSADamerauLevenshteinDistance calculates the optimal string alignment variant of Damerau-Levenshtein distance. It returns a ComparisonResultInt containing the computed distance and details for the input strings.
func QgramDistance ¶
func QgramDistance(s1, s2 string, q int) *ComparisonResultInt
QgramDistance calculates the q-gram distance between two strings s1 and s2 using the specified q-gram size q.
func QgramDistanceCustomNgram ¶
func QgramDistanceCustomNgram(nmap1, nmap2 map[string]int, customName string) *ComparisonResultInt
QgramDistanceCustomNgram computes the q-gram distance between two n-gram frequency maps represented as string-int maps. It compares the input frequency maps and returns an integer representing the calculated distance.
func (*ComparisonResultInt) GetError ¶
func (c *ComparisonResultInt) GetError() error
GetError returns the error associated with the ComparisonResultInt, if any.
func (*ComparisonResultInt) GetScoreInt ¶
func (c *ComparisonResultInt) GetScoreInt() (int, error)
GetScoreInt retrieves the comparison score as an integer and returns an error if no score or an error is present.
func (*ComparisonResultInt) GetSplitLength ¶
func (c *ComparisonResultInt) GetSplitLength() (int, error)
GetSplitLength returns the split length of the comparison result as a pointer to an integer.
func (*ComparisonResultInt) GetString1 ¶
func (c *ComparisonResultInt) GetString1() string
GetString1 retrieves the first string (string1) associated with the ComparisonResultInt instance.
func (*ComparisonResultInt) GetString2 ¶
func (c *ComparisonResultInt) GetString2() string
GetString2 returns the second comparison string from the ComparisonResultInt instance.
func (*ComparisonResultInt) GetStrings ¶
func (c *ComparisonResultInt) GetStrings() (string, string)
GetStrings returns the two strings, string1 and string2, stored in the ComparisonResultInt instance.
func (*ComparisonResultInt) GetType ¶
func (c *ComparisonResultInt) GetType() ComparisonResultType
GetType returns the ComparisonResultType associated with the ComparisonResultInt instance.
func (*ComparisonResultInt) GetTypeName ¶
func (c *ComparisonResultInt) GetTypeName() string
GetTypeName retrieves the string representation of the comparison type for the ComparisonResultInt instance.
func (*ComparisonResultInt) IsMatch ¶
func (c *ComparisonResultInt) IsMatch(other ComparisonResult) bool
IsMatch checks if two ComparisonResultInt objects are equivalent by comparing their type, strings, score, split length, and errors.
func (*ComparisonResultInt) Print ¶
func (c *ComparisonResultInt) Print(v bool)
Print outputs the formatted result of the comparison, optionally including verbose error details based on the input flag v.
type ComparisonResultScore ¶
ComparisonResultScore represents a type constraint for a pointer to either an int or a float32.
type ComparisonResultType ¶
type ComparisonResultType int
ComparisonResultType represents various types of comparison results for string score and distance measurements.
const ( LCSLength ComparisonResultType = iota LCSDist LevDist DamLevDist OSADamLevDist HammingDist JaroSim JaroWinklerSim JaccardSim CosineSim SorensenDiceCo QGramDist QGramDistCust QGramSim )
LCSLength represents the comparison result type using Longest Common Subsequence length. LCSDist represents the comparison result type using Longest Common Subsequence distance. LevDist represents the comparison result type using Levenshtein distance. DamLevDist represents the comparison result type using Damerau-Levenshtein distance. OSADamLevDist represents the comparison result type using Optimal String Alignment distance. HammingDist represents the comparison result type using Hamming distance. JaroSim represents the comparison result type using Jaro score. JaroWinklerSim represents the comparison result type using Jaro-Winkler score. JaccardSim represents the comparison result type using Jaccard score. CosineSim represents the comparison result type using Cosine score. SorensenDiceCo represents the comparison result type using Sørensen-Dice coefficient. QGramDist represents the comparison result type using Q-Gram distance with default q-gram size. QGramDistCust represents the comparison result type using Q-Gram distance with custom q-gram size. QGramSim represents the comparison result type using Q-Gram score.
func (ComparisonResultType) String ¶
func (c ComparisonResultType) String() string
String returns the string representation of the ComparisonResultType value using the ComparisonResultTypeMap.
type ComparisonResultsMap ¶
type ComparisonResultsMap map[ComparisonResultType]map[string]*ComparisonResult
ComparisonResultsMap maps a ComparisonResultType to a nested map of string keys and pointers to ComparisonResult objects.
func NewComparisonResultsMap ¶
func NewComparisonResultsMap() ComparisonResultsMap
NewComparisonResultsMap initializes and returns an empty ComparisonResultsMap for storing comparison results.
func (ComparisonResultsMap) Add ¶
func (crm ComparisonResultsMap) Add(result ComparisonResult)
Add inserts a ComparisonResult into the map, organizing it by its type and second string, creating sub-maps as needed.
func (ComparisonResultsMap) EntryCount ¶
func (crm ComparisonResultsMap) EntryCount() int
EntryCount returns the total number of non-nil ComparisonResult entries stored in the nested maps of the structure.
func (ComparisonResultsMap) FilterByComparisonString ¶
func (crm ComparisonResultsMap) FilterByComparisonString(compStr string) ComparisonResultsMap
FilterByComparisonString filters the map, returning a new map with results matching the given comparison string key.
func (ComparisonResultsMap) FilterByType ¶
func (crm ComparisonResultsMap) FilterByType(compResType ComparisonResultType) ComparisonResultsMap
FilterByType filters the ComparisonResultsMap by the specified ComparisonResultType and returns a new map with the results.
func (ComparisonResultsMap) Get ¶
func (crm ComparisonResultsMap) Get(compResType ComparisonResultType, compStr string) ComparisonResult
Get retrieves a ComparisonResult from the map using the specified ComparisonResultType and comparison string. The underlying returned objects are pointers to either ComparisonResultInt or ComparisonResultFloat
func (ComparisonResultsMap) GetByComparisonString ¶
func (crm ComparisonResultsMap) GetByComparisonString(compStr string) []ComparisonResult
GetByComparisonString retrieves a list of ComparisonResult objects associated with the provided comparison string.
func (ComparisonResultsMap) GetByType ¶
func (crm ComparisonResultsMap) GetByType(compResType ComparisonResultType) []ComparisonResult
GetByType retrieves a slice of ComparisonResult for the specified ComparisonResultType or nil if no results are found.
func (ComparisonResultsMap) GetCopy ¶
func (crm ComparisonResultsMap) GetCopy() ComparisonResultsMap
GetCopy creates and returns a deep copy of the current ComparisonResultsMap.
func (ComparisonResultsMap) IsMatch ¶
func (crm ComparisonResultsMap) IsMatch(other ComparisonResultsMap) bool
IsMatch compares the current ComparisonResultsMap with another map for structural and value equality.
func (ComparisonResultsMap) Print ¶
func (crm ComparisonResultsMap) Print(verbose bool) ComparisonResultsMap
Print iterates through the ComparisonResultsMap and prints the comparison results, optionally in verbose mode.
func (ComparisonResultsMap) TypeCount ¶
func (crm ComparisonResultsMap) TypeCount() int
TypeCount returns the number of distinct ComparisonResultType keys in the ComparisonResultsMap.
type LCSResult ¶
type LCSResult struct {
// contains filtered or unexported fields
}
LCSResult encapsulates the result of a Longest Common Subsequence (LCS) computation between two strings.
func LCSBacktrack ¶
LCSBacktrack computes the longest common subsequence (LCS) between two input strings and returns an LCSResult.
func LCSBacktrackAll ¶
LCSBacktrackAll computes all longest common subsequences of two input strings and returns them as an LCSResult.
func LCSDiff ¶
LCSDiff computes the Longest Common Subsequence (LCS) difference between two strings and returns an LCSResult instance.
func NewLCSResult ¶
func NewLCSResult(resultType LCSResultType, string1 string, string2 string, result *[]string, err error) *LCSResult
NewLCSResult creates and returns a pointer to an LCSResult with the specified type, strings, and result slice.
func (*LCSResult) GetError ¶
GetError returns the error associated with the LCSResult instance, if any.
func (*LCSResult) GetResult ¶
GetResult retrieves the pointer to the list of longest common subsequence results stored in the LCSResult instance.
func (*LCSResult) GetString1 ¶
GetString1 returns the value of string1 from the LCSResult instance.
func (*LCSResult) GetString2 ¶
GetString2 retrieves the second string (string2) associated with the LCSResult.
func (*LCSResult) GetStrings ¶
GetStrings returns the two input strings stored in the LCSResult instance.
func (*LCSResult) GetType ¶
func (lcs *LCSResult) GetType() LCSResultType
GetType returns the result type of the LCSResult, indicating the type of LCS computation performed.
func (*LCSResult) GetTypeName ¶
type LCSResultType ¶
type LCSResultType int
LCSResultType represents an enumerated type used to define different result types for Longest Common Subsequence calculations.
const ( LCSBacktrackWord LCSResultType = iota LCSBacktrackWordAll LCSDiffSlice )
LCSBacktrackWord indicates backtracking for a single LCS word result. LCSBacktrackWordAll indicates backtracking for all LCS word results. LCSDiffSlice represents an LCS result in the form of a diff slice.
func (LCSResultType) String ¶
func (l LCSResultType) String() string
String returns the string representation for the corresponding LCSResultType using LCSResultTypeMap.
type LCSResultsMap ¶
type LCSResultsMap map[LCSResultType]map[string]*LCSResult
LCSResultsMap is a map that organizes LCSResult instances by their LCSResultType and a string identifier.
func NewLCSResultsMap ¶
func NewLCSResultsMap() LCSResultsMap
NewLCSResultsMap initializes and returns a new LCSResultsMap as an empty nested map.
func (LCSResultsMap) Add ¶
func (lrm LCSResultsMap) Add(result LCSResult)
Add inserts an LCSResult into the LCSResultsMap organized by result type and the comparison input string.
func (LCSResultsMap) EntryCount ¶
func (lrm LCSResultsMap) EntryCount() int
EntryCount returns the total number of non-nil LCSResult entries in the LCSResultsMap.
func (LCSResultsMap) FilterByComparisonString ¶
func (lrm LCSResultsMap) FilterByComparisonString(compStr string) LCSResultsMap
FilterByComparisonString filters the LCSResultsMap by a given comparison string and returns a new map with matching results.
func (LCSResultsMap) FilterByType ¶
func (lrm LCSResultsMap) FilterByType(resType LCSResultType) LCSResultsMap
FilterByType filters the LCSResultsMap by the specified LCSResultType and returns a new map containing only matching results.
func (LCSResultsMap) Get ¶
func (lrm LCSResultsMap) Get(resType LCSResultType, compStr string) *LCSResult
Get retrieves the LCSResult for the given LCSResultType and comparison string from the LCSResultsMap. Returns nil if no result is found for the specified type or string.
func (LCSResultsMap) GetByComparisonString ¶
func (lrm LCSResultsMap) GetByComparisonString(compStr string) []LCSResult
GetByComparisonString retrieves all LCSResult objects from the map that match the specified comparison string. Returns nil if no results are found or the map is empty.
func (LCSResultsMap) GetByType ¶
func (lrm LCSResultsMap) GetByType(resType LCSResultType) []LCSResult
GetByType returns a slice of LCSResult objects from the LCSResultsMap based on their LCSResultType
func (LCSResultsMap) GetCopy ¶
func (lrm LCSResultsMap) GetCopy() LCSResultsMap
GetCopy creates and returns a deep copy of the LCSResultsMap, duplicating all nested maps and their LCSResult values.
func (LCSResultsMap) IsMatch ¶
func (lrm LCSResultsMap) IsMatch(other LCSResultsMap) bool
IsMatch compares the current LCSResultsMap with another, checking if they have identical structure and matching entries.
func (LCSResultsMap) Print ¶
func (lrm LCSResultsMap) Print(v bool) LCSResultsMap
Print outputs the contents of the LCSResultsMap to the console in a formatted manner based on the verbosity flag.
func (LCSResultsMap) TypeCount ¶
func (lrm LCSResultsMap) TypeCount() int
TypeCount returns the number of LCSResultType keys in the LCSResultsMap.
type NormalizationFormat ¶
NormalizationFormat represents a wrapper around norm.Form for specifying Unicode normalization forms.
type RuneSet ¶
type RuneSet int
const ( Letter RuneSet = iota Digit Number AlphaNumeric WhiteSpace Punctuation Symbol Upper Lower Title Control Graphic Mark Printable )
Letter represents a set of letter runes. Digit represents a set of digit runes. Number represents a set of numeric runes. AlphaNumericChars represents a set of alphanumeric runes. WhiteSpaceChars represents a set of whitespace runes. Punctuation represents a set of punctuation runes. Symbol represents a set of symbol runes. Upper represents a set of uppercase letter runes. Lower represents a set of lowercase letter runes. Title represents a set of title-case letter runes. Control represents a set of control character runes. Graphic represents a set of graphic character runes. Mark represents a set of mark character runes. Printable represents a set of printable character runes.
func GetRuneSet ¶
GetRuneSet retrieves a RuneSet from the RuneSetNames map by its name. Returns the RuneSet and a boolean indicating if the name was found.
type ShingleMapResult ¶
type ShingleMapResult struct {
// contains filtered or unexported fields
}
ShingleMapResult is a struct that holds the results of generating shingles, including metadata and possible errors. resultType defines the type of shingle result, e.g., map or slice. input holds the original string input used for generating shingles. ngram specifies the length of n-grams used in shingle generation. shingles is a pointer to a map containing shingles as keys and their frequencies as values. err represents a potential error encountered during shingle generation.
func NewShingleMapResult ¶
func NewShingleMapResult(resultType ShingleResultType, input string, ngram int, shingles map[string]int, err error) *ShingleMapResult
NewShingleMapResult creates and returns a new instance of ShingleMapResult with the provided parameters.
func Shingle ¶
func Shingle(s string, k int) *ShingleMapResult
Shingle generates k-shingles from the input string and returns a pointer to a map with shingles and their counts.
func (*ShingleMapResult) GetError ¶
func (s *ShingleMapResult) GetError() error
GetError returns the error associated with the ShingleMapResult, if any.
func (*ShingleMapResult) GetInput ¶
func (s *ShingleMapResult) GetInput() string
GetInput returns the input string associated with the ShingleMapResult.
func (*ShingleMapResult) GetNgramLength ¶
func (s *ShingleMapResult) GetNgramLength() int
GetNgramLength returns the n-gram length associated with the ShingleMapResult instance.
func (*ShingleMapResult) GetShinglesMap ¶
func (s *ShingleMapResult) GetShinglesMap() map[string]int
GetShinglesMap returns a pointer to the map of shingles and their corresponding counts for the given input.
func (*ShingleMapResult) GetType ¶
func (s *ShingleMapResult) GetType() ShingleResultType
GetType returns the type of the shingle result as a ShingleResultType.
func (*ShingleMapResult) GetTypeName ¶
func (s *ShingleMapResult) GetTypeName() string
GetTypeName returns the string representation of the result type stored in the ShingleMapResult instance.
func (*ShingleMapResult) IsMatch ¶
func (s *ShingleMapResult) IsMatch(other ShingleResult) bool
IsMatch compares the current ShingleMapResult with another ShingleResult for equality based on their fields and content.
func (*ShingleMapResult) Print ¶
func (s *ShingleMapResult) Print(v bool)
Print outputs the shingle result information based on the verbose flag. Handles errors and displays shingles if present.
type ShingleResult ¶
type ShingleResult interface {
GetType() ShingleResultType
GetTypeName() string
GetInput() string
GetNgramLength() int
GetError() error
IsMatch(other ShingleResult) bool
Print(v bool)
}
ShingleResult defines an interface for managing and retrieving shingle-related results and their metadata. GetType retrieves the shingle result type, indicating the structure of the result such as map or slice. GetInput retrieves the input string used to generate the shingle result. GetNgramLength retrieves the n-gram length used to compute the shingles. Error returns the error encountered during the shingle computation, if any. Print outputs the details of the shingle result or error based on the verbosity flag 'v'.
func CastShingleResult ¶
func CastShingleResult(raw *ShingleResult) ShingleResult
CastShingleResult casts a generic ShingleResult to a concrete type like ShingleMapResult or ShingleSliceResult based on its type. Returns nil if the input is nil or cannot be cast to a valid ShingleResult implementation.
type ShingleResultType ¶
type ShingleResultType int
ShingleResultType is an enumerated type used to represent the type of shingle result, such as map or slice.
const ( ShinglesMap ShingleResultType = iota ShinglesSlice )
ShinglesMap represents a result type where shingles are stored in a map. ShinglesSlice represents a result type where shingles are stored in a slice.
func (ShingleResultType) String ¶
func (s ShingleResultType) String() string
String returns the string representation of a ShingleResultType by looking it up in the ShingleResultTypeMap.
type ShingleResultsMap ¶
type ShingleResultsMap map[ShingleResultType]map[int]*ShingleResult
ShingleResultsMap is a nested map structure that organizes shingle results by their type and n-gram length.
func NewShingleResultsMap ¶
func NewShingleResultsMap() ShingleResultsMap
NewShingleResultsMap initializes and returns a new ShingleResultsMap as an empty nested map.
func (ShingleResultsMap) Add ¶
func (srm ShingleResultsMap) Add(result ShingleResult)
Add inserts a ShingleResult into the ShingleResultsMap, organizing it by type and n-gram length.
func (ShingleResultsMap) EntryCount ¶
func (srm ShingleResultsMap) EntryCount() int
EntryCount returns the total number of non-nil entries across all nested maps within the ShingleResultsMap.
func (ShingleResultsMap) FilterByNGramLength ¶
func (srm ShingleResultsMap) FilterByNGramLength(ngramLength int) ShingleResultsMap
FilterByNGramLength filters the map by a specified n-gram length and returns a new map containing the results.
func (ShingleResultsMap) FilterByType ¶
func (srm ShingleResultsMap) FilterByType(resType ShingleResultType) ShingleResultsMap
FilterByType filters the ShingleResultsMap by the specified ShingleResultType and returns a new map with matching results.
func (ShingleResultsMap) Get ¶
func (srm ShingleResultsMap) Get(resType ShingleResultType, ngramLength int) ShingleResult
Get retrieves a ShingleResult from the ShingleResultsMap based on the specified type and n-gram length.
func (ShingleResultsMap) GetByNGramLength ¶
func (srm ShingleResultsMap) GetByNGramLength(ngramLength int) []ShingleResult
GetByNGramLength retrieves all ShingleResult instances from the map that match the specified n-gram length.
func (ShingleResultsMap) GetByType ¶
func (srm ShingleResultsMap) GetByType(resType ShingleResultType) []ShingleResult
GetByType retrieves all ShingleResult instances of the specified ShingleResultType from the ShingleResultsMap.
func (ShingleResultsMap) GetCopy ¶
func (srm ShingleResultsMap) GetCopy() ShingleResultsMap
GetCopy creates and returns a deep copy of the ShingleResultsMap, preserving its nested structure and data integrity.
func (ShingleResultsMap) IsMatch ¶
func (srm ShingleResultsMap) IsMatch(other ShingleResultsMap) bool
IsMatch compares the current ShingleResultsMap to another and returns true if they are structurally and value-wise identical.
func (ShingleResultsMap) Print ¶
func (srm ShingleResultsMap) Print(v bool) ShingleResultsMap
Print outputs the ShingleResultsMap as a formatted string and optionally includes verbose details if 'v' is true.
func (ShingleResultsMap) TypeCount ¶
func (srm ShingleResultsMap) TypeCount() int
TypeCount returns the total number of ShingleResultType keys in the ShingleResultsMap.
type ShingleSliceResult ¶
type ShingleSliceResult struct {
// contains filtered or unexported fields
}
ShingleSliceResult represents the result of a shingle operation stored as a slice, encapsulating related metadata.
func NewShingleSliceResult ¶
func NewShingleSliceResult(resultType ShingleResultType, input string, ngram int, shingles *[]string, err error) *ShingleSliceResult
NewShingleSliceResult initializes and returns a pointer to a ShingleSliceResult with provided parameters.
func ShingleSlice ¶
func ShingleSlice(s string, k int) *ShingleSliceResult
ShingleSlice generates k-length shingles (substrings) from the input string and returns them as a pointer to a string slice. Returns nil if k is less than 1.
func (*ShingleSliceResult) GetError ¶
func (s *ShingleSliceResult) GetError() error
GetError returns the error associated with the ShingleSliceResult, if any.
func (*ShingleSliceResult) GetInput ¶
func (s *ShingleSliceResult) GetInput() string
GetInput returns the input string associated with the ShingleSliceResult.
func (*ShingleSliceResult) GetNgramLength ¶
func (s *ShingleSliceResult) GetNgramLength() int
GetNgramLength returns the n-gram length associated with the ShingleSliceResult instance.
func (*ShingleSliceResult) GetShinglesSlice ¶
func (s *ShingleSliceResult) GetShinglesSlice() []string
GetShinglesSlice returns a pointer to the slice of shingles contained in the ShingleSliceResult.
func (*ShingleSliceResult) GetType ¶
func (s *ShingleSliceResult) GetType() ShingleResultType
GetType returns the ShingleResultType associated with a ShingleSliceResult instance.
func (*ShingleSliceResult) GetTypeName ¶
func (s *ShingleSliceResult) GetTypeName() string
GetTypeName returns the string representation of the result type associated with the ShingleSliceResult instance.
func (*ShingleSliceResult) IsMatch ¶
func (s *ShingleSliceResult) IsMatch(other ShingleResult) bool
func (*ShingleSliceResult) Print ¶
func (s *ShingleSliceResult) Print(v bool)
Print outputs shingle data or error information based on the verbose flag.
type SimilarityResult ¶
type SimilarityResult struct {
// contains filtered or unexported fields
}
SimilarityResult represents the result of a score computation between two strings.
func NewSimilarityResult ¶
func NewSimilarityResult(algorithm Algorithm, str1 string, str2 string, similarity *float32, err error) *SimilarityResult
NewSimilarityResult initializes and returns a new SimilarityResult instance with the provided parameters.
func Similarity ¶
func Similarity(s1, s2 string, algorithm Algorithm) *SimilarityResult
Similarity computes the score between two input strings using the specified algorithm. Returns a SimilarityResult containing the score score or any error encountered during computation.
func (*SimilarityResult) GetAlgorithm ¶
func (sr *SimilarityResult) GetAlgorithm() Algorithm
GetAlgorithm returns the algorithm used for the score computation.
func (*SimilarityResult) GetAlgorithmName ¶
func (sr *SimilarityResult) GetAlgorithmName() string
GetAlgorithmName returns the string representation of the algorithm used in the score computation.
func (*SimilarityResult) GetError ¶
func (sr *SimilarityResult) GetError() error
GetError returns the error encountered during the score calculation, if any.
func (*SimilarityResult) GetScore ¶
func (sr *SimilarityResult) GetScore() (float32, error)
GetScore returns a pointer to the score calculated between string1 and string2.
func (*SimilarityResult) GetString1 ¶
func (sr *SimilarityResult) GetString1() string
GetString1 retrieves the first string used in the score comparison.
func (*SimilarityResult) GetString2 ¶
func (sr *SimilarityResult) GetString2() string
GetString2 returns the second string used in the score comparison.
func (*SimilarityResult) GetStrings ¶
func (sr *SimilarityResult) GetStrings() (string, string)
func (*SimilarityResult) IsMatch ¶
func (sr *SimilarityResult) IsMatch(other *SimilarityResult) bool
IsMatch compares the current SimilarityResult with another based on their algorithm, strings, and computed scores.
func (*SimilarityResult) Print ¶
func (sr *SimilarityResult) Print(v bool)
Print outputs the formatted score result or error information based on the verbosity flag.
type SimilarityResultsMap ¶
type SimilarityResultsMap map[Algorithm]map[string]*SimilarityResult
SimilarityResultsMap is keyed by algorithm and holds maps of score results keyed by comparison string.
map[Levenshtein]["comparison text"]SimilarityResult{
algorithm: Levenshtein,
string1: "original",
string2: "comparison text",
score: 0.12,
err: nil}
func NewSimilarityResultsMap ¶
func NewSimilarityResultsMap() SimilarityResultsMap
NewSimilarityResultsMap initializes and returns a new SimilarityResultsMap as an empty map.
func (SimilarityResultsMap) Add ¶
func (smr SimilarityResultsMap) Add(result SimilarityResult)
Add inserts or updates a SimilarityResult in the SimilarityResultsMap based on its algorithm and comparison word.
func (SimilarityResultsMap) EntryCount ¶
func (smr SimilarityResultsMap) EntryCount() int
EntryCount returns the total number of non-nil SimilarityResult entries within the SimilarityResultsMap.
func (SimilarityResultsMap) FilterByComparisonString ¶
func (smr SimilarityResultsMap) FilterByComparisonString(compStr string) SimilarityResultsMap
FilterByComparisonString filters the map to include only results matching the given comparison string across all algorithms.
func (SimilarityResultsMap) FilterByType ¶
func (smr SimilarityResultsMap) FilterByType(algo Algorithm) SimilarityResultsMap
FilterByType filters the SimilarityResultsMap to include only results of the specified algorithm and returns a new map.
func (SimilarityResultsMap) Get ¶
func (smr SimilarityResultsMap) Get(algo Algorithm, compStr string) *SimilarityResult
Get retrieves a pointer to the SimilarityResult for the given Algorithm and comparison string, or returns nil if not found.
func (SimilarityResultsMap) GetByComparisonString ¶
func (smr SimilarityResultsMap) GetByComparisonString(compStr string) []SimilarityResult
GetByComparisonString retrieves all SimilarityResult entries that match the specified comparison string across all algorithms.
func (SimilarityResultsMap) GetByType ¶
func (smr SimilarityResultsMap) GetByType(algo Algorithm) []SimilarityResult
GetByType retrieves all SimilarityResult entries for a specified Algorithm from the SimilarityResultsMap.
func (SimilarityResultsMap) GetCopy ¶
func (smr SimilarityResultsMap) GetCopy() SimilarityResultsMap
GetCopy creates and returns a deep copy of the SimilarityResultsMap, ensuring all nested maps and values are cloned.
func (SimilarityResultsMap) IsMatch ¶
func (smr SimilarityResultsMap) IsMatch(other SimilarityResultsMap) bool
IsMatch compares two SimilarityResultsMap objects for equality by checking type and entry counts, and all nested results.
func (SimilarityResultsMap) Print ¶
func (smr SimilarityResultsMap) Print(v bool) SimilarityResultsMap
Print iterates through the SimilarityResultsMap and prints score results for each algorithm and comparison word.
func (SimilarityResultsMap) TypeCount ¶
func (smr SimilarityResultsMap) TypeCount() int
TypeCount returns the number of algorithms present in the SimilarityResultsMap.
type StringBuilder ¶
type StringBuilder struct {
// contains filtered or unexported fields
}
StringBuilder Type & Core Methods
func New ¶
func New(s string) *StringBuilder
New creates and returns a new StringBuilder instance initialized with the provided string.
Example ¶
sb := New("Hello World!")
fmt.Printf("%q", sb.String())
Output: "Hello World!"
func NewLoremDomain ¶
func NewLoremDomain() *StringBuilder
NewLoremDomain creates and returns a new StringBuilder initialized with a domain string from the loremDomain function.
func NewLoremEmail ¶
func NewLoremEmail() *StringBuilder
NewLoremEmail initializes a StringBuilder with a generated mock email value and returns the instance.
func NewLoremParagraph ¶
func NewLoremParagraph() *StringBuilder
NewLoremParagraph creates a new StringBuilder initialized with a random Lorem Ipsum paragraph.
func NewLoremParagraphs ¶
func NewLoremParagraphs(count int) *StringBuilder
NewLoremParagraphs generates a StringBuilder containing the specified number of lorem ipsum paragraphs.
func NewLoremSentence ¶
func NewLoremSentence() *StringBuilder
NewLoremSentence creates and returns a new StringBuilder initialized with a randomly generated lorem ipsum sentence.
func NewLoremSentenceCustom ¶
func NewLoremSentenceCustom(length int) *StringBuilder
NewLoremSentenceCustom creates a new StringBuilder instance containing a lorem ipsum sentence with the specified word count.
func NewLoremSentences ¶
func NewLoremSentences(count int) *StringBuilder
NewLoremSentences creates a new StringBuilder containing the given number of lorem ipsum sentences.
func NewLoremSentencesCustom ¶
func NewLoremSentencesCustom(count int, length int) *StringBuilder
NewLoremSentencesCustom creates a new StringBuilder instance containing lorem ipsum sentences based on the given count and length.
func NewLoremSentencesVariable ¶
func NewLoremSentencesVariable(count int, min int, max int) *StringBuilder
NewLoremSentencesVariable generates a string of lorem ipsum sentences with count, min, and max controlling quantity and length.
func NewLoremURL ¶
func NewLoremURL() *StringBuilder
NewLoremURL creates and returns a new StringBuilder initialized with a lorem ipsum URL string.
func NewLoremWord ¶
func NewLoremWord() *StringBuilder
NewLoremWord creates a new StringBuilder instance with a randomly generated word as its initial value.
func NewLoremWords ¶
func NewLoremWords(count int) *StringBuilder
NewLoremWords creates a new StringBuilder initialized with a string containing the specified number of lorem ipsum words.
func NewRandom ¶
func NewRandom(length int, charSet CharacterSet) *StringBuilder
NewRandom generates a new StringBuilder containing a random string of the specified length using the given CharacterSet.
func NewRandomAlpha ¶
func NewRandomAlpha(length int) *StringBuilder
NewRandomAlpha creates a StringBuilder with a random alphabetic string (A-Za-z) of the specified length.
func NewRandomAlphaNumeric ¶
func NewRandomAlphaNumeric(length int) *StringBuilder
NewRandomAlphaNumeric creates a new StringBuilder with a random alphanumeric string of the specified length.
func NewRandomFromCustomCharSet ¶
func NewRandomFromCustomCharSet(length int, charSet string) *StringBuilder
NewRandomFromCustomCharSet generates a random string of the specified length using a custom character set.
func NewRandomHex ¶
func NewRandomHex(length int) *StringBuilder
NewRandomHex generates a new StringBuilder containing a random hexadecimal string of the specified length.
func NewRandomURLSafe ¶
func NewRandomURLSafe(length int) *StringBuilder
NewRandomURLSafe generates a StringBuilder initialized with a random URL-safe string of the given length.
func NewUUID ¶
func NewUUID() *StringBuilder
NewUUID creates and returns a new StringBuilder instance with a generated UUID value.
func NewUUIDV7 ¶
func NewUUIDV7() *StringBuilder
NewUUIDV7 generates a new UUID version 7 and returns it wrapped in a StringBuilder instance.
func (*StringBuilder) Append ¶
func (sb *StringBuilder) Append(s string, sep string) *StringBuilder
Append adds the given string `s` to the current value with the specified separator `sep` and returns the updated StringBuilder.
Example ¶
New("v0.1.0").Append("removeNonAlpha", "-").Print()
Output: v0.1.0-removeNonAlpha
func (*StringBuilder) Build ¶
func (sb *StringBuilder) Build() (string, error)
Build constructs the final string from the StringBuilder and returns it along with any encountered error.
func (*StringBuilder) Capitalize ¶
func (sb *StringBuilder) Capitalize() *StringBuilder
Capitalize converts the first character of the StringBuilder's value to uppercase while preserving the rest as is.
func (*StringBuilder) CollapseWhitespace ¶
func (sb *StringBuilder) CollapseWhitespace() *StringBuilder
CollapseWhitespace collapses consecutive whitespace characters in the StringBuilder's value into a single space and preserves leading and trailing spaces.
func (*StringBuilder) CollapseWhitespaceWithIgnore ¶
func (sb *StringBuilder) CollapseWhitespaceWithIgnore(ignoreChars string) *StringBuilder
CollapseWhitespaceWithIgnore reduces multiple sequential whitespace characters to a single instance, ignoring specified characters.
func (*StringBuilder) CosineSimilarity ¶
func (sb *StringBuilder) CosineSimilarity(other string, splitLength int) *StringBuilder
CosineSimilarity computes the cosine score between the StringBuilder value and another string with n-gram splitting. Updates the ComparisonManager with the computed score and returns the modified StringBuilder. When an error exists in the StringBuilder, it skips computation and returns itself.
Cosine score is the cosine of the angle between the vectors.
Additional Info: https://en.wikipedia.org/wiki/Cosine_similarity/
func (*StringBuilder) DamerauLevenshteinDistance ¶
func (sb *StringBuilder) DamerauLevenshteinDistance(other string) *StringBuilder
DamerauLevenshteinDistance computes the Damerau-Levenshtein distance between the StringBuilder value and another string. It calculates the minimum transformation operations including insertion, deletion, substitution, and transposition. The result is stored in the ComparisonManager of the StringBuilder instance.
func (*StringBuilder) Error ¶
func (sb *StringBuilder) Error() error
Error returns the error stored in the StringBuilder instance, or nil if no error is set.
func (*StringBuilder) EscapeHTML ¶
func (sb *StringBuilder) EscapeHTML() *StringBuilder
EscapeHTML escapes special HTML characters in the StringBuilder's value and returns the updated StringBuilder.
func (*StringBuilder) GetComparisonManager ¶
func (sb *StringBuilder) GetComparisonManager() *ComparisonManager
GetComparisonManager returns the associated ComparisonManager instance of the StringBuilder.
func (*StringBuilder) GetHistory ¶
func (sb *StringBuilder) GetHistory() *StringHistory
GetHistory returns the StringHistory associated with the StringBuilder, which tracks all string modifications.
func (*StringBuilder) GetOriginalValue ¶
func (sb *StringBuilder) GetOriginalValue() string
func (*StringBuilder) HammingDistance ¶
func (sb *StringBuilder) HammingDistance(other string) *StringBuilder
HammingDistance computes the Hamming distance between the StringBuilder value and another string, updating comparison data. Returns the StringBuilder instance. If an error occurs, it sets the internal error and preserves the original state.
func (*StringBuilder) If ¶
func (sb *StringBuilder) If(condition bool, fn func(string) string) *StringBuilder
If applies the provided function to the StringBuilder's value if the condition is true and continues processing.
func (*StringBuilder) JaccardSimilarity ¶
func (sb *StringBuilder) JaccardSimilarity(other string, splitLength int) *StringBuilder
JaccardSimilarity computes the Jaccard score coefficient between two strings, using k-grams of the given split length. For splitLength = 0, the strings are split on whitespaces. Negative split lengths return nil
The Jaccard index is defined as the size of the intersection divided by the size of the union for two given finite, non-empty sets
Additional Info: https://en.wikipedia.org/wiki/Jaccard_index
func (*StringBuilder) JaroSimilarity ¶
func (sb *StringBuilder) JaroSimilarity(other string) *StringBuilder
JaroSimilarity computes the Jaro score between the StringBuilder's value and the provided string. It adds the result to the ComparisonManager and returns the updated StringBuilder instance.
The higher the value, the more similar the strings are. The score is normalized such that 0 equates to no similarities and 1 is an exact match
Additional Info: https://rosettacode.org/wiki/Jaro_similarity
func (*StringBuilder) JaroWinklerSimilarity ¶
func (sb *StringBuilder) JaroWinklerSimilarity(other string) *StringBuilder
JaroWinklerSimilarity calculates the Jaro-Winkler score between the StringBuilder value and another string. It adds the result to the ComparisonManager if no internal error is present. Returns the updated StringBuilder instance.
Uses Jaro score with a more favorable weighting for similar common prefixes.
Additional Info: https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance#Jaro%E2%80%93Winkler_similarity
func (*StringBuilder) LCS ¶
func (sb *StringBuilder) LCS(other string) *StringBuilder
LCS computes the longest common subsequence (LCS) between the current string and the provided string. It updates the comparison manager with the result of the LCS computation and returns the updated StringBuilder. If an error exists in the StringBuilder, it returns itself without performing computations.
func (*StringBuilder) LCSBacktrack ¶
func (sb *StringBuilder) LCSBacktrack(other string) *StringBuilder
LCSBacktrack computes the longest common subsequence (LCS) between the StringBuilder's value and another string. It updates the StringBuilder's ComparisonManager with the LCS result and handles potential errors during computation. Returns the updated StringBuilder instance.
func (*StringBuilder) LCSBacktrackAll ¶
func (sb *StringBuilder) LCSBacktrackAll(other string) *StringBuilder
LCSBacktrackAll computes all longest common subsequences between the StringBuilder's value and another string. It updates the ComparisonManager with the computed LCS result. If an error occurs during computation, it propagates the error state to the StringBuilder.
func (*StringBuilder) LCSDiff ¶
func (sb *StringBuilder) LCSDiff(other string) *StringBuilder
LCSDiff computes the Longest Common Subsequence (LCS) difference between the current StringBuilder value and another string. It updates the comparison manager with the LCS result and returns the updated StringBuilder instance. If an error occurs during the computation, it sets the error on the StringBuilder instance.
func (*StringBuilder) LCSEditDistance ¶
func (sb *StringBuilder) LCSEditDistance(other string) *StringBuilder
LCSEditDistance calculates the edit distance based on the Longest Common Subsequence (LCS) between two strings. It updates the ComparisonManager of the StringBuilder instance with the result and returns the StringBuilder.
func (*StringBuilder) LevenshteinDistance ¶
func (sb *StringBuilder) LevenshteinDistance(other string) *StringBuilder
LevenshteinDistance calculates the Levenshtein distance between the current string and another string. It tracks and stores the result using a ComparisonManager. Returns the StringBuilder instance, enabling method chaining.
func (*StringBuilder) NormalizeDiacritics ¶
func (sb *StringBuilder) NormalizeDiacritics() *StringBuilder
NormalizeDiacritics removes diacritical marks from the string and replaces them with their non-accented counterparts.
func (*StringBuilder) NormalizeUnicode ¶
func (sb *StringBuilder) NormalizeUnicode(form NormalizationFormat) *StringBuilder
NormalizeUnicode normalizes the StringBuilder's string to the specified Unicode normalization form (NFC, NFD, NFKC, or NFKD).
func (*StringBuilder) NormalizeWhitespace ¶
func (sb *StringBuilder) NormalizeWhitespace(whitespace rune) *StringBuilder
NormalizeWhitespace collapses consecutive whitespace characters into a single space and trims leading and trailing spaces.
func (*StringBuilder) NormalizeWhitespaceWithIgnore ¶
func (sb *StringBuilder) NormalizeWhitespaceWithIgnore(whitespace rune, ignoreChars string) *StringBuilder
NormalizeWhitespaceWithIgnore replaces whitespace characters in the StringBuilder's value with a specified rune, except those present in the ignoreChars. Returns the updated StringBuilder.
func (*StringBuilder) OSADamerauLevenshteinDistance ¶
func (sb *StringBuilder) OSADamerauLevenshteinDistance(other string) *StringBuilder
OSADamerauLevenshteinDistance calculates the edit distance between the StringBuilder's current value and another string. It uses the optimal string alignment Damerau-Levenshtein distance algorithm and stores the result in the ComparisonManager. Returns the StringBuilder instance for chaining or error handling if an error exists in the current object.
func (*StringBuilder) Prepend ¶
func (sb *StringBuilder) Prepend(s string, ser string) *StringBuilder
Prepend adds the specified string and separator to the beginning of the StringBuilder's value.
Example ¶
New("ENV_VAR").Prepend("APP", "_").Print()
Output: APP_ENV_VAR
func (*StringBuilder) Print ¶
func (sb *StringBuilder) Print() *StringBuilder
Print outputs the value stored in the StringBuilder if no error exists and returns the StringBuilder itself.
Example ¶
New("Hello World!").Print()
Output: Hello World!
func (*StringBuilder) QgramDistance ¶
func (sb *StringBuilder) QgramDistance(other string, q int) *StringBuilder
QgramDistance calculates the Q-Gram distance between the current string and another string using a specified q value. Stores the result in the ComparisonManager for further access or management. Returns the updated StringBuilder instance.
func (*StringBuilder) QgramDistanceCustomNgram ¶
func (sb *StringBuilder) QgramDistanceCustomNgram(nmapOther map[string]int, customName string) *StringBuilder
QgramDistanceCustomNgram computes the Q-gram distance between the current StringBuilder's n-grams and a given n-gram map. It uses a custom comparison name, storing the result in the ComparisonManager if applicable, and returns the StringBuilder.
func (*StringBuilder) QgramSimilarity ¶
func (sb *StringBuilder) QgramSimilarity(other string, q int) *StringBuilder
QgramSimilarity calculates the q-gram score between the builder's string and the given string using a specified q size. It updates the comparison data with the calculated score and returns the StringBuilder instance.
func (*StringBuilder) RemoveANSIEscapeCodes ¶
func (sb *StringBuilder) RemoveANSIEscapeCodes() *StringBuilder
RemoveANSIEscapeCodes removes ANSI escape codes from the string stored in the StringBuilder and updates its value.
func (*StringBuilder) RemoveHTML ¶
func (sb *StringBuilder) RemoveHTML(preserveSpace bool) *StringBuilder
RemoveHTML removes all HTML tags from the StringBuilder's value and returns the updated StringBuilder.
func (*StringBuilder) RemoveNonAlpha ¶
func (sb *StringBuilder) RemoveNonAlpha(ws bool) *StringBuilder
RemoveNonAlpha removes all non-alphabetic characters from the StringBuilder's value, optionally retaining whitespace if ws is true.
func (*StringBuilder) RemoveNonAlphaNumeric ¶
func (sb *StringBuilder) RemoveNonAlphaNumeric(ws bool) *StringBuilder
RemoveNonAlphaNumeric removes all non-alphanumeric characters from the StringBuilder's value, optionally preserving whitespace.
func (*StringBuilder) RemoveNonPrintable ¶
func (sb *StringBuilder) RemoveNonPrintable() *StringBuilder
RemoveNonPrintable removes non-printable characters from the StringBuilder's value and replaces them with '_'. Returns the modified StringBuilder instance.
func (*StringBuilder) RemovePrefix ¶ added in v0.3.0
func (sb *StringBuilder) RemovePrefix(prefix string) *StringBuilder
RemovePrefix removes the specified prefix from the StringBuilder's value if it exists and returns the updated StringBuilder.
func (*StringBuilder) RemovePrefixWithResult ¶ added in v0.3.0
func (sb *StringBuilder) RemovePrefixWithResult(prefix string) (*StringBuilder, bool)
RemovePrefixWithResult removes the specified prefix from the StringBuilder's value and returns the modified instance and a boolean indicating whether the prefix was found and removed.
func (*StringBuilder) RemoveSuffix ¶ added in v0.3.0
func (sb *StringBuilder) RemoveSuffix(suffix string) *StringBuilder
RemoveSuffix removes the specified suffix from the current string if it is present and returns the updated StringBuilder.
func (*StringBuilder) RemoveSuffixWithResult ¶ added in v0.3.0
func (sb *StringBuilder) RemoveSuffixWithResult(suffix string) (*StringBuilder, bool)
RemoveSuffixWithResult removes the specified suffix from the StringBuilder's value and returns the modified instance and a boolean indicating whether the suffix was found and removed.
func (*StringBuilder) RemoveWhitespace ¶
func (sb *StringBuilder) RemoveWhitespace() *StringBuilder
RemoveWhitespace removes all whitespace characters from the StringBuilder's value and returns the updated StringBuilder.
func (*StringBuilder) RemoveWhitespaceWithIgnore ¶
func (sb *StringBuilder) RemoveWhitespaceWithIgnore(charset string) *StringBuilder
RemoveWhitespaceWithIgnore removes whitespace from the StringBuilder's value except those whitespace chars specified in the provided charset.
func (*StringBuilder) ReplaceNonAlpha ¶
func (sb *StringBuilder) ReplaceNonAlpha(replacement string) *StringBuilder
ReplaceNonAlpha replaces all alphabetical characters in the StringBuilder's value with the specified replacement string.
func (*StringBuilder) ReplaceNonAlphaNumeric ¶
func (sb *StringBuilder) ReplaceNonAlphaNumeric(replacement string) *StringBuilder
ReplaceNonAlphaNumeric replaces all alphanumeric characters in the StringBuilder value with the specified replacement string.
func (*StringBuilder) ReplaceNonAlphaNumericWithIgnore ¶
func (sb *StringBuilder) ReplaceNonAlphaNumericWithIgnore(replacement string, ignoreChars string) *StringBuilder
ReplaceNonAlphaNumericWithIgnore replaces non-alphanumeric characters in the string except for those in ignoreChars. Returns the modified StringBuilder instance.
func (*StringBuilder) ReplaceNonAlphaWithIgnore ¶
func (sb *StringBuilder) ReplaceNonAlphaWithIgnore(replacement string, ignoreChars string) *StringBuilder
ReplaceNonAlphaWithIgnore replaces non-alphabetic characters in the current string with a replacement, excluding ignoreChars. It returns the updated StringBuilder after modification. The operation is skipped if processing is disabled for the StringBuilder.
func (*StringBuilder) ReplaceSpaces ¶
func (sb *StringBuilder) ReplaceSpaces(replacement string) *StringBuilder
ReplaceSpaces replaces all spaces in the StringBuilder's value with the specified replacement string.
func (*StringBuilder) ReplaceWhitespace ¶
func (sb *StringBuilder) ReplaceWhitespace(replacement string) *StringBuilder
ReplaceWhitespace replaces all whitespace characters in the StringBuilder's value with the specified replacement string.
func (*StringBuilder) ReplaceWhitespaceWithIgnore ¶
func (sb *StringBuilder) ReplaceWhitespaceWithIgnore(replacement string, ignoreChars string) *StringBuilder
ReplaceWhitespaceWithIgnore replaces all whitespace in the string with the specified replacement, ignoring specified characters. It modifies the current StringBuilder's value and skips processing if shouldContinueProcessing returns false.
func (*StringBuilder) RequireAlpha ¶
func (sb *StringBuilder) RequireAlpha() *StringBuilder
RequireAlpha ensures the StringBuilder's value contains only alphabetic characters, setting an error if invalid.
func (*StringBuilder) RequireAlphaNumeric ¶
func (sb *StringBuilder) RequireAlphaNumeric() *StringBuilder
RequireAlphaNumeric ensures the StringBuilder's value contains only alphanumeric characters, setting an error if invalid.
func (*StringBuilder) RequireContains ¶ added in v0.2.0
func (sb *StringBuilder) RequireContains(substr string) *StringBuilder
RequireContains ensures that the StringBuilder's value contains the specified substring. If the substring is not found, it sets an error and halts further processing.
func (*StringBuilder) RequireContainsAll ¶ added in v0.2.0
func (sb *StringBuilder) RequireContainsAll(substrs []string) *StringBuilder
RequireContainsAll ensures the StringBuilder's value contains all provided substrings; sets an error if not.
func (*StringBuilder) RequireContainsAllIgnoreCase ¶ added in v0.2.0
func (sb *StringBuilder) RequireContainsAllIgnoreCase(substrs []string) *StringBuilder
RequireContainsAllIgnoreCase checks if all substrings in the slice exist in the current value, ignoring case sensitivity. Returns the StringBuilder instance with an error set if any substring is missing.
func (*StringBuilder) RequireContainsAny ¶ added in v0.2.0
func (sb *StringBuilder) RequireContainsAny(substrs []string) *StringBuilder
RequireContainsAny ensures the string contains at least one of the specified substrings, else sets an error.
func (*StringBuilder) RequireContainsAnyIgnoreCase ¶ added in v0.2.0
func (sb *StringBuilder) RequireContainsAnyIgnoreCase(substrs []string) *StringBuilder
RequireContainsAnyIgnoreCase ensures the string contains at least one of the specified substrings, disregarding case. If none of the substrings are found, it sets an error and halts further processing. Returns the updated StringBuilder instance.
func (*StringBuilder) RequireContainsIgnoreCase ¶ added in v0.2.0
func (sb *StringBuilder) RequireContainsIgnoreCase(substr string) *StringBuilder
RequireContainsIgnoreCase verifies that the StringBuilder's value contains the given substring, ignoring case. Returns the StringBuilder itself, or sets an error if the substring is not found.
func (*StringBuilder) RequireDomain ¶
func (sb *StringBuilder) RequireDomain() *StringBuilder
RequireDomain ensures that the value of the StringBuilder is a valid domain, setting an error if validation fails.
func (*StringBuilder) RequireEmail ¶
func (sb *StringBuilder) RequireEmail() *StringBuilder
RequireEmail validates if the StringBuilder's value is a valid email format, sets an error if invalid, and returns the instance.
func (*StringBuilder) RequireHasPrefix ¶ added in v0.2.0
func (sb *StringBuilder) RequireHasPrefix(prefix string) *StringBuilder
RequireHasPrefix ensures the builder's string value has the specified prefix or sets an error if the prefix is missing.
func (*StringBuilder) RequireHasSuffix ¶ added in v0.2.0
func (sb *StringBuilder) RequireHasSuffix(suffix string) *StringBuilder
RequireHasSuffix ensures the StringBuilder's value ends with the specified suffix, setting an error if not.
func (*StringBuilder) RequireLength ¶
func (sb *StringBuilder) RequireLength(min, max int) *StringBuilder
RequireLength validates that the StringBuilder's value length is within the specified min and max range. Sets an error if invalid.
func (*StringBuilder) RequireNormalizedUnicode ¶
func (sb *StringBuilder) RequireNormalizedUnicode(format NormalizationFormat) *StringBuilder
RequireNormalizedUnicode ensures the string is normalized according to the specified Unicode normalization format. If not, it sets an error state in the StringBuilder and returns itself for chaining.
func (*StringBuilder) RequireNotEmpty ¶
func (sb *StringBuilder) RequireNotEmpty() *StringBuilder
RequireNotEmpty ensures the StringBuilder's value is not empty, sets an error if it is, and returns the instance.
func (*StringBuilder) RequireNotEmptyNormalized ¶
func (sb *StringBuilder) RequireNotEmptyNormalized() *StringBuilder
RequireNotEmptyNormalized ensures the StringBuilder's value is not empty after normalizing whitespace, setting an error otherwise.
func (*StringBuilder) RequireURL ¶
func (sb *StringBuilder) RequireURL() *StringBuilder
RequireURL validates if the StringBuilder's value is a properly formatted URL, sets an error if invalid, and returns the instance.
func (*StringBuilder) RequireUUID ¶
func (sb *StringBuilder) RequireUUID() *StringBuilder
RequireUUID validates whether the StringBuilder's value conforms to a valid UUID format, sets an error if invalid, and returns the instance.
func (*StringBuilder) Result ¶
func (sb *StringBuilder) Result() (string, error)
Result returns the current value of the StringBuilder along with any associated error.
func (*StringBuilder) RevertToIndex ¶
func (sb *StringBuilder) RevertToIndex(index int) *StringBuilder
RevertToIndex reverts the StringBuilder's value to the state stored at the specified history index. Returns an error if the index is invalid or if the history is not initialized. Sets an error in the StringBuilder if issues occur during the operation. Invalid indexes will result in a fatal error
func (*StringBuilder) RevertToOriginal ¶
func (sb *StringBuilder) RevertToOriginal() *StringBuilder
RevertToOriginal restores the StringBuilder value to its initial state based on its history or sets an error if unresolved.
func (*StringBuilder) RevertToPrevious ¶
func (sb *StringBuilder) RevertToPrevious() *StringBuilder
RevertToPrevious restores the StringBuilder's value to the previous entry in history or sets an error if unavailable.
func (*StringBuilder) RevertWithFunction ¶
func (sb *StringBuilder) RevertWithFunction(fn func(history *StringHistory) int) *StringBuilder
RevertWithFunction reverts the StringBuilder to a specific state based on the index returned by the provided function. The function receives the current StringBuilder instance and must return an index to revert to. If history is not initialized, it sets an error indicating the issue and takes no action. Returns the modified StringBuilder instance.
func (*StringBuilder) SanitizeHTML ¶
func (sb *StringBuilder) SanitizeHTML() *StringBuilder
SanitizeHTML sanitizes the StringBuilder's value by removing potentially unsafe or harmful HTML content.
func (*StringBuilder) Shingle ¶
func (sb *StringBuilder) Shingle(k int) *StringBuilder
Shingle generates k-shingles for the current string value and stores the result using the ComparisonManager. Updates the error state if shingle generation fails. Returns the updated StringBuilder instance.
func (*StringBuilder) ShingleSlice ¶
func (sb *StringBuilder) ShingleSlice(k int) *StringBuilder
ShingleSlice processes the string to generate k-length shingles, manages errors, and updates the ComparisonManager.
func (*StringBuilder) Similarity ¶
func (sb *StringBuilder) Similarity(other string, algorithm Algorithm) *StringBuilder
Similarity computes the score between the current string and another string using the specified algorithm. Updates the ComparisonManager with the resulting score data and maintains the chainable state of StringBuilder. If an error occurs during computation, it sets the error state in the StringBuilder and returns itself.
func (*StringBuilder) Slugify ¶
func (sb *StringBuilder) Slugify(length int) *StringBuilder
Slugify converts the string into a URL-friendly slug with a maximum length specified by the parameter.
Example ¶
New("The Life and Strange Surprising Adventures of Robinson Crusoe, Of York, Mariner").
Slugify(50).
Print()
Output: the-life-and-strange-surprising-adventures-of-robi
func (*StringBuilder) SorensenDiceCoefficient ¶
func (sb *StringBuilder) SorensenDiceCoefficient(other string, splitLength int) *StringBuilder
SorensenDiceCoefficient computes the Sørensen–Dice coefficient for two strings using a given n-gram split length. Returns a pointer to the coefficient value or nil if the splitLength is negative.
The Sørensen index equals twice the number of elements common to both sets divided by the sum of the number of elements in each set.
Additional Info: https://en.wikipedia.org/wiki/Dice-S%C3%B8rensen_coefficient
func (*StringBuilder) SplitCamelCase ¶
func (sb *StringBuilder) SplitCamelCase() *StringBuilder
SplitCamelCase splits the string stored in the StringBuilder into separate words based on camel case boundaries.
func (*StringBuilder) SplitPascalCase ¶
func (sb *StringBuilder) SplitPascalCase() *StringBuilder
SplitPascalCase splits a PascalCase string into separate words, modifying the StringBuilder's value in-place.
func (*StringBuilder) String ¶
func (sb *StringBuilder) String() string
String returns the current string value of the StringBuilder instance.
func (*StringBuilder) ToCamelCase ¶
func (sb *StringBuilder) ToCamelCase() *StringBuilder
ToCamelCase converts the current string value to camel case format and updates the StringBuilder instance.
func (*StringBuilder) ToDelimited ¶
func (sb *StringBuilder) ToDelimited(delim uint8, ignore string, scream bool) *StringBuilder
ToDelimited converts the string in the StringBuilder to a delimited format using the specified delimiter and options.
func (*StringBuilder) ToKebabCase ¶
func (sb *StringBuilder) ToKebabCase(scream bool) *StringBuilder
ToKebabCase converts the string in the StringBuilder to kebab-case or screaming-kebab-case based on the scream flag.
func (*StringBuilder) ToLower ¶
func (sb *StringBuilder) ToLower() *StringBuilder
ToLower converts all characters in the StringBuilder's value to lowercase and returns the updated StringBuilder.
func (*StringBuilder) ToPascalCase ¶
func (sb *StringBuilder) ToPascalCase() *StringBuilder
ToPascalCase converts the current string value of the StringBuilder to PascalCase format and updates the StringBuilder.
func (*StringBuilder) ToSnakeCase ¶
func (sb *StringBuilder) ToSnakeCase(scream bool) *StringBuilder
ToSnakeCase converts the current string to snake_case or SCREAMING_SNAKE_CASE based on the scream parameter.
func (*StringBuilder) ToSnakeCaseWithIgnore ¶
func (sb *StringBuilder) ToSnakeCaseWithIgnore(scream bool, ignore string) *StringBuilder
ToSnakeCaseWithIgnore converts the StringBuilder's value to snake_case, optionally in uppercase, ignoring specified characters.
func (*StringBuilder) ToTitleCase ¶
func (sb *StringBuilder) ToTitleCase() *StringBuilder
ToTitleCase converts the string value of the StringBuilder to title case and returns the updated StringBuilder instance.
func (*StringBuilder) ToUpper ¶
func (sb *StringBuilder) ToUpper() *StringBuilder
ToUpper converts the StringBuilder's current value to uppercase and returns the updated StringBuilder.
func (*StringBuilder) Transform ¶
func (sb *StringBuilder) Transform(fn func(string) string) *StringBuilder
Transform applies a custom transformation function to the StringBuilder's value and returns the updated instance.
Examples:
s := New("Hello World!").Transform(strings.ToUpper)
result: "HELLO WORLD!"
s := New("Hello World!).Transform(func(input string) string {
return input + " Goodbye!"
})
result: "Hello World! Goodbye!"
func (*StringBuilder) Trim ¶
func (sb *StringBuilder) Trim() *StringBuilder
Trim removes leading and trailing whitespace or specific characters from the StringBuilder's value.
func (*StringBuilder) TrimChars ¶
func (sb *StringBuilder) TrimChars(chars string) *StringBuilder
TrimChars removes all leading and trailing characters specified in the input string from the StringBuilder's value.
func (*StringBuilder) TrimCharsLeft ¶
func (sb *StringBuilder) TrimCharsLeft(chars string) *StringBuilder
TrimCharsLeft removes all leading occurrences of the specified characters from the string and returns the updated StringBuilder.
func (*StringBuilder) TrimCharsRight ¶
func (sb *StringBuilder) TrimCharsRight(chars string) *StringBuilder
TrimCharsRight removes all occurrences of the specified characters from the end of the string and returns the StringBuilder.
func (*StringBuilder) TrimLeft ¶
func (sb *StringBuilder) TrimLeft() *StringBuilder
TrimLeft removes all leading whitespace characters from the string stored in the StringBuilder and updates its value.
func (*StringBuilder) TrimRight ¶
func (sb *StringBuilder) TrimRight() *StringBuilder
TrimRight removes trailing whitespace or specified characters from the end of the StringBuilder's value.
func (*StringBuilder) Truncate ¶
func (sb *StringBuilder) Truncate(length int, suffix string) *StringBuilder
Truncate shortens the string to the specified length and appends the provided suffix if truncation occurs.
func (*StringBuilder) Uncapitalize ¶
func (sb *StringBuilder) Uncapitalize() *StringBuilder
Uncapitalize converts the first character of the StringBuilder's value to lowercase if no error is present.
func (*StringBuilder) WithComparisonManager ¶
func (sb *StringBuilder) WithComparisonManager() *StringBuilder
WithComparisonManager initializes a new ComparisonManager if it doesn't already exist and assigns it to the builder.
func (*StringBuilder) WithHistory ¶
func (sb *StringBuilder) WithHistory(limit int) *StringBuilder
WithHistory initializes the history for the StringBuilder if it does not already exist and returns the instance.
type StringHistory ¶
type StringHistory struct {
// contains filtered or unexported fields
}
StringHistory represents a collection of string values used to track the history of
func NewStringHistory ¶
func NewStringHistory(limit int) *StringHistory
NewStringHistory creates and returns a new, empty StringHistory instance.
func (*StringHistory) Add ¶
func (sh *StringHistory) Add(s string)
Add appends a string value to the StringHistory collection, updating the history with the provided string.
func (*StringHistory) GetByIndex ¶
func (sh *StringHistory) GetByIndex(index int) (string, error)
GetByIndex retrieves the string at the specified index from the StringHistory collection. Returns an error if the index is out of bounds.
func (*StringHistory) GetPreviousValue ¶
func (sh *StringHistory) GetPreviousValue() (string, error)
GetPreviousValue returns the second-to-last string value from the StringHistory collection.
func (*StringHistory) Len ¶
func (sh *StringHistory) Len() int
Len returns the number of items in the StringHistory collection.
func (*StringHistory) Print ¶
func (sh *StringHistory) Print(verbose bool)
Print outputs the string history in either verbose or concise format based on the verbose parameter.
Source Files
¶
- builder.go
- casing.go
- casing_builder.go
- casing_helpers.go
- character_set.go
- comparison.go
- comparison_builder.go
- comparison_helpers.go
- comparison_manager.go
- comparison_result.go
- comparison_results_map.go
- generation.go
- generation_builder.go
- generation_helpers.go
- history.go
- lcs_result.go
- lcs_results_map.go
- lorem.go
- lorem_builder.go
- lorem_helpers.go
- normalization_format.go
- regexp_helpers.go
- rune_sets.go
- sanitization.go
- sanitization_builder.go
- sanitization_helpers.go
- shingle_result.go
- shingle_results_map.go
- similarity_result.go
- similarity_results_map.go
- strutil.go
- transform.go
- transform_builder.go
- transform_helpers.go
- validation.go
- validation_builder.go
- validation_helpers.go