String sequence similarity / difference ratio in javascript and python
<p>Say I had a reference string</p>

<p>"abcdabcd"</p>

<p>and a target string</p>

<p>"abcdabEd"</p>

<p>Is there a simple way in javascript and python to get the string sequence similarity ratio?</p>

<p>Example:</p>

<p>"abcdabcd" differs from "abcdabEd" by the character "E" so the ratio of similarity is high but less than 1.0</p>

<p>"bcdabcda" differs from "abcdabEd" greatly because every character at a specific string index is different so the similarity ratio is 0.0</p>

<p>note that the similarity ratio is not how many similar characters are in each string but how similar the sequences are from each other</p>

<p>therefore code like </p>

<pre><code># python - incorrect for this problem 
difflib.SequenceMatcher(None, "bcdabcda", "abcdabEd").ratio()
</code></pre>

<p>would be wrong</p>
