1
Vote

Predirectional at front of address

description

I've seen in our address database a number of addresses that have the predirectional at the front of the address line. Such as ...

E 725 Main St.

The library doesn't pick out the predirectional in this pattern.

comments

fredclown wrote Nov 19, 2013 at 12:25 AM

I added the below code to the ParseAddress method right below the line "var extracted = GetApplicableFields(match);" to match this case.
//Check if predirectional appears first in input string and add to extracted
foreach (KeyValuePair<string, string> entry in directionals)
{
    if ((input.Length >= entry.Key.Length + 1 && input.Substring(0, entry.Key.Length + 1).ToLower() == entry.Key.ToLower() + " ") || (input.Length >= entry.Value.Length + 1 && input.Substring(0, entry.Value.Length + 1).ToLower() == entry.Value.ToLower() + " "))
    {
        extracted.Add("PREDIRECTIONAL", entry.Value);
        break;
    }
}