[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

new contrib of tree formatting code



I have just posted a file called tree-formatter.sea.hqx to /pub/mcl2/
contrib.  This archive contains two programs to format parse trees for 
display.

The first is a simple tree indenter which requires no extensions to 
Common Lisp.  It was designed for formatting natural language parse 
trees.  But about all it does is smart breaking of long lines, e.g., (s 
(np (det The) (noun cat)) (vp (verb chased) (np (det the) (noun 
mouse)))) =>

(s (np (det The) (noun cat))
   (vp (verb chased)
       (np (det the) (noun mouse))))

It is, admittedly, only barely different from pretty printing, but has 
primitive facilities for printing subscripts.

The second is a Macintosh Common Lisp program that draws parse trees in 
two dimensions, each tree in its own window.  The code is entirely in 
lisp, but uses MCL extensions to Common Lisp to create windows and draw 
graphics in them, e.g., as below (but with real graphics and in a real 
window, of course, not as ASCII art). The code supports all sorts of 
nifty features like sub- and superscripts at left and right, boldface 
and italics, different line shapes, weights, and fills, arbitrary 
connections between nodes, and more.

  =[]========The cat chased the mouse============
  |                                             |
  |                  s                          |
  |                 / \                         |
  |               /     \                       |
  |             /         \                     |
  |           np           vp                   |
  |         /   \         /   \                 |
  |       /      \       /      \               |
  |      det    noun    verb     np             |
  |      |       |       |       |  \           |
  |     The     cat    chased    |    \         |
  |                             det   noun      |
  |                              |      |       |
  |                             the   mouse     |
  |                                             |
  |_____________________________________________|

For more information, see the README file in the archive.


Sue Felshin
MIT Laboratory for Advanced Technology in the Humanities