Fuzzy Matching
This page describes the parameters for the Fuzzy Matching method as part of AI libs.
.ai.fuzzy.dist
The .ai.fuzzy.dist
function calculates the fuzzy distance between parameters.
Parameters
Name |
Type(s) |
Description |
---|---|---|
|
string | string[] | enum |
The strings to search against |
|
string | string[] |
The query string(s) |
|
symbol |
The distance type, one of |
Returns
Type |
Description |
---|---|
float |
The fuzzy distance between x and y |
Example
q
genString:{[length] length?.Q.an," "};
batch:genString each 5 + 10?10;
q:genString[5 + rand[10]];
.ai.fuzzy.dist[batch;q;`levenshtein];
14 12 12 14 13 14 14 14 14 13f
.ai.fuzzy.search
The .ai.fuzzy.search
function returns k
best matches for q from data.
Parameters
Name |
Type(s) |
Description |
---|---|---|
|
string[] | symbol[] |
The list of strings/symbols to search from |
|
string | string[] | symbol | symbol[] |
The pattern to search for |
|
int | long |
The number of best matches to return |
|
symbol |
The distance type, one of |
Returns
Type |
Description |
---|---|
(float[]; int[]; (char | string | symbol)[]) |
A list of triples containing distance, index and match value |
Example
q
genString:{[length] length?.Q.an," "};
batch:genString each 5 + 10?10;
q:genString[5 + rand[10]];
.ai.fuzzy.search[batch;q;3;`levenshtein];
12 12 13
2 1 4
"6SmcKLSCuEI9n8" "ynEr5x" "TtNEiYH_c"