FuzzyString
Static Public Member Functions | List of all members
UFuzzyStringLibrary Class Reference

Blueprint Function Library to calculate the approximate (or "fuzzy") similarity between strings. More...

#include <FuzzyStringLibrary.h>

Inherits UBlueprintFunctionLibrary.

Static Public Member Functions

static void CalcFuzzyStringSimilarity (const FString &A, const FString &B, float &Similarity, const EStringSimilarityMethods SimilarityMethod=EStringSimilarityMethods::WeightedRatio, bool bIgnoreCase=true, bool bNormalizeWhitespace=true)
 Calculate the fuzzy string similarity with one of the specified methods. More...
 
static void RetrieveMostSimilarString (const FString &Query, const TArray< FString > &Strings, FString &BestMatch, float &Similarity, const EStringSimilarityMethods SimilarityMethod=EStringSimilarityMethods::WeightedRatio, bool bIgnoreCase=true, bool bNormalizeWhitespace=true)
 Retrieve the most similar string from an array of strings. More...
 
static void RetrieveSortedSimilarStrings (const FString &Query, const TArray< FString > &Strings, TArray< FStringSimiliarity > &SortedMatches, const EStringSimilarityMethods SimilarityMethod=EStringSimilarityMethods::WeightedRatio, bool bIgnoreCase=true, bool bNormalizeWhitespace=true)
 Sort all strings in an array by their similarity to the query string. More...
 

Detailed Description

Blueprint Function Library to calculate the approximate (or "fuzzy") similarity between strings.

Member Function Documentation

◆ CalcFuzzyStringSimilarity()

void UFuzzyStringLibrary::CalcFuzzyStringSimilarity ( const FString &  A,
const FString &  B,
float &  Similarity,
const EStringSimilarityMethods  SimilarityMethod = EStringSimilarityMethods::WeightedRatio,
bool  bIgnoreCase = true,
bool  bNormalizeWhitespace = true 
)
static

Calculate the fuzzy string similarity with one of the specified methods.

Parameters
AString A
BString B to compare against A
SimilarityScore btween 0 and 100
SimilarityMethodMethod to calculate the similarity, see enum description.
bIgnoreCaseIgnore upper / lower case differences, e.g. "A" = "a". Default is true.
bNormalizeWhitespaceTreat all consecutive whitespace as a single space, e.g. "A b" = "A b". Default is true.

◆ RetrieveMostSimilarString()

void UFuzzyStringLibrary::RetrieveMostSimilarString ( const FString &  Query,
const TArray< FString > &  Strings,
FString &  BestMatch,
float &  Similarity,
const EStringSimilarityMethods  SimilarityMethod = EStringSimilarityMethods::WeightedRatio,
bool  bIgnoreCase = true,
bool  bNormalizeWhitespace = true 
)
static

Retrieve the most similar string from an array of strings.

Parameters
QueryThe string to look for
StringsAll the string to compare query against
BestMatchMost similar string to query from the Strings array
SimilaritySimilarity Score from 0 to 100 for the best match
SimilarityMethodThe similarity method to use.
bIgnoreCaseIgnore upper / lower case differences, e.g. "A" = "a". Default is true.
bNormalizeWhitespaceTreat all consecutive whitespace as a single space, e.g. "A b" = "A b". Default is true.

◆ RetrieveSortedSimilarStrings()

void UFuzzyStringLibrary::RetrieveSortedSimilarStrings ( const FString &  Query,
const TArray< FString > &  Strings,
TArray< FStringSimiliarity > &  SortedMatches,
const EStringSimilarityMethods  SimilarityMethod = EStringSimilarityMethods::WeightedRatio,
bool  bIgnoreCase = true,
bool  bNormalizeWhitespace = true 
)
static

Sort all strings in an array by their similarity to the query string.

Parameters
Querythe string to look for
StringsAll the string to compare query against
SortedMatchesarray of structs: string/similarity
SimilarityMethodThe similarity method to use.
bIgnoreCaseIgnore upper / lower case differences, e.g. "A" = "a". Default is true.
bNormalizeWhitespaceTreat all consecutive whitespace as a single space, e.g. "A b" = "A b". Default is true.

The documentation for this class was generated from the following files: