Download presentation
Presentation is loading. Please wait.
Published byRuth Riley Modified over 9 years ago
1
LING/C SC 581: Advanced Computational Linguistics Lecture Notes Feb 5 th
2
Today's Topics A note on java Tregex homework discussion Treebanks and Statistical parsers Homework – One more exercise on tregex – Install the Bikel-Collins Parser
3
Java and tregex on OSX If you're running on Mavericks (10.9), Java 7 is running by default. But the latest tregex (3.5.1) requires Java 8: – Unsupported major.minor version 52.0 Solution: – Install Java 8 (JRE) from Oracle directly – It installs in /Library/Internet\ Plug-Ins/ – Modify the path to java in run-tregex-gui.command as follows: #!/bin/sh /Library/Internet\ Plug- Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -mx300m -cp `dirname $0`/stanford-tregex.jar edu.stanford.nlp.trees.tregex.gui.TregexGUI
4
Homework Discussion useful command line tool – diff
5
Homework Discussion page 268 of PRSGUID1.PDF http://www.clips.ua.ac.be/pages/mbsp-tags Functional tag -CLF indicates a true cleft
6
Homework Discussion Wish: – every construction was marked with its own tag So – -CLF looks easy …
7
Homework Discussion Types: that is sometimes WHNP
8
Homework Discussion There are no SQ-CLF and SINV-CLF … Gapping?
9
Homework Discussion Search conservatively… – 62: S-CLF < (NP-SBJ << /^[iI]t$/) < (VP < (@SBAR) – 41: S-CLF < (NP-SBJ << /^[iI]t$/) < (VP < (@SBAR < /WHNP/)) wsj_0267.mrg-30 It was also in law school that Mr. O'Kicki and his first wife had the first of seven daughters *T*-1.
10
Homework Discussion Search conservatively… – 62: S-CLF < (NP-SBJ << /^[iI]t$/) < (VP < (@SBAR) – 57: S-CLF < (NP-SBJ << /^[iI]t$/) < (VP < (@SBAR < /WH(ADV|NP)/)) wsj_0591.mrg-21 It is partly for this reason that the exchange last week began *-3 trading in its own stock `` basket '' product that *T*-2 allows big investors to buy or sell all 500 stocks in the Standard & Poor 's index in a single trade. 62: S-CLF < (NP-SBJ << /^[iI]t$/) < (VP < (@SBAR < /IN|(WH(ADV|NP))/))
11
Homework Discussion wsj_1154.mrg-4 It isn't every day that we hear a Violetta who *T*- 1 can sing the first act's high-flying music with all the little notes perfectly pitched *-2 and neatly stitched *-2 together. No promised temporal trace …
12
Homework Discussion 41: S-CLF < (NP-SBJ << /^[iI]t$/) < (VP < (@SBAR < /WH(ADV|NP)-[0-9]+/)) 57: S-CLF < (NP-SBJ << /^[iI]t$/) < (VP < (@SBAR < /WH(ADV|NP).*-.*[0-9]+/)) wsj_0267.mrg-30 It was also in law school that Mr. O'Kicki and his first wife had the first of seven daughters *T*-1.
13
Homework Discussion 43: S-CLF < (NP-SBJ << /^[iI]t$/) < (VP < (@SBAR < /WH(ADV|NP).*-.*([0- 9]+)/#2%i << (/NP-SBJ/ < (/-NONE-/ < /\*T.*([0-9]+)/)))) 39: S-CLF < (NP-SBJ << /^[iI]t$/) < (VP < (@SBAR < /WH(ADV|NP).*-.*([0- 9]+)/#2%i << (/NP-SBJ/ < (/-NONE-/ < /\*T.*([0-9]+)/#1%i)))) wsj_1655.mrg-4 Still, it was in Argentine editions that his countrymen first read his story of Pascal Duarte, a field worker who *T*-1 stabbed his mother to death and has no regrets as he awaits his end in a prison cell *T*-4
14
Homework Discussion Wh-clefts
15
Homework Discussion Wh-clefts: – 28: /SBAR-NOM/ $+ @VP << /.*-PRD/ wsj_0415.mrg-5 Who that winner will be *T*-1 is highly uncertain.
16
Relevance of Treebanks Statistical parsers typically construct syntactic phrase structure – they’re trained on Treebank corpora like the Penn Treebank Note: some use dependency graphs, not trees
17
Parsers trained on the Treebank Don’t recover fully-annotated trees – not trained using nodes with indices or empty (-NONE-) nodes – not trained using functional tags, e.g. –SBJ Therefore they don’t fully parse Example: no SBAR node in … a movie to see Stanford parser
18
Parsers trained on the Treebank SBAR can be forced by the presence of an overt relative pronoun, but note there is no subject gap:
19
Parsers trained on the Treebank Probabilities are estimated from frequency information of each node given surrounding context (e.g. parent node, or the word that heads the node) Still these systems have enormous problems with prepositional phrase (PP) attachment Example: (borrowed from Igor Malioutov) – A boy with a telescope kissed Mary on the lips – Mary was kissed by a boy with a telescope on the lips PP with a telescope should adjoin to the noun phrase (NP) a boy PP on the lips should adjoin to the verb phrase (VP) headed by kiss
20
Active/passive sentences Examples using the Stanford Parser: Both active and passive sentences are parsed incorrectly Both active and passive sentences are parsed incorrectly
21
Active/passive sentences Examples: X on the lips modifies Mary X on the lips modifies telescope
22
Homework Exercise Use tregex to find out how many passive sentences there are in the Treebank WSJ section? Report your search formula and frequency count The passive construction (according to the Bracketing Guidelines) – Note: by-phrase containing logical subject (LGS) is optional
23
Treebank Rules Just how many rules are there in the WSJ treebank? What’s the most common POS tag? What’s the most common syntax rule?
24
Treebank Total # of tags: 1,253,013
25
Treebank CategoryFrequencyPercentage N35503928.3% V15497512.4%
26
Treebank Total # of rules: 978,873 # of different rules: 31,338
27
Treebank
28
Total # of rules: 978,873 # of different rules: 17,554
29
Treebank
30
Today’s Topic Let’s segue from Treebank search to stochastic parsers trained on the WSJ Penn Treebank Examples: Berkeley Parser – http://tomato.banatao.berkeley.edu:8080/p arser/parser.html Stanford Parser – http://nlp.stanford.edu:8080/parser/ are all trained on the Treebank. We’ll play with Bikel’s implementation of Collins’s Parser …
31
Using the Treebank What is the grammar of the Treebank? – We can extract the phrase structure rules used, and – count the frequency of rules, and construct a stochastic parser
32
Using the Treebank Breakthrough in parsing accuracy with lexicalized trees – think of expanding the nonterminal names to include head information and the words that are at the leaves of the subtrees.
33
Bikel Collins Parser Java re-implementation of Collins’ parser Paper – Daniel M. Bikel. 2004. Intricacies of Collins’ Parsing Model. (PS) (PDF) in Computational Linguistics, 30(4), pp. 479-511.PS) (PDF) in Computational Linguistics, 30(4), pp. 479-511. Software – http://www.cis.upenn.edu/~dbikel/software.html#st at-parser (page no longer exists) http://www.cis.upenn.edu/~dbikel/software.html#st at-parser
34
Bikel Collins Download and install Dan Bikel’s parser – dbp.zip (on course homepage) File: install.sh – Java code – but at this point I think Windows won’t work because of the shell script (.sh) – maybe after files are extracted?
35
Bikel Collins Download and install the POS tagger MXPOST parser doesn’t actually need a separate tagger…
36
Bikel Collins Training the parser with the WSJ PTB See guide – userguide/guide.pdf directory: TREEBANK_3/parsed/mrg/wsj chapters 02-21: create one single.mrg file events:wsj-02-21.obj.gz directory: TREEBANK_3/parsed/mrg/wsj chapters 02-21: create one single.mrg file events:wsj-02-21.obj.gz
37
Bikel Collins Settings:
38
Bikel Collins Parsing – Command – Input file format (sentences)
39
Bikel Collins Verify the trainer and parser work on your machine
40
Bikel Collins File: bin/parse is a shell script that sets up program parameters and calls java
41
Bikel Collins
42
File: bin/train is another shell script
43
Bikel Collins Relevant WSJ PTB files
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.