Difference between revisions of "Parse Tree"

From visone manual
Jump to navigation Jump to search
(Created page with 'A '''parse tree''' represents the structural construction of a sentence with respect to the grammar of the language in question. For example, we could construct a toy grammar fo…')
 
Line 10: Line 10:
  
 
using the conventional names of '''NP''' for ''Noun Phrases'', '''VP''' for ''Verb Phrases'' and '''DT''' for ''Determiners'' like ''the'' or ''an''.
 
using the conventional names of '''NP''' for ''Noun Phrases'', '''VP''' for ''Verb Phrases'' and '''DT''' for ''Determiners'' like ''the'' or ''an''.
 +
 
Using this grammar, we can describe sentences like ''John sleeps'' or ''the dog eats the cake''.
 
Using this grammar, we can describe sentences like ''John sleeps'' or ''the dog eats the cake''.
For ''John sleeps'', we can use the first rule, which states that a sentence can be an NP followed by a VP. Using the third rule, an NP can be just a noun, such as ''John'', and similarly, according to the fifth rule, a VP can consist of simply a verb, such as ''sleeps''.
+
For ''John sleeps'', we can use the first rule, which states that a ''Sentence'' can be an ''NP'' followed by a ''VP''. Using the third rule, an ''NP'' can be just a noun, such as ''John'', and similarly, according to the fifth rule, a ''VP'' can consist of simply a verb, such as ''sleeps''.
 +
 
 +
Because ''Sentence'' is split into ''NP'' and ''VP'', which are then further specialized into ''Noun'' and ''Verb'' respectively, it makes sense to draw this derivation as a tree where each grammatical entity is connected to the entity it is derived from. The parse tree for the example sentence ''John sleeps'' would thus be:
 +
 
 +
      Sentence
 +
      /    \
 +
    NP      VP
 +
      |      |
 +
    Noun    Verb

Revision as of 12:06, 16 November 2010

A parse tree represents the structural construction of a sentence with respect to the grammar of the language in question.

For example, we could construct a toy grammar for the English language using the subject-predicate-object structure, as

Sentence ::= NP VP
           | NP VP NP
NP ::= Noun
     | DT Noun
VP ::= Verb

using the conventional names of NP for Noun Phrases, VP for Verb Phrases and DT for Determiners like the or an.

Using this grammar, we can describe sentences like John sleeps or the dog eats the cake. For John sleeps, we can use the first rule, which states that a Sentence can be an NP followed by a VP. Using the third rule, an NP can be just a noun, such as John, and similarly, according to the fifth rule, a VP can consist of simply a verb, such as sleeps.

Because Sentence is split into NP and VP, which are then further specialized into Noun and Verb respectively, it makes sense to draw this derivation as a tree where each grammatical entity is connected to the entity it is derived from. The parse tree for the example sentence John sleeps would thus be:

     Sentence
      /    \
    NP      VP
     |      |
   Noun    Verb