I have a list of 500,000 accounts each with an address.
What I need to do is clean up the addresses so I can find out which accounts falls in the same address. I understand there are going to be some errors but I would need to do the best I can.
Is there a service I can use where it can validate the address or it would format the address to a standard format?
for example
RD->ROAD
ST->Street
STE->SUITE
.....
....
I don't know all the combinations. Is there a script that I can run that will update the addresses?
I know I can use MySQL REPLACE()
function to replace RD with ROAD but what if the steet name itself contact the words 'RD' that will cause an issue? if I was to do a replace it would have to be a word replace not a standard string replace.
I could write a PHP script that will update the addresses (something like below) but I would need to know all possible combinations.
What is the best approach for this problem? How can I find out all/most the combinations that I would have to check for?
<?php
$arr = explode(" ", $row['address']);
$clean = array();
foreach($arr AS $key=>$val){
if($val == 'RD')
$new = 'ROAD';
else if ($val == 'STE')
$new = 'SUITE';
else
$new = $val;
$clean[] = $new;
}
?>