Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Reaction Maps with n-gram matching

XKCD 2260 - Reaction Maps

© Randall Monroe, 2020

Reaction maps, AKA homophones with North American cities. This version uses 3 phonemes at the ends of city names (from Geofabrik's version of the OSM North American places dataset) to reconstruct sentences that sound similar.

Use it here!

The method is simple, and I've attempted to justify it in this post from some statistics that I encountered.

On the live site, the following is used:

  1. A 3M-place subset of the Geonames Gazetteer dataset 200K place names from the OSM North America dataset were converted to phonemes. The names were first split into words and compared against the CMU Pronouncing Dictionary; missing entries were transcribed using CMU g2p-seq2seq.
  2. Phoneme-to-phoneme similarity came from Stefan Frisch's 1996 doctoral thesis: SIMILARITY AND FREQUENCY IN PHONOLOGY. Vowels matching was guessed by myself. See the original matrix on page 40 of Frisch's thesis and the one used here at M.csv.
  3. The database encodes the relationships between:
    • Places pl and their terminal 3-grams ng3 (and the ngram's phonemes ph),
    • The top 40 similar ng3 for each ng3 via ng_ng_w
    • Between dictionary words dict and their phonemes dict_ph.

The full SQL database can be found here, on Google Drive with the table of place names pl under the same license as the OSM: the Open Data Commons Open Database License (ODbL).

The server uses expressjs to serve pages. First, you must have a database config file at ./pg.js that defines a node-postgres connection pool. Supposing you installed into database reaction_maps, for a postgres user postgres with password postgres, this will work:

const { Pool } = require('pg');
module.exports = {
	pool: (new Pool({
		host: 'localhost',
		user: 'reaction_maps',
		database: 'postgres',
		database: 'postgres'

To launch, run node server.js. To build, run npx webpack. The site pulls from the OSM public tileserver at the moment, so don't go too crazy.


"Is your reaction too intense to be expressed in an emoji or gif? Try using driving instructions!" - Randall Monroe







No releases published


No packages published