Project 03 · SYNTAX

Syntax Tree Sandbox: a drag-and-drop syntax tree generator

Syntax Tree Sandbox is a syntax tree generator you build by hand. Drop words into phrase containers such as NP, VP and PP, and the nested boxes grow into a constituency tree. It checks your structure against phrase-structure rules you can edit, and it has no preset puzzles.

What it does

Most syntax tree tools take bracketed text such as [S [NP …] [VP …]] and draw it. Syntax Tree Sandbox works the other way: you build the structure directly, the way you would on a whiteboard, and the tree appears as you go.

  • Word inventory. Type a sentence and each word is tagged with a word class: noun, determiner, verb, adjective, adverb, preposition, tense, complementizer, or conjunction. Tap a word to change its class.
  • Containers. Drag Clause (CP), Block (TP), VP, NP, PP, AdvP, AdjP, DP, coordination, or an empty node onto the bench, then drop words and other containers into them.
  • Boxes become trees. Nested phrase boxes morph into a branching tree as the structure fills in.
  • Rule checking. Each phrase is checked against the phrase-structure rules, so you can see at a glance which constituents are well-formed.
  • Export. Undo and redo freely, and export the finished tree as SVG.

Example: one sentence, two trees

"I saw the man with the telescope" is ambiguous. Did I use the telescope, or did the man have it? The sandbox lets you build both readings side by side, because the default grammar allows a prepositional phrase in either place.

ReadingWhere the PP attachesStructure
I used the telescopeInside the VP[VP saw [NP the man] [PP with the telescope]]
The man had the telescopeInside the NP[VP saw [NP the man [PP with the telescope]]]

Ambiguous words get more than one class, too. "Saw" can be a verb or a noun, and the sandbox offers both.

Editable phrase-structure rules

The grammar is a list of rules you can read and change in the Phrase-structure rules panel. The notation is compact:

NotationMeaning
(X)X is optional
X+X can repeat
{A/B}Either A or B

Two of the default rules:

TP -> {NP/CP} (AdvP+) (T) VP
PP -> (AdvP) {P/P_Conj} ({NP/CP})

Coordination is built in: X_Conj joins two of the same category with a conjunction, so "the cat and the dog" is an NP made of two NPs. You can add your own categories, such as QP -> (Deg) Q, and the sandbox checks each new rule for unknown categories and broken notation.

Verb transitivity

Verbs are colored by how many complements they take, and the VP rule uses that frame to decide what may follow the verb:

  • Intransitive takes nothing after it: sleep, arrive.
  • Transitive takes one object: like, chase.
  • Ditransitive takes two complements: give, and write in "write her a letter".
  • Linking connects to a description: is happy, seems fine.

Why an open-ended sandbox

The sandbox is meant to work like a drawing tool, not a quiz. There are no target sentences and no score, so it suits students checking an analysis, teachers drawing trees for a lesson, and anyone comparing two theories of the same sentence.

It also feeds a larger project on this site: figuring out how programming could be expressed in natural language. Seeing exactly how English sentences nest is the starting point for designing code that reads like English, which is what SPOKEN does.

Frequently asked questions

How do I draw a syntax tree online?
Open Syntax Tree Sandbox, type your sentence into the word inventory, then drag phrase containers such as NP and VP onto the bench and drop words into them. The boxes become a tree, which you can export as SVG.
What is constituency parsing?
Breaking a sentence into nested phrases, or constituents, such as noun phrases and verb phrases. The result is drawn as a phrase-structure tree.
Can it show structural ambiguity?
Yes. Build two trees for the same sentence, for example attaching a prepositional phrase inside the NP in one and inside the VP in the other, and compare them on the bench.
Can I change the grammar?
Yes. The phrase-structure rules are editable, using (X) for optional, X+ for repeatable and {A/B} for either. You can also add your own categories.
Is it free, and does it need an account?
It is free, runs in the browser, and needs no account.
How do I export a tree?
Use Export SVG. SVG scales cleanly for slides, handouts and papers.

More from this site