Skip to content

tuple_str_distanceTupleStrDistanceTupleStrDistancetuple_str_distancetuple_str_distance🔗

Short description🔗

tuple_str_distanceTupleStrDistanceTupleStrDistancetuple_str_distancetuple_str_distance — Calculate the distance between strings.

Signature🔗

tuple_str_distance( string String1, string String2, string Mode, out integer Distance )void TupleStrDistance( const HTuple& String1, const HTuple& String2, const HTuple& Mode, HTuple* Distance )static void HOperatorSet.TupleStrDistance( HTuple string1, HTuple string2, HTuple mode, out HTuple distance )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 ) -> intHerror 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 )

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

HTuple HTuple.TupleStrDistance( HTuple string2, HTuple mode )

Description🔗

tuple_str_distanceTupleStrDistance computes the edit distance between String1string1string_1 and String2string2string_2 and returns the result in Distancedistancedistance. The distance measure used is specified in Modemodemode. Both input tuples may only consist of strings. Otherwise, tuple_str_distanceTupleStrDistance returns an error. As an exception, an empty tuple in String1string1string_1 or String2string2string_2 cause Distancedistancedistance to also be empty.

Parameter Broadcasting🔗

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

Supported distance measures🔗

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

HDevelop In-line Operation🔗

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

Result := str_distance(String1, String2, Mode)

Execution information🔗

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🔗

String1string1string_1 (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Input tuple.

Default: 'String1'"String1"

String2string2string_2 (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Input tuple.

Default: 'String2'"String2"

Modemodemode (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Distance measure.

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

Distancedistancedistance (output_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Element-wise string distance.

Combinations with other operators🔗

Combinations

Possible predecessors

get_text_resultGetTextResult, find_textFindText, do_ocr_word_mlpDoOcrWordMlp

Alternatives

suggest_lexiconSuggestLexicon

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