How to do advanced string comparison in Ruby?

后端 未结 2 1937
有刺的猬
有刺的猬 2020-12-30 17:53

I am trying to compare 2 paragraphs of strings the output of which has to be the percentage of similarity.

I have tried doing this using the diff method

相关标签:
2条回答
  • 2020-12-30 18:05

    See my similar Question here what I needed but did not know what it was called was a Levenshtein distance algorithm

    0 讨论(0)
  • 2020-12-30 18:14

    You may want to try the Levenshtein string distance algorithm for this. http://rubygems.org/gems/text has an implementation of this along with other helpful string comparison utils.

    0 讨论(0)
提交回复
热议问题