Operator Reference

tuple_str_distancetuple_str_distanceTupleStrDistanceTupleStrDistancetuple_str_distance (Operator)

tuple_str_distancetuple_str_distanceTupleStrDistanceTupleStrDistancetuple_str_distance — Calculate the distance between strings.

Signature

tuple_str_distance( : : String1, String2, Mode : Distance)

Herror tuple_str_distance(const char* String1, const char* String2, const char* Mode, Hlong* Distance)

Herror T_tuple_str_distance(const Htuple String1, const Htuple String2, const Htuple Mode, Htuple* Distance)

void TupleStrDistance(const HTuple& String1, const HTuple& String2, const HTuple& Mode, HTuple* Distance)

HTuple HTuple::TupleStrDistance(const HTuple& String2, const HTuple& Mode) const

static void HOperatorSet.TupleStrDistance(HTuple string1, HTuple string2, HTuple mode, out HTuple distance)

HTuple HTuple.TupleStrDistance(HTuple string2, HTuple mode)

def tuple_str_distance(string_1: MaybeSequence[str], string_2: MaybeSequence[str], mode: str) -> Sequence[int]

def tuple_str_distance_s(string_1: MaybeSequence[str], string_2: MaybeSequence[str], mode: str) -> int

Description

tuple_str_distancetuple_str_distanceTupleStrDistanceTupleStrDistancetuple_str_distance computes the edit distance between String1String1String1string1string_1 and String2String2String2string2string_2 and returns the result in DistanceDistanceDistancedistancedistance. The distance measure used is specified in ModeModeModemodemode. Both input tuples may only consist of strings. Otherwise, tuple_str_distancetuple_str_distanceTupleStrDistanceTupleStrDistancetuple_str_distance returns an error. As an exception, an empty tuple in String1String1String1string1string_1 or String2String2String2string2string_2 cause DistanceDistanceDistancedistancedistance to also be empty.

Parameter Broadcasting

This operator supports parameter broadcasting. This means that each of the input tuples String1String1String1string1string_1 and String2String2String2string2string_2 can be given as a tuple of length 1 or 'N'"N""N""N""N". Parameters with tuple length 1 will be repeated internally such that the number of computed distances is always 'N'"N""N""N""N".

Supported distance measures

  • 'levenshtein'"levenshtein""levenshtein""levenshtein""levenshtein": Uses the Levenshtein distance to quantify string distances. The Levenshtein distance is the minimum number of edit operations required to transform String1String1String1string1string_1 into String2String2String2string2string_2. Valid edit operations are insertion, deletion and replacement of characters.

HDevelop In-line Operation

HDevelop provides an in-line operation for tuple_str_distancetuple_str_distanceTupleStrDistanceTupleStrDistancetuple_str_distance, which can be used in an expression in the following syntax:

Result := str_distance(String1, String2, Mode)

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

String1String1String1string1string_1 (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Input tuple.

Default: 'String1' "String1" "String1" "String1" "String1"

String2String2String2string2string_2 (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Input tuple.

Default: 'String2' "String2" "String2" "String2" "String2"

ModeModeModemodemode (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Distance measure.

Default: 'levenshtein' "levenshtein" "levenshtein" "levenshtein" "levenshtein"

List of values: 'levenshtein'"levenshtein""levenshtein""levenshtein""levenshtein"

DistanceDistanceDistancedistancedistance (output_control)  integer(-array) HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Element-wise string distance.

Possible Predecessors

get_text_resultget_text_resultGetTextResultGetTextResultget_text_result, find_textfind_textFindTextFindTextfind_text, do_ocr_word_mlpdo_ocr_word_mlpDoOcrWordMlpDoOcrWordMlpdo_ocr_word_mlp

Alternatives

suggest_lexiconsuggest_lexiconSuggestLexiconSuggestLexiconsuggest_lexicon

References

Vladimir I. Levenshtein, Binary codes capable of correcting deletions, insertions, and reversals, Doklady Akademii Nauk SSSR, 163(4):845-848, 1965 (Russian). English translation in Soviet Physics Doklady, 10(8):707-710, 1966.

Module

Foundation