How to Parse an Unstructured Text String into an Address in Node.JS
When receiving large amounts of text from multiple sources such as emails, SMS, or other documents, finding specific information, such as addresses, can be time consuming and prone to mistakes. The following Cloudmersive API, however, will perform this task for you in Node.JS by parsing unstructured text strings and returning address information.
To make use of this API, our first step is to install the client software:
npm install cloudmersive-validate-api-client --save
You can also add this snippet to your package.json:
"dependencies": {
"cloudmersive-validate-api-client": "^1.2.4"
}
Next, you can call our function, AddressParseString:
var CloudmersiveValidateApiClient = require('cloudmersive-validate-api-client');
var defaultClient = CloudmersiveValidateApiClient.ApiClient.instance;// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';var apiInstance = new CloudmersiveValidateApiClient.AddressApi();var input = new CloudmersiveValidateApiClient.ParseAddressRequest(); // ParseAddressRequest | Input parse requestvar callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.addressParseString(input, callback);
With this API, you can parse mass amounts of input instantly to retrieve exactly the address information you need. You can retrieve your personal API Key from the Cloudmersive website; this gives you access to up to 800 calls over our entire API library.