# Reading a town without a comma

> How the .glx reader finds the town in a query with no comma, measured on Indian queries.

A query often ends with its town and has no comma: "Sam sam tea shop Pathanapuram Kollam". The reader must find which words are the town before it can search near it.

## Method

The reader asks the `.glx` file. It does not use a trained model.

1. Take the last one, two or three words as the town, longest first. "Toit Indiranagar Bengaluru" gives "Indiranagar Bengaluru", then "Bengaluru". A six-digit postcode at the end is left out.
2. Look each reading up in the file. A reading stands when the file holds a town of that name of some note, and places matching the other words lie inside it.
3. If no reading stands, search the query as written.

This is the method Nominatim uses. Its `token_assignment.py` lists the ways to split a query into a name and address parts, and `db_search_builder.py` checks each split against the database. Google's patent US8156099 (2012) describes the same idea. The difference here is that it runs from one static file, with no database server and a fixed read budget per query.

Because the method has no model, it works in every country the file covers. No training data is needed per country.

## Guards

- **Three words or more.** "red fort" is a name, not "red" in a place called Fort.
- **Names joined by "of", "the" or "de" stay whole.** "gateway of india" is not "gateway of" in India.
- **A town must be of some note.** A village called Mahal does not take over "hawa mahal".
- **A kind of place goes another way.** "police station Simga" is searched by category in the town.

## Results

India gold queries with the commas removed, same 543 MB `.glx` file (conditions as on [Engines](/search/benchmarks/engines)):

| Query class | Reading from the file | Trained tagger (removed) | Photon |
| --- | --- | --- | --- |
| OSM addresses | 95.0 | 95.0 | 88.5 |
| OSM POIs | **82.0** | 80.5 | 85.5 |
| Overture POIs | 92.5 | **93.0** | 12.5 |

- With the commas in place, and with ", State" added, every gold set gives the same answers.
- p95 latency on these sets is 29 ms, against 20 ms for the tagger.

## The trained tagger it replaced

Until 20 Oct 2026 the reader used a 288 KB address tagger: an averaged structured perceptron with Viterbi decoding, the model type libpostal uses, trained on 486,902 India OpenStreetMap addresses. On 260 addresses people typed it labelled 71.7 % of words right, against libpostal's 67.0 %.

It was removed. It copied a well-known design, it covered India only, and reading from the file gives the same search accuracy with no model to train.
