Montreean

Visualize constituency parse trees vaguely in the style of Mondrian.

To generate a visualization, enter a linearized version of a constituency parse tree (see e.g. pp. 4-5 of this chapter) in the box below. You can either supply your own or generate such strings from English sentences using e.g. the Berkeley Parser. The demo example contains a parse for the sentence "Chomsky famously wrote the sentence "Colorless green ideas sleep furiously".".

Note: the algorithm is stochastic, so you can re-press the "Draw!" button to get different visualizations of the same parse tree.

You can find more options by scrolling down to the bottom of the page or clicking the "More Options" link above.

Overlay text of sentence:

Brief description

The algorithm operates on a parse tree, where each node (corresponding to a constituent in the sentence) has a label and some children. The core of the algorithm takes such a node and recursively generates a set of rectangles. In particular:

  • Each child gets a new sub-rectangle.
  • The relative sizes of these rectangles corresponds to the length (in characters) of the constituent.
  • Whether these rectangles divide the parent horizontally or vertically is random (see "Vertical split probability" below.

Then, after all of the rectangles are built, some are randomly chosen (see "Cell color probability") to be colored a non-white color (see "Cell colors" below).

More options

Vertical split probability:

When splitting a large rectangle into sub-rectangles, probability of splitting vertically versus horizontally.

Cell color probability:

Probability that an individual rectangle will get filled with a (non-white) color. The color will be chosen uniformly at random from the list below.

Cell colors:

Comma-separated list of all of the colors that a cell can take. Each color must be a valid CSS color.