Week 4 DQ 3 Trees occur in various venues in computer science

advertisement
Week 4 DQ 3
Trees occur in various venues in computer science: decision trees in algorithms,
search trees, and so on. In linguistics, one encounters trees as well, typically as
parse trees, which are essentially sentence diagrams, such as those you might
have had to do in primary school, breaking a natural-language sentence into its
components-clauses, sub clauses, nouns, verbs, adverbs, adjectives,
prepositions, and so on. What might be the significance of the depth and breadth
of a parse tree relative to the sentence it represents? If you need to, look up parse
tree and natural language processing on the Internet to see some examples
Parse tree (syntax tree) is actually a tree which shows the syntactic structure of a
sentence in a context-free language (or string). In a parse tree the inner nodes are
marked by non-terminals of grammar, and the decent of nodes are marked by A. The
leaf nodes of a parse tree might be terminals or non terminal. If all the leaves are
terminals then they spell from left to right a sentence of the language.
One particular parse tree is demonstrated in the diagram. The assumption is that the
grammar involved has productions A → BC, B → b, C → cc
A parse tree is comprised of divisions and nodes. Look at a sentence representing the
English language “Susan ran a marathon”. The parse tree is the complete structure
beginning with S and finishing in each of the leaf nodes.
Example for "Susan ran a marathon."
S for sentence, the top level structure that is the complete sentence example.
NP for the noun phrase. First NP, a single noun ”Susan”, is the subject of the
sentence. The second one is the object of the sentence.
VP for verb phrase: which can serve as the predicate
V for the verb: which is “ran” in this sentence
Det for determiner, in this case the definite article” the”
N for noun
In a parse tree, each node is either a leaf node, a division node, or a root node. In the
instance to the right, S is a root node, NP and VP are division nodes, while Susan, ran,
the, and marathon are all leaf nodes. Nodes may also be described by the terms parent
node or child node. Parent nodes have a minimum of one other node that is connected
under it by one more division (typically the child node). In the instance above S would
represent the parent node for both NP and VP. The child node has a minimum of one
node directly above it that is connected by a division of the tree (typically the parent
node). Using the instance above once more, “ran” would be the child node of V.
Download