Download TGrep2 User Manual - TedLab

Transcript
Rohde
TGrep2 Manual
5 Controlling the Output
By specifying output formats, it is possible to have TGrep2 report a variety of information in a customizable
format. This is detailed in Section 5.2. But for most users, the simpler command-line arguments -w, -l, -t,
-u, and -x will suffice.
By default, when a pattern matches a tree in the corpus, TGrep2 prints the subtree matched by the head
node in the pattern. The head node is the first node specified. If the -w option is used, the whole sentence is
printed, regardless of where within it the match occurred.
The default format for printing trees is the short form. This renders each tree on a single line with
non-terminals enclosed in parentheses:
(NP (NP (NNS sales)) (PP (IN of) (NP (NNP U.S.) (NNS savings) (NNS bonds))))
The -l option causes the long form to be used, which renders trees across multiple lines. This was the
default in TGrep:
(NP (NP (NNS sales))
(PP (IN of)
(NP (NNP U.S.)
(NNS savings)
(NNS bonds))))
The -t option prints only the terminals (words) of the sentence, eliminating all of the structural information:
sales of U.S. savings bonds
The -u option prints only the name of the top symbol in each matching subtree. It will not print the
children of that symbol. This would normally be used when the symbol is matched by a wildcard or regular
expression, and thus could have several possible names.
Finally, the -x option prints the subtree code for each match. The subtree code consists of the sentence
number followed by a colon (:) and the number of the top node in the subtree in the order in which it is
encountered on a depth-first search. See Section 5.3 for more information on using subtree codes to later
retrieve those subtrees from the corpus.
If you ever request that a node be printed, but the node is not matched to a subtree in the current tree,
“<none>” is printed in place of the tree. However, if the -x option is in use, the sentence number will be
printed followed by a colon and 0 for the subtree number.
5.1 Marking Nodes for Printing
As in TGrep, it is possible to select nodes other than the head node for printing. If the name of any node
is preceded by a single back-quote (‘), the tree matched by that node will be printed, rather than the head
node. If multiple nodes are marked, their trees are printed on separate lines.
Without any marks, the pattern “NP << JJ < /ˆPP/” might print this on a match:
(NP (NP (DT a) (JJ high) (NN point)) (PP (IN for) (NP (DT the) (NN year))))
But “NP << ‘JJ < ‘/ˆPP/” would print:
(PP (IN for) (NP (DT the) (NN year)))
(JJ high)
15