Search code examples
rtm

function that extracts a common continuous sequence in R


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")


Solution

  • v <- c ("mom soap frame", "sweet mom", "dad, mom, me", "moment")
    
    library(PTXQC)
    LCSn(v, min_LCS_length = 0)
    
    #[1] "mom"