Ruby gem for text comparison -
i looking gem can compare 2 strings (in case paragraphs of text) , able gauge likelihood similar in content (with perhaps few words rearranged, changed). believe uses similar when users submit questions.
i'd use diff::lcs:
>> require "diff/lcs" >> seq1 = "lorem ipsum dolor sit amet consequtor".split(" ") >> seq2 = "lorem ipsum dolor amet sit consequtor".split(" ") 1.9.3-p194 :010 > diff::lcs.diff(seq1, seq2).length => 2 it uses longest common subsequence algorithm (the method using lcs diff described on the wiki page).
Comments
Post a Comment