STRALGO

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Measure how similar two strings are

This command is useful for measuring how similar two strings are. Strings can represent many things. If the two strings are DNA sequences, LCS is a measure of similarity between those sequences. If the strings are edited text, LCS can show how the new text differs from the old text.
The only algorithm currently implemented is LCS (Longest Common Subsequence).

Example

Command>stralgo lcs strings ohmytext mynewtext
Result>"mytext"
Command>stralgo lcs keys key1 key2
Result>"mytext"
Command>stralgo lcs keys key1 key2 len
Result>6
Command>stralgo lcs keys key1 key2 idx
Result>1) "matches"
2) 1) 1) 1) (integer) 4
             2) (integer) 7
         2) 1) (integer) 5
             2) (integer) 8
    2) 1) 1) (integer) 2
             2) (integer) 3
         2) 1) (integer) 0
             2) (integer) 1
3) "len"
4) (integer) 6

Example

Command>stralgo lcs keys key1 key2 idx minmatchlen 4
Result>1) "matches"
2) 1) 1) 1) (integer) 4
             2) (integer) 7
         2) 1) (integer) 5
             2) (integer) 8
3) "len"
4) (integer) 6
Command>stralgo lcs keys key1 key2 idx minmatchlen 4 withmatchlen
Result>1) "matches"
2) 1) 1) 1) (integer) 4
             2) (integer) 7
         2) 1) (integer) 5
             2) (integer) 8
         3) (integer) 4
3) "len"
4) (integer) 6


Syntax

STRALGO LCS [STRINGS ...] [KEYS ...] [LEN] [IDX] [MINMATCHLEN <len>] [WITHMATCHLEN]


<< GETRANGE STRALGO GETSET >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.