the next-generation search engine for parse trees

version 1.15


Like its predecessor tgrep, which was written by Richard Pito, Tgrep2 is a search engine for finding structures in a corpus of trees. The most common application of these programs is in extracting data from the Penn Treebank corpora of parsed sentences.

TGrep2 is mostly backward compatible with tgrep, but it also offers a number of new features, including the following major enhancements:


The TGrep2 manual is available in postscript and PDF formats. It explains how to use tgrep2 and how to build tgrep2 corpus files from tgrep files.

Installing TGrep2

TGrep2 comes precompiled for most up-to-date Linux machines. Simply download the tar file and unpack it with "tar xvzf tgrep2.tgz". Try running tgrep2 with no arguments. If it is correctly compiled for your machine, you should see a help message.

If the tgrep2 executable does not work on your machine, you will need to compile your own. This involves two steps:

First you must compile the libdrutils.a library. To do this, go to this web page and follow the instructions.

Next, assuming you have already unpacked the tgrep2 tar file, you should edit the first line of the Makefile to point to the location of the DRUtils header files (drutils.h).

Now run make and with any luck it will compile nicely. There is no built-in mechanism for installing it someplace special on your machine. But it's only a single, stand-alone executable, so you should be able to handle that yourself.

Version Notes

1.15 1.14 1.13 1.11 1.10 1.09 1.082 1.08 1.07 1.061 1.06 1.05 1.04 1.03 1.02



TGrep2 is Copyright (C) 2001-2005, Douglas L. T. Rohde. It is available free of charge and is governed by the GNU General Public License, version 2.


Comments, questions, and bug reports should be addressed to

Doug Rohde,,
formerly of the Department of Brain and Cognitive Science,
Massachusetts Institute of Technology