How can i find the closest match
<p>I am matching values which is slightly different in that case how can i find the closest match</p>

<p>In this example everything has very close relationship but how can my script find a match</p>

<p>Eg script which i wrote</p>

<pre><code>a = ["12,th 3rd street","6th avenue 3r cross","6th street pan,CA","345 hoston road CA","345 hoston road CA"]
b = ["12,th 3rd st","6th av 3rd crs","6th street pan CA WY","345 hoston road, CA","345 hoston road,CA"]
for s in a:
    for v in b:
        if s == v:
            python s
</code></pre>

<p>If you see both this array only some worrs will differ</p>

<pre><code>a = ["12,th 3rd street","6th avenue 3r cross","6th street pan,CA","345 hoston road CA","345 hoston road CA"]
    b = ["12,th 3rd st","6th av 3rd crs","6th street pan CA WY","345 hoston road, CA","345 hoston road,CA"]
</code></pre>

<p>I hope you need some predefined words for matching <code>this or that</code>.</p>

<pre><code>for eg., {cross:{cr,crs}, avenue:{av,avn}}
</code></pre>

<p>you can match the some continuous strings directly </p>

<pre><code>for i in a:
    for j in b:
        if i in j or j in i:
            print (i,j)
</code></pre>

<p>This gives,</p>

<p><code>12,th 3rd street</code> <code>12,th 3rd st</code></p>

<p>to match other cases use the dictionary to select any value using key or vice versa.</p>

python algorithm data-structures string-matching