Tell me please, is there the function that extracts a common continuous sequence of characters from the symbol vector. Ie, for example, from the row vector at the input: c ("mom soap frame", "sweet mom", "dad, mom, me", "`mom`ent")
get the output vector c ("mom")
Asked
Active
Viewed 64 times
0
-
1Possible duplicate of [Find common substrings between two character variables](https://stackoverflow.com/questions/16196327/find-common-substrings-between-two-character-variables) – konvas Sep 14 '18 at 11:05
-
1@konvas: imho not really a duplicate, since here you want to look for a LCS within 1 vector, and not finding an LCS between two vectors. – Wimpel Sep 14 '18 at 11:08
1 Answers
2
v <- c ("mom soap frame", "sweet mom", "dad, mom, me", "moment")
library(PTXQC)
LCSn(v, min_LCS_length = 0)
#[1] "mom"

Wimpel
- 26,031
- 1
- 20
- 37