Deepparse : An Extendable, and Fine-Tunable State-Of-The-Art Library for Parsing Multinational Street Addresses (2023)

Abstract: Segmenting an address into meaningful components, also known as address parsing, is an essential step in many applications from record linkage to geocoding and package delivery. Consequently, a lot of work has been dedicated to develop accurate address parsing techniques, with machine learning and neural network methods leading the state-of-the-art scoreboard. However, most of the work on address parsing has been confined to academic endeavours with little availability of free and easy-to-use open-source solutions.This paper presents Deepparse, a Python open-source, extendable, fine-tunable address parsing solution under LGPL-3.0 licence to parse multinational addresses using state-of-the-art deep learning algorithms and evaluated on over 60 countries. It can parse addresses written in any language and use any address standard. The pre-trained model achieves average 99% parsing accuracies on the countries used for training with no pre-processing nor post-processing needed. Moreover, the library supports fine-tuning with new data to generate a custom address parser.

## introduction address parsing is the task of decomposing an address into its different components @xcite . this task is essential to many applications, such as geocoding and record linkage. indeed, it is quite useful to detect the different parts of an address to find a particular location based on textual data to make an informed decision. similarly, comparing two addresses to decide whether two or more database entries refer to the same entity can prove to be quite difficult and prone to errors if based on methods such as edit distance algorithms given the various address writing standards. there have been many efforts to solve the address parsing problem. from rule-based techniques @xcite to probabilistic approaches and neural network models @xcite , much progress has been made in reaching accurate addresses segmentation. these previous works did a remarkable job of finding solutions for the challenges related to the address parsing task. however, most of these approaches either do not take into account parsing addresses from different countries or do so but at the cost of a considerable amount of meta-data and substantial data pre-processing pipelines @xcite @xcite . however, most of the work on address parsing has been confined to academic endeavours with little availability of free and easy-to-use open-source solutions. in an effort to solve some of the limitations of previous methods, as well as offer an open-source address parsing solution, we have created deepparse foot_0 (yassine and beauchemin, 2020) an lgpl-3.0 licenced python library. our work allows anyone with a basic knowledge of python or command line terminal to conveniently parse addresses from multiple countries using state-ofthe-art deep learning models proposed by @xcite . deepparse's goal is to parse multinational addresses written in any language or using any address writing format with an extendable and fine-tunable address parser. in addition, deepparse proposes a functionality to easily customize the aforementioned models to new data along with an easy-to-use docker fastapi to parse addresses. this paper's contributions are: first, we describe an open-source python library for multinational address parsing. second, we describe its implementation details and natural extensibility due to its fine-tuning possibilities. third, we benchmark it against other open-source libraries. ## related work address parsing has been approached on the academic front using probabilistic machine learning models such as hidden markov models and conditional random fields (crf) @xcite @xcite , as well as deep learning models mainly based on the recurrent neural network (rnn) architecture @xcite @xcite . regarding openly available software, most of the existing packages cater to us postal addresses. for instance, pyaddress foot_1 allows for the decomposition of us addresses into eight different attributes with a possibility to specify acceptable "street names", "cities" and "street suffixes" in order to improve parsing accuracy. similarly, address-parser foot_2 identifies as "yet another python address parser for us postal addresses" and enables users to extract multiple address components such as "house numbers", "street names", "cardinal directions" and "zip codes". these two packages are based on a combination of predefined component lists and regular expressions. in contrast, usaddress foot_3 uses a probabilistic model that users can fine-tune using their data. another openly available avenue for address parsing is geocoding apis, which can result in highly precise parsed addresses based on reverse geocoding. however, while being openly available, geocoding apis are often not free and not always convenient to use for a programming layperson. the aforementioned approaches are limited to parsing addresses from a single country and either cannot handle a multinational scope of address parsing or would need to be adjusted to do so. to tackle this problem, libpostal foot_4 , a c library for international address parsing, has been proposed. this library uses a crf-based model trained with an averaged perceptron for scalability. the model was trained on libpostal dataset foot_5 and achieved a 99.45 % full parse accuracy foot_6 using an extensive pre and post-processing pipeline. however, this requires putting addresses through a heavy preprocessing pipeline before feeding them to the prediction model, and it does not seem possible to develop a new address parser based on the docu-mentation. a thorough search of the relevant literature yielded no open-source neural network-based software for multinational address parsing. ## implementation deepparse is divided into three high-level components: pre-processors, embeddings model, and tagging model. the first component, the pre-processor, is a series of simple handcrafted pre-processing functions to be applied as a data cleaning procedure before the embedding component, such as lowercasing the address text and removing commas. by default, deepparse simply lowercase and removes all commas in the address. the library does not require a complex pre-processing pipeline, but one can be defined and used more complex one if needed since deepparse is built so users can handcraft and use a custom pre-processor during this phase. the last two components are illustrated in figure 1. we can see that the embeddings model component (black) encodes each token (i.e. word) of the address into a recurrent dense representation. at the end of the sentence, the component generates a single dense representation for the overall address generated from the individual address components. then, this address-dense representation is used as input to the tagging model component (red), where each address component is decoded and classified into its appropriate tag. these two components do not rely on named entity recognition to parse addresses as opposed to the one proposed by @xcite . deepparse proposes two embeddings model approaches and four pre-trained tagging model architectures; all approaches can be used with cpu or gpu setup. all pre-trained approaches have been trained on our publicly available dataset foot_7 , based on to the libpostal dataset, and achieved parse accuracies higher than 99% on the 20 trained countries without using pre or post-processing 9 . the following sub-section will briefly discuss how these two components work. for more details on the algorithms behind both components, readers can refer to @xcite . we will finish this section with a presentation on deepparse's unique flexibility in developing a new address parser. ## practical results in this section, since libpostal and deeparse are comparable in terms of accuracy, both are almost perfect; we benchmark deepparse memory usage and inference time with 183,000 addresses of the deepparse dataset. our parsing experiment processes 183,000 addresses using different batch sizes (2 0 , . . . , 2 9 ) and assesses memory usage and inference time performance for libpostal and deepparse. since deepparse can batch address, we assess the inference time as the average processing time per address (i.e. total time to process all addresses 183,000 = time per address). libpostal does not offer batching functionality. the experiment used a gpu and a cpu to assess the accelerator's gain. thus, we also assess gpu memory usage in our experiment that uses such devices. our experiment was conducted on linux os 22.04, with the latest python version (i.e. 3.11), python memory_profiler 0.61.0, torch 2.0 and cuda 11.7 (done march 21, 2023). our gpu device is an rtx 2080. ## future development and maintaining the library as our development roadmap, we plan to improve the documentation by adding a training guide on how one can develop its address parser. also, we plan to offer new deep learning architecture that leverages more recent progress, such as a transformer based architecture and to support more words embedding models, such as contextualized embeddings like elmo embeddings @xcite . moreover, we plan to offer a minimalist application to address parsing for coding laypersons. finally, we aim at improving inference time performance by using recent integration of quantization technique @xcite in pytorch, namely, "performing computations and storing tensors at lower bitwidths than floating point precision" @xcite . the li-brary is maintained mainly by the library authors, and three to four releases are published yearly to improve and maintain the solution. ## conclusion in conclusion, we have described deepparse, an extendable and fine-tunable state-of-the-art library for parsing multinational street addresses. it is an opensource library, has over 99.9% test coverage and integrates easily with existing natural language processing pipelines. deepparse offers great flexibility to users who can develop their address parser using our easy-to-use fine-tuning interface. although slower than the libpostal alternative implemented in low-level language c, deepparse successfully parses more than 99% of address components.