Wednesday, August 25, 2010

Spotlight on Linguistic Tools: phpSyntaxTree

If you ever find yourself in need of diagramming a sentence in a typed document, you may have noticed that not too many word processing programs have user-friendly ways of drawing and inserting trees. One way to work around that issue is to use the free online phpSyntaxTree program, which draws trees based on bracket notations. A few advantages to phpSyntaxTree are that the program is free, online (i.e., you don't have to download anything to use it), and provides an easy-to-work with picture file as its end product.

When you go to the web page, you will see something like this:


The text box on the website comes pre-programmed with this sentence already in bracket notation: [S [NP phpSyntaxTree][VP [V creates][NP nice syntax trees]]]. If you hit the "draw" button directly below the text box, you will go to a new screen that looks like this:


Once the tree is drawn, you can play with the settings across the top (e.g., take out the color, take out subscripts). When the tree looks like what you want, you can simply put your mouse over the diagram and click on it; it will download a copy of that diagram as a picture file (.PNG) to your computer, and you can then insert it into whatever document you're working on.

Once you've got the process down, it flows pretty nicely, and you can create diagrams of any kind (i.e., with any labels) to put into the text box on the website. The problem is that not all students are familiar or comfortable with using bracket notations.

For this program, the basic concept is what appears on the left inside the brackets is inserted in the mother node and what appears on the right is the daughter node. A space between the entries is interpreted as a branch or triangle. For instance, if you put [N dog] into the text box and hit the draw button, you will see a tree like this:


If you put [NP the dog] into the program, you will get a tree like this:

The first space after whatever entry you put at the left will be interpreted by the program as the separation between what is put on top (the mother node) and what is put on bottom (the daughter node). If more than one word appears in the daughter node, a triangle is used instead of a single branch (unless you turn off the triangle notation, in which case a single branch is inserted with several words below it).

Putting this concept to work in layers, you can put notations like [S [NP [Det the] [N dog]] [VP [V sleeps] [PP [Prep on] [NP [Det the] [N porch]]]]] and get results like this:


The program keeps track of your open and closed brackets; if the numbers are not equal, the program will not allow a tree to be drawn. If you break down the sentence in its bracket notation and compare it to its tree, you will see that the basic concept of "left side = mother node" is followed throughout: [NP [Det the] [N dog]] tells the program that NP should appear in the mother node, the mother node has two daughters (Det and N), and that those daughter nodes in turn have daughter nodes (the and dog).

Let's look at that sentence a little more closely. If you type [S the dog sleeps on the porch], you'll get a tree like this:


If you want to break that single node into two, you need to put words that go together in brackets: [S [the dog] [sleeps on the porch]]. Now you're telling the program to have two branches under S (branch 1: the dog; branch 2: sleeps on the porch). But if you hit "draw" right now, you'll be left with this:


Why did that happen? Because the program doesn't distinguish between words and labels unless you put them in their appropriate places. So the program read [the dog] as the is the mother node and its daughter is dog. The same applies to the other set of brackets. You can fix this by inserting labels for both of these: [S [NP the dog] [VP sleeps on the porch]].



From there, you can continue breaking it down until you get the tree with a complete break down. Just remember that what is on the left is inserted into the mother node, a space after that entry indicates a branch/triangle, and more than one branch from a single mother node is indicated by sets of brackets. For instance, [NP [Det] [Adj] [N]] will look like this:


Separating the entries into brackets told the program "don't interpret this as a single unit but rather as three separate daughter nodes."

Once you get the hang of using bracket notation, getting the tree structure you want becomes easier. I encourage you to play with the program to see what different structures look like in their bracket form and compare that form to its tree form. Playing with the program is the best way to learn it.

Next week I will showcase another way to get tree diagrams in typed form to insert into documents. In the meantime, I hope you will have some diagramming fun with phpSyntaxTree.

2 comments:

  1. great

    it helps also in training students how to draw it

    waitng 4 ur coming post

    thanks

    ReplyDelete
  2. Khansa,

    Thank you for your comment. I hope the upcoming post will be as helpful.

    Jessie

    ReplyDelete