Output format:
S#[Sentence number] Number of left brackets/Number of right brackets
[Parse]
pan id="display-brackets">

What this interface does

This interface reads in a text file containing a set of Penn Treebank-style parses. It then displays the parses in tree form. Edit the parse by dragging and dropping nodes in the tree. Edited trees can then be converted into Penn Treebank-style bracketed forms.

General procedure

  1. Load a file: Click on "Choose file", find the right .txt file with parses.
  2. Load a tree: Enter the index (the serial number of a tree, so to speak) of the tree in the Index box. Click the "Load" button.
  3. Input tree: Enter Penn Treebank-style trees (round brackets/parentheses, not square brackets) in the Input box.
  4. Display tree: Click the "Display" button to visualise the tree in the Input box.
  5. Edit tree: see below.
  6. Save a tree: Shift+z (which will load the next tree).
  7. Export a tree: Shift+x will autogenerate and download a text file with all corrected trees. Alternatively, on the "All edited trees" tab, click "Export all trees to txt file" to download.
  8. Warning: If you accidentally close the window or hit the Refresh button, all edits will be lost!

How to edit a tree

By directly changing the input brackets

  1. Add or delete brackets, tags, labels in the "Input" textbox as appropriate.
  2. Once done, click on "Display" to update the tree.
  3. Repeat these steps as many times as needed.
  4. Be careful while making changes to the textbox. Make sure that the brackets are balanced (for every "(", there must be a ")"), otherwise the interface will not display the tree.

Drag and drop interface

  1. To re-attach a node: click on it and then drag and drop it to the desired parent node.
  2. To re-order nodes within a tree:
    1. Click on a node that is not on the right edge.
    2. Drag and drop it to its parent, as if re-attaching it. This moves the node to the right edge.
    3. Repeat as necessary.
  3. To change a non-terminal node label:
    1. Click on the node (the node should be highlighted in yellow).
    2. Type in the corrected label in the top box of "New node" (feel free to leave the bottom box blank).
    3. Select "Edit label".
    4. Click "Update" button.
  4. To add a child or sibling to a node:
    1. Click on the node.
    2. Type in the label and string in the top box of "New node". Feel free to leave the bottom box blank if it's a non-terminal node. Otherwise, type in the word.
    3. Select "Add as child" or "Add as sibling".
    4. Click "Update" button. The new node will appear on the right edge.
    1. Note: when you hit ctrl-z, the tool will automatically delete the following types of empty nodes: those that contain no leaves whatsoever (NP ) or (S ) or a node that contains such nodes, like (NP (NP )) or (SBAR (S )).
    2. However, the tool will not automatically delete empty nodes that are nested multiple times, like (NP (NP (NP ))).

Keyboard shortcuts

  1. Export all trees -- including edited ones -- to text file: shift-x (e*x*port; this is the same as clicking on the button)
  2. Save current tree and then view next tree: shift+z (i.e. "Z". To encourage people to finalise trees ASAP instead of skipping forward, no shortcut for backtracking.)
  3. Delete node and all daughters: @ (shift + 2)
  4. Keyboard shortcut for adding null elements
    1. Add null complementiser: 4
    2. Add null NP: 1
    3. Add null "have": h
    4. Add null "to": shift+t
    5. Add null "if" complementiser (e.g. "ask you can go or not", meaning "ask whether you can go"): shift+i
    6. Keyboard shortcuts for adding nonterminal nodes
      1. "S": s
      2. "SBAR": shift+s
      3. "VP": v
      4. "NP": n
      5. "TBAR": t
      6. "ADVP": shift+v
      7. "ADJP": shift+j
      8. "PRN": q (for parentheticals, hedges like 'I mean", "you know")
      9. "INTJ": w (for interjections, like "right", "ok", "yah")
      10. "EDITED": r (for material that was "discarded" and restarted)
      11. "FRAG": shift+g (for material that cannot be grouped together)
      12. "QUP": shift+q (for "or not")
      13. Add a node and specify its label: shift+n
    7. Keyboard shortcuts for modifying nonterminal nodes
      1. Change (change) label: ` (the key on the left of "1")
      2. Change label to INTJ: i
      3. Change label to SBAR: shift+b
      4. Change label to SBARQ: shift+5 (i.e. %)
      5. Change label to SQ: shift+4 (i.e. $)
      6. Change label to ADVP: a
      7. Add tag to label: f (e.g. change "NP" to "NP-ADV")
      8. Add -ADV tag: shift+a
      9. Add -RDL tag: shift+d (for afterthoughts/ right-dislocation)
      10. Add -FRAG tag: shift+f (for incomplete utterances)

What happens if you make a mistake?

Unfortunately there is no undo function. Two options:
  1. Add nodes back manually, using the New Node interface.
  2. Click "Display" or "Load" button to show the original tree, and edit the tree all over again.

Wishlist, in descending order of priority

  1. How to write trees directly to a database -- but solving this problem could lead to overwriting trees by mistake!
  2. How to right click on a node and make edits directly on the node.

Phrase Structure Tree Editor (beta version)

Based on OrgChart by dabeng, originally released under the MIT License.

Modified work (c) 2020-present z-n-huang. All substantial changes can be identified by "z-n-huang" in comments in the source code.