loqate-verify-helmcharts

AI Parsing

Verify can use an AI address parser to improve the results for addresses that are hard to parse. The parser is built into the Spatial API, and is off by default.

How it works

When a request asks for AI parsing, Verify parses the address twice: once as normal, and once using the AI parser. It then returns whichever result scores better.

In our testing on UK addresses, AI parsing changed the result for around 8% of addresses. Results vary with the address data and the country.

An address returned by the AI parser has ai in its MatchRuleLabel, for example C1a ai.

AI parsing is not used for certified requests (CASS, SERP, AMAS). These are always parsed as normal.

Requirements

The AI data is installed by the install manager alongside the standard data, if your license includes the AI products. See the Runbook for installing data.

Supported countries

Not all countries have an AI model yet. These countries are currently supported:

Addresses in other countries are parsed as normal.

Enabling AI parsing

AI parsing must be enabled on both the Spatial API and the Query Coordinator. If it is only enabled on one, requests are parsed as normal.

Helmfile

Set the LOQATE_ALLOW_AIPARSER environment variable to true before running the helmfile. This sets app.allow_aiparser on both the spatial-api and querycoordinator releases.

Linux:

export LOQATE_ALLOW_AIPARSER=true

Windows:

$env:LOQATE_ALLOW_AIPARSER="true"

Helm

Set app.allow_aiparser to true when installing both charts:

helm install -n loqate spatial-api loqate/spatial-api --set imageCredentials.username=<DOCKERHUB USERNAME> --set imageCredentials.password=<DOCKERHUB PASSWORD> --set app.memberlistService=memberlist.loqate.svc --set app.allow_aiparser=true

helm install -n loqate querycoordinator loqate/querycoordinator --set imageCredentials.username=<DOCKERHUB USERNAME> --set imageCredentials.password=<DOCKERHUB PASSWORD> --set app.memberlistService=memberlist.loqate.svc --set app.allow_aiparser=true

Sizing

The AI parser runs its own threads, in addition to the Spatial API’s workers. When AI parsing is on, halve the Spatial API worker count (app.workerCount).

By default the worker count is the number of CPUs available to the pod. For example, for a pod with 8 CPUs, set app.workerCount to 4.

This applies to the Spatial API only. The Query Coordinator’s worker count does not need to change.

The Spatial API autoscaling uses the percentage of workers in use (ngv_sa_workers_used, see Observability), so changing the worker count also changes when scaling is triggered.

Making a request

Requests ask for AI parsing with the aiparse option. The value is the string "true", not a JSON boolean.

For example:

Request ```json { "options": { "aiparse": "true" }, "input": [ { "Address": "2 1,150 SWORD STREET,GLASGOW,GLASGOW,LANARKSHIRE,G31 1SE", "Country": "GB" } ] } ```
Response with the AI parsing option The AI parser recognises `2 1` as flat 2/1. ```json { "output": [ { "AQI": "A", "AVC": "V55-I55-P6-100", "Address": "2/1
150 Sword Street
Glasgow
G31 1SE", "MatchRuleLabel": "C1a ai", "SubBuilding": "2/1", "SubBuildingNumber": "2 1" } ] } ```
Response without the AI parsing option Without AI parsing, `2 1` is treated as a second street name. ```json { "output": [ { "AQI": "D", "AVC": "P44-I44-P6-083", "Address": "150 Sword Street
Sword Street
Glasgow
G31 1SE", "MatchRuleLabel": "C1ap", "DependentThoroughfare": "Sword Street" } ] } ```

The responses above show only some of the fields.