text stringlengths 1 7.76k | source stringlengths 17 81 |
|---|---|
182 CHAPTER 8. APPLICATIONS OF SEQUENCE LABELING word PTB tag UD tag UD attributes The DT DET DEFINITE=DEF PRONTYPE=ART German JJ ADJ DEGREE=POS Expressionist NN NOUN NUMBER=SING movement NN NOUN NUMBER=SING was VBD AUX MOOD=IND NUMBER=SING PERSON=3 TENSE=PAST VERBFORM=FIN destroyed VBN VERB TENSE=PAST VERBFORM=PART VO... | nlp_Page_200_Chunk201 |
8.3. NAMED ENTITY RECOGNITION 183 miner or pronominal modifier), and DEFINITE=DEF, which indicates that it is a definite article (referring to a specific, known entity). The verbs are each marked with several attributes. The auxiliary verb was is third-person, singular, past tense, finite (conjugated), and indicative (desc... | nlp_Page_201_Chunk202 |
184 CHAPTER 8. APPLICATIONS OF SEQUENCE LABELING (8.20) a. The B-ORG U.S. I-ORG Army I-ORG captured O Atlanta B-LOC on O May B-DATE 14 I-DATE , I-DATE 1864 I-DATE b. Number O of O glucocorticoid B-PROTEIN receptors I-PROTEIN in O lymphocytes B-CELLTYPE and O ... ... Figure 8.2: BIO notation for named entity recognition... | nlp_Page_202_Chunk203 |
8.4. TOKENIZATION 185 (1) 日文 Japanese 章魚 octopus 怎麼 how 說? say How to say octopus in Japanese? (2) 日 Japan 文章 essay 魚 fish 怎麼 how 說? say Figure 8.3: An example of tokenization ambiguity in Chinese (Sproat et al., 1996) given names — more than could be observed in any annotated corpus. Tokens or spans that match an entry... | nlp_Page_203_Chunk204 |
186 CHAPTER 8. APPLICATIONS OF SEQUENCE LABELING field to predict labels of START or NONSTART on each character. More recent work has employed neural network architectures. For example, Chen et al. (2015) use an LSTM- CRF architecture, as described in § 7.6: they construct a trellis, in which each tag is scored accordin... | nlp_Page_204_Chunk205 |
8.6. DIALOGUE ACTS 187 Speaker Dialogue Act Utterance A YES-NO-QUESTION So do you go college right now? A ABANDONED Are yo- B YES-ANSWER Yeah, B STATEMENT It’s my last year [laughter]. A DECLARATIVE-QUESTION You’re a, so you’re a senior now. B YES-ANSWER Yeah, B STATEMENT I’m working on my projects trying to graduate [... | nlp_Page_205_Chunk206 |
188 CHAPTER 8. APPLICATIONS OF SEQUENCE LABELING as questions and answers. These features are handled with an additional emission distri- bution, p(am | ym), which is modeled with a probabilistic decision tree (Murphy, 2012). While acoustic features yield small improvements overall, they play an important role in disti... | nlp_Page_206_Chunk207 |
8.6. DIALOGUE ACTS 189 a) First, train a logistic regression or SVM classifier using character suffixes: char- acter n-grams up to length 4. Compute the recall, precision, and F -MEASURE on the development data. b) Next, augment your classifier using the same character suffixes of the preced- ing and succeeding tokens. Aga... | nlp_Page_207_Chunk208 |
190 CHAPTER 8. APPLICATIONS OF SEQUENCE LABELING d) Compute the per-character segmentation accuracy on the test set. You should be able to get at least 88% accuracy. e) Print out a sample of segmented text from the test set, e.g. Thereareno mice in the air , I ’ m afraid , but y oumight cat chabat , and that ’ svery li... | nlp_Page_208_Chunk209 |
Chapter 9 Formal language theory We have now seen methods for learning to label individual words, vectors of word counts, and sequences of words; we will soon proceed to more complex structural transforma- tions. Most of these techniques could apply to counts or sequences from any discrete vo- cabulary; there is nothin... | nlp_Page_209_Chunk210 |
192 CHAPTER 9. FORMAL LANGUAGE THEORY membership problem can be generalized to the problems of scoring strings for their ac- ceptability (as in language modeling), and of transducing one string into another (as in translation). 9.1 Regular languages If you have written a regular expression, then you have defined a regul... | nlp_Page_210_Chunk211 |
9.1. REGULAR LANGUAGES 193 q0 start q1 a b b Figure 9.1: State diagram for the finite state acceptor M1. 9.1.1 Finite state acceptors A regular expression defines a regular language, but does not give an algorithm for de- termining whether a string is in the language that it defines. Finite state automata are theoretical ... | nlp_Page_211_Chunk212 |
194 CHAPTER 9. FORMAL LANGUAGE THEORY q0 and reads symbol a, it stays in q0. Figure 9.1 provides a graphical representation of M1. Because each pair of initial state and symbol has at most one resulting state, M1 is deterministic: each string ω induces at most one accepting path. Note that there are no transitions for ... | nlp_Page_212_Chunk213 |
9.1. REGULAR LANGUAGES 195 current section deals with derivational morphology; inflectional morphology is discussed in § 9.1.4. Suppose that we want to write a program that accepts only those words that are con- structed in accordance with the rules of English derivational morphology: (9.1) a. grace, graceful, gracefull... | nlp_Page_213_Chunk214 |
196 CHAPTER 9. FORMAL LANGUAGE THEORY q0 start qN1 qJ1 qA1 grace -ful -ly qneg qN2 qJ2 qA2 dis- grace -ful -ly qN3 qJ3 qA3 allure -ing -ly qJ4 qN4 qA4 fair -ness -ly Figure 9.2: A finite state acceptor for a fragment of English derivational morphology. Each path represents possible derivations from a single root form. T... | nlp_Page_214_Chunk215 |
9.1. REGULAR LANGUAGES 197 q0 start qneg qN1 qJ1 qA1 dis- grace -ful -ly grace qN2 allure -ing qJ2 qN3 fair -ness -ly Figure 9.3: Minimization of the finite state acceptor shown in Figure 9.2. “Though many things are possible in morphology, some are more possible than others.” But finite state acceptors give no way to ex... | nlp_Page_215_Chunk216 |
198 CHAPTER 9. FORMAL LANGUAGE THEORY N-gram language models as WFSAs In n-gram language models (see § 6.1), the probability of a sequence of tokens w1, w2, . . . , wM is modeled as, p(w1, . . . , wM) ≈ M Y m=1 pn(wm | wm−1, . . . , wm−n+1). [9.6] The log probability under an n-gram language model can be modeled in a W... | nlp_Page_216_Chunk217 |
9.1. REGULAR LANGUAGES 199 may have multiple accepting paths. In some applications, the score for the input is ag- gregated across all such paths. Such aggregate scores can be computed by generalizing WFSAs with semiring notation, first introduced in § 7.7.3. Let d(π) represent the total score for path π = t1, t2, . . .... | nlp_Page_217_Chunk218 |
200 CHAPTER 9. FORMAL LANGUAGE THEORY qA qU start qB a : p1(a) b : p1(b) a : λ2p2(a | a) b : λ2p2(b | a) b : λ2p2(b | b) a : λ2p2(a | b) ϵ : λ1 ϵ2 : λ1 Figure 9.4: WFSA implementing an interpolated bigram/unigram language model, on the alphabet Σ = {a, b}. For simplicity, the WFSA is contrained to force the first token ... | nlp_Page_218_Chunk219 |
9.1. REGULAR LANGUAGES 201 transition weight, which are themselves probabilities. The ⊕operator is addition, so that the total score is the sum of the scores (probabilities) for each path. This corresponds to the probability under the interpolated bigram language model. 9.1.4 Finite state transducers Finite state accep... | nlp_Page_219_Chunk220 |
202 CHAPTER 9. FORMAL LANGUAGE THEORY q start a/a, b/b : 0 a/b, b/a : 1 a/ϵ, b/ϵ : 1 ϵ/a, ϵ/b : 1 Figure 9.5: State diagram for the Levenshtein edit distance finite state transducer. The label x/y : c indicates a cost of c for a transition with input x and output y. by an unweighted finite state transducer. The first rule... | nlp_Page_220_Chunk221 |
9.1. REGULAR LANGUAGES 203 q1 start q2 ¬s/¬s s/ϵ q3 q4 . . . a/s b/s ϵ/a ϵ/b Figure 9.6: State diagram for final two lines of step 1a of the Porter stemming diagram. States q3 and q4 “remember” the observations a and b respectively; the ellipsis . . . repre- sents additional states for each symbol in the input alphabet.... | nlp_Page_221_Chunk222 |
204 CHAPTER 9. FORMAL LANGUAGE THEORY start c/c a/a n/n t/t o/o ϵ/+Noun ϵ/+Masc ϵ/+Sing ϵ/a ϵ/r ϵ/+Verb o/+PresInd ϵ/+1p ϵ/+Sing a/+PresInd ϵ/+3p ϵ/+Sing Figure 9.7: Fragment of a finite state transducer for Spanish morphology. There are two accepting paths for the input canto: canto+NOUN+MASC+SING (masculine singular n... | nlp_Page_222_Chunk223 |
9.1. REGULAR LANGUAGES 205 is simply the characters a-z. The composed transducer (TO ◦TM) then transduces from bake+PAST to the spelling baked. The design of TO is left as an exercise. Example: Hidden Markov models Hidden Markov models (chapter 7) can be viewed as weighted finite state transducers, and they can be const... | nlp_Page_223_Chunk224 |
206 CHAPTER 9. FORMAL LANGUAGE THEORY start start N V end N/aardvark N/abacus N/. . . V/aardvark V/abacus V/. . . Figure 9.8: Finite state transducer for hidden Markov models, with a small tagset of nouns and verbs. For each pair of tags (including self-loops), there is an edge for every word in the vocabulary. For sim... | nlp_Page_224_Chunk225 |
9.2. CONTEXT-FREE LANGUAGES 207 model, but this is a special case of the more general problem for finite state automata. Eisner (2002) describes an expectation semiring, which enables the expected number of transitions across each arc to be computed through a semiring shortest-path algorithm. Alternative approaches for ... | nlp_Page_225_Chunk226 |
208 CHAPTER 9. FORMAL LANGUAGE THEORY the dog the cat the dog chased the goat the cat the dog chased kissed ... Figure 9.10: Three levels of center embedding glish includes center embedding, and so the argument goes, English grammar as a whole cannot be regular.5 A more practical argument for moving beyond regular lang... | nlp_Page_226_Chunk227 |
9.2. CONTEXT-FREE LANGUAGES 209 S →S OP S | NUM OP →+ | −| × | ÷ NUM →NUM DIGIT | DIGIT DIGIT →0 | 1 | 2 | . . . | 9 Figure 9.11: A context-free grammar for arithmetic expressions • a finite set of non-terminals N; • a finite alphabet Σ of terminal symbols; • a set of production rules R, each of the form A →β, where A ∈N... | nlp_Page_227_Chunk228 |
210 CHAPTER 9. FORMAL LANGUAGE THEORY S Num Digit 4 S S Num Digit 3 Op − S S Num Digit 2 Op + S Num Digit 1 S S S Num Digit 3 Op − S Num Digit 2 Op + S Num Digit 1 Figure 9.12: Some example derivations from the arithmetic grammar in Figure 9.11 defines two productions, A →x and A →y. This grammar is recursive: the non-t... | nlp_Page_228_Chunk229 |
9.2. CONTEXT-FREE LANGUAGES 211 In Chomsky Normal Form (CNF), the right-hand side of every production includes either two non-terminals, or a single terminal symbol: A →BC A →a All CFGs can be converted into a CNF grammar that is weakly equivalent. To convert a grammar into CNF, we first address productions that have mo... | nlp_Page_229_Chunk230 |
212 CHAPTER 9. FORMAL LANGUAGE THEORY the conventions of the Penn Treebank (PTB; Marcus et al., 1993), a large-scale annotation of English language syntax. The generalization to “mildly” context-sensitive languages is discussed in § 9.3. The Penn Treebank annotation is a phrase-structure grammar of English. This means ... | nlp_Page_230_Chunk231 |
9.2. CONTEXT-FREE LANGUAGES 213 modify it, such as her younger brother; a verb phrase includes the verb and its modifiers, such as bought a fish and greedily ate it. In context-free grammars, each phrase type is a non-terminal, and each constituent is the substring that the non-terminal yields. Grammar design involves ch... | nlp_Page_231_Chunk232 |
214 CHAPTER 9. FORMAL LANGUAGE THEORY Sentences The most common production rule for sentences is, S →NP VP [9.28] which accounts for simple sentences like Abigail ate the kimchi — as we will see, the direct object the kimchi is part of the verb phrase. But there are more complex forms of sentences as well: S →ADVP NP V... | nlp_Page_232_Chunk233 |
9.2. CONTEXT-FREE LANGUAGES 215 These multiple noun constructions can be combined with adjectival phrases and cardinal numbers, leading to a large number of additional productions. Recursive noun phrase productions include coordination, prepositional phrase attach- ment, subordinate clauses, and verb phrase adjuncts: N... | nlp_Page_233_Chunk234 |
216 CHAPTER 9. FORMAL LANGUAGE THEORY own: VP →VB | VBZ | VBD | VBN | VBG | VBP [9.41] More complex verb phrases can be formed by a number of recursive productions, including the use of coordination, modal verbs (MD; she should snack), and the infinitival to (TO): VP →MD VP She will snack [9.42] VP →VBD VP She had snack... | nlp_Page_234_Chunk235 |
9.2. CONTEXT-FREE LANGUAGES 217 Again, because these productions are not recursive, the grammar must include produc- tions for every verb part-of-speech. A special set of verbs, known as copula, can take predicative adjectives as direct ob- jects: VP →VBZ ADJP She is hungry [9.56] VP →VBP ADJP Success seems increasingl... | nlp_Page_235_Chunk236 |
218 CHAPTER 9. FORMAL LANGUAGE THEORY Adjectival phrases extend beyond bare adjectives (ADJP →JJ) in a number of ways: ADJP →RB JJ very hungry [9.66] ADJP →RBR JJ more hungry [9.67] ADJP →JJS JJ best possible [9.68] ADJP →RB JJR even bigger [9.69] ADJP →JJ CC JJ high and mighty [9.70] ADJP →JJ JJ West German [9.71] ADJ... | nlp_Page_236_Chunk237 |
9.3. *MILDLY CONTEXT-SENSITIVE LANGUAGES 219 S VP NP PP NP chopsticks IN with NP sushi V eat NP We S VP PP NP chopsticks IN with VP NP sushi V eat NP We Figure 9.13: Two derivations of the same sentence machine), PSPACE-complete problems cannot be solved efficiently if P ̸= NP. Thus, de- signing an efficient parsing algo... | nlp_Page_237_Chunk238 |
220 CHAPTER 9. FORMAL LANGUAGE THEORY Abigail eats the kimchi NP (S\NP)/NP (NP/N ) N > NP > S\NP < S Figure 9.14: A syntactic analysis in CCG involving forward and backward function appli- cation As with the move from regular to context-free languages, mildly context-sensitive languages can also be motivated by expedie... | nlp_Page_238_Chunk239 |
9.3. *MILDLY CONTEXT-SENSITIVE LANGUAGES 221 Abigail might learn Swahili NP (S\NP)/VP VP/NP NP >B (S\NP)/NP > S\NP < S Figure 9.15: A syntactic analysis in CCG involving function composition (example modi- fied from Steedman and Baldridge, 2011) its right results in a noun phrase, so determiners have the type NP/N. Figu... | nlp_Page_239_Chunk240 |
222 CHAPTER 9. FORMAL LANGUAGE THEORY a story that Abigail tells NP (NP\NP)/(S/NP) NP (S\NP)/NP >T S/(S\NP) >B S/NP > NP\NP < NP Figure 9.16: A syntactic analysis in CCG involving an object relative clause Abigail from NP to the complex type (S/NP)\NP). This function can then be combined with the transitive verb tells ... | nlp_Page_240_Chunk241 |
9.3. *MILDLY CONTEXT-SENSITIVE LANGUAGES 223 a) Define a finite-state acceptor that accepts all strings with edit distance 1 from the target string, target. b) Now think about how to generalize your design to accept all strings with edit distance from the target string equal to d. If the target string has length ℓ, what ... | nlp_Page_241_Chunk242 |
224 CHAPTER 9. FORMAL LANGUAGE THEORY 10. * One advantage of CCG is its flexibility in handling coordination: (9.11) a. Hunter and Tristan speak Hawaiian b. Hunter speaks and Tristan understands Hawaiian Define the lexical entry for and as and := (X/X)\X, [9.77] where X can refer to any type. Using this lexical entry, sh... | nlp_Page_242_Chunk243 |
Chapter 10 Context-free parsing Parsing is the task of determining whether a string can be derived from a given context- free grammar, and if so, how. A parser’s output is a tree, like the ones shown in Fig- ure 9.13. Such trees can answer basic questions of who-did-what-to-whom, and have ap- plications in downstream t... | nlp_Page_243_Chunk244 |
226 CHAPTER 10. CONTEXT-FREE PARSING S →NP VP NP →NP PP | we | sushi | chopsticks PP →IN NP IN →with VP →V NP | VP PP V →eat Table 10.1: A toy example context-free grammar 10.1 Deterministic bottom-up parsing The CKY algorithm1 is a bottom-up approach to parsing in a context-free grammar. It efficiently tests whether a ... | nlp_Page_244_Chunk245 |
10.1. DETERMINISTIC BOTTOM-UP PARSING 227 binary productions capable of producing at least one entry in each of the cells corre- sponding to left and right children. For example, VP can be placed in the cell t[1, 3] because the grammar includes the production VP →V NP, and because the chart contains V ∈t[1, 2] and NP ∈... | nlp_Page_245_Chunk246 |
228 CHAPTER 10. CONTEXT-FREE PARSING Algorithm 13 The CKY algorithm for parsing a sequence w ∈Σ∗in a context-free grammar G = (N, Σ, R, S), with non-terminals N, production rules R, and start sym- bol S. The grammar is assumed to be in Chomsky normal form (§ 9.2.1). The function PICKFROM(b[i, j, X]) selects an element ... | nlp_Page_246_Chunk247 |
10.2. AMBIGUITY 229 We eat sushi with chopsticks We NP ∅ S ∅ S eat V VP ∅ VP sushi NP ∅ NP with P PP chopsticks NP Figure 10.1: An example completed CKY chart. The solid and dashed lines show the back pointers resulting from the two different derivations of VP in position t[1, 5]. 10.1.3 Complexity For an input of leng... | nlp_Page_247_Chunk248 |
230 CHAPTER 10. CONTEXT-FREE PARSING that they didn’t understand could attach to the main verb (complained), or to the indi- rect object (the professor). • Coordination scope: e.g., “I see,” said the blind man, as he picked up the hammer and saw. In this example, the lexical ambiguity for saw enables it to be coordinat... | nlp_Page_248_Chunk249 |
10.2. AMBIGUITY 231 S VP NP PP NP chopsticks IN with NP sushi V eat NP We (a) system output S VP PP NP chopsticks IN with VP NP sushi V eat NP We (b) reference Figure 10.2: Two possible analyses from the grammar in Table 10.1 • VP →w2:5 is true positive as well. • NP →w3:5 is false positive, because it appears only in ... | nlp_Page_249_Chunk250 |
232 CHAPTER 10. CONTEXT-FREE PARSING A comparison of these probabilities would successfully resolve this case (Hindle and Rooth, 1993). Other cases, such as the example we eat sushi with chopsticks, require con- sidering the object of the preposition: consider the alternative we eat sushi with soy sauce. With sufficient... | nlp_Page_250_Chunk251 |
10.3. WEIGHTED CONTEXT-FREE GRAMMARS 233 ψ(·) exp ψ(·) S →NP VP 0 1 NP →NP PP −1 1 2 →we −2 1 4 →sushi −3 1 8 →chopsticks −3 1 8 PP →IN NP 0 1 IN →with 0 1 VP →V NP −1 1 2 →VP PP −2 1 4 →MD V −2 1 4 V →eat 0 1 Table 10.2: An example weighted context-free grammar (WCFG). The weights are chosen so that exp ψ(·) sums to o... | nlp_Page_251_Chunk252 |
234 CHAPTER 10. CONTEXT-FREE PARSING Algorithm 14 CKY algorithm for parsing a string w ∈Σ∗in a weighted context-free grammar (N, Σ, R, S), where N is the set of non-terminals and R is the set of weighted productions. The grammar is assumed to be in Chomsky normal form (§ 9.2.1). The function TRACEBACK is defined in Algo... | nlp_Page_252_Chunk253 |
10.3. WEIGHTED CONTEXT-FREE GRAMMARS 235 of the best sequence of labels in the Viterbi algorithm by tracing pointers backwards from the end of the trellis. Note that we need only store back-pointers for the best path to t[i, j, X]; this follows from the locality assumption that the global score for a parse is a combina... | nlp_Page_253_Chunk254 |
236 CHAPTER 10. CONTEXT-FREE PARSING Algorithm 15 Generative model for derivations from probabilistic context-free grammars in Chomsky Normal Form (CNF). procedure DRAWSUBTREE(X) sample (X →α) ∼p(α | X) if α = (Y Z) then return DRAWSUBTREE(Y ) ∪DRAWSUBTREE(Z) else return (X →α) ▷In CNF, all unary productions yield term... | nlp_Page_254_Chunk255 |
10.3. WEIGHTED CONTEXT-FREE GRAMMARS 237 with X ⇝wi+1:j indicating the event that non-terminal X yields the span wi+1, wi+2, . . . , wj. The recursive computation of t[i, j, X] is called the inside recurrence, because it computes the probability of each subtree as a combination of the probabilities of the smaller subtr... | nlp_Page_255_Chunk256 |
238 CHAPTER 10. CONTEXT-FREE PARSING production, and these scores do not depend on any other part of the derivation. For exam- ple, if two non-terminals are siblings, the scores of productions from these non-terminals are computed independently. This locality assumption is analogous to the first-order Markov assumption ... | nlp_Page_256_Chunk257 |
10.4. LEARNING WEIGHTED CONTEXT-FREE GRAMMARS 239 10.4.2 Feature-based parsing The scores for each production can be computed as an inner product of weights and fea- tures, ψ(X →α, (i, j, k)) = θ · f(X, α, (i, j, k), w), [10.21] where the feature vector f is a function of the left-hand side X, the right-hand side α, th... | nlp_Page_257_Chunk258 |
240 CHAPTER 10. CONTEXT-FREE PARSING Y Z wj+1 . . . wk X wi+1 . . . wj Y X wi+1 . . . wj Z wk+1 . . . wi Figure 10.3: The two cases faced by the outside recurrence in the computation of β(i, j, X) 10.4.3 *Conditional random field parsing The score of a derivation Ψ(τ) can be converted into a probability by normalizing o... | nlp_Page_258_Chunk259 |
10.4. LEARNING WEIGHTED CONTEXT-FREE GRAMMARS 241 β(i, j, X) is the score of having a phrase of type X covering the span (i + 1 : j), joint with the exterior context w1:i and wj+1:M. In a PCFG, this corresponds to the log probability log p((X, i + 1, j), w1:i, wj+1:M). Each outside variable is computed by the recurrenc... | nlp_Page_259_Chunk260 |
242 CHAPTER 10. CONTEXT-FREE PARSING 10.4.4 Neural context-free grammars Neural networks and can be applied to parsing by representing each span with a dense numerical vector (Socher et al., 2013; Durrett and Klein, 2015; Cross and Huang, 2016).4 For example, the anchor (i, j, k) and sentence w can be associated with a... | nlp_Page_260_Chunk261 |
10.5. GRAMMAR REFINEMENT 243 S VP NP PP NP NP NNP Italy CC and NP NNP France P from NN wine V likes NP PRP she S VP NP NP NNP Italy CC and NP PP NP NNP France P from NN wine V likes NP PRP she Figure 10.4: The left parse is preferable because of the conjunction of phrases headed by France and Italy, but these parses ca... | nlp_Page_261_Chunk262 |
244 CHAPTER 10. CONTEXT-FREE PARSING S VP NP NN bear DT the V heard NP she S VP-S NP-VP NN-NP bear DT-NP the VP-VP heard NP-S she Figure 10.5: Parent annotation in a CFG derivation of S. The observed statistics are (Johnson, 1998): Pr(NP →NP PP) =11% [10.35] Pr(NP under S →NP PP) =9% [10.36] Pr(NP under VP →NP PP) =23%... | nlp_Page_262_Chunk263 |
10.5. GRAMMAR REFINEMENT 245 VP(meet) PP(on) NP NN Monday P on NP(President) NN President DT the VB meet VP(meet) NP(President) PP(of) NP NN Mexico P of NP(President) NN President DT the VB meet (a) Lexicalization and attachment ambiguity NP(Italy) NP(Italy) NNS Italy CC and NP(wine) PP(from) NP(France) NNP France IN f... | nlp_Page_263_Chunk264 |
246 CHAPTER 10. CONTEXT-FREE PARSING Non-terminal Direction Priority S right VP SBAR ADJP UCP NP VP left VBD VBN MD VBZ TO VB VP VBG VBP ADJP NP NP right N* EX $ CD QP PRP . . . PP left IN TO FW Table 10.3: A fragment of head percolation rules for English (Magerman, 1995; Collins, 1997) Identifying head words The head ... | nlp_Page_264_Chunk265 |
10.5. GRAMMAR REFINEMENT 247 include symbols like NP(President) and VP(meet). Under this approach, the CKY parsing algorithm could be applied directly to the lexicalized production rules. However, the complexity would be cubic in the size of the vocabulary of terminal symbols, which would clearly be intractable. Anothe... | nlp_Page_265_Chunk266 |
248 CHAPTER 10. CONTEXT-FREE PARSING vanishingly small fraction of the possible lexicalized productions will be observed more than once.7 The Charniak (1997) and Collins (1997) parsers therefore focus on approxi- mating the probabilities of lexicalized productions, using various smoothing techniques and independence as... | nlp_Page_266_Chunk267 |
10.6. BEYOND CONTEXT-FREE PARSING 249 likely to modify verb phrases. Klein and Manning (2003) obtained a 2% improvement in F -MEASURE on a parent-annotated PCFG parser by making a single change: splitting the preposition category into six subtypes. They propose a series of linguistically-motivated refinements to the Pen... | nlp_Page_267_Chunk268 |
250 CHAPTER 10. CONTEXT-FREE PARSING Proper nouns NNP-14 Oct. Nov. Sept. NNP-12 John Robert James NNP-2 J. E. L. NNP-1 Bush Noriega Peters NNP-15 New San Wall NNP-3 York Francisco Street Personal Pronouns PRP-0 It He I PRP-1 it he they PRP-2 it them him Table 10.4: Examples of automatically refined non-terminals and som... | nlp_Page_268_Chunk269 |
10.6. BEYOND CONTEXT-FREE PARSING 251 rule (Socher et al., 2013), e.g., ui,j = f ΘX→Y Z ui,k uk,j [10.44] The overall score of the parse can then be computed from the final vector, Ψ(τ) = θu0,M. Reranking can yield substantial improvements in accuracy. The main limitation is that it can only find the best parse am... | nlp_Page_269_Chunk270 |
252 CHAPTER 10. CONTEXT-FREE PARSING Example Consider the input we eat sushi and the grammar in Table 10.1. The input can be parsed through the following sequence of actions: 1. Shift the first token we onto the stack. 2. Reduce the top item on the stack to NP, using the production NP →we. 3. Shift the next token eat on... | nlp_Page_270_Chunk271 |
10.6. BEYOND CONTEXT-FREE PARSING 253 CFG parsers are based on the shift-reduce architecture, rather than CKY. A recent gener- ation of models links shift-reduce parsing with recurrent neural networks, updating a hidden state vector while consuming the input (e.g., Cross and Huang, 2016; Dyer et al., 2016). Learning al... | nlp_Page_271_Chunk272 |
254 CHAPTER 10. CONTEXT-FREE PARSING S → NP VP VP → V NP NP → JJ NP NP → fish (the animal) V → fish (the action of fishing) JJ → fish (a modifier, as in fish sauce or fish stew) Apply the CKY algorithm and identify all possible parses for the sentence fish fish fish fish. 5. Choose one of the possible parses for the previous prob... | nlp_Page_272_Chunk273 |
10.6. BEYOND CONTEXT-FREE PARSING 255 S → V 0 S → N 0 S → J 0 V → VPref N -1 J → N JSuff 1 J → V JSuff 0 J → NegPref J 1 VPref → in+ 2 NegPref → in+ 1 N → flame 0 JSuff → +able 0 9. Use the inside and outside scores to compute the marginal probability p(Xi+1:j →Yi+1:k Zk+1:j | w), indicating that Y spans wi+1:k, Z spans... | nlp_Page_273_Chunk274 |
Chapter 11 Dependency parsing The previous chapter discussed algorithms for analyzing sentences in terms of nested con- stituents, such as noun phrases and verb phrases. However, many of the key sources of ambiguity in phrase-structure analysis relate to questions of attachment: where to attach a prepositional phrase o... | nlp_Page_275_Chunk275 |
258 CHAPTER 11. DEPENDENCY PARSING S(scratch) VP(scratch) PP(with) NP(claws) NNS claws IN with NP(people) NNS people VB scratch NP(cats) NNS cats DT The (a) lexicalized constituency parse The cats scratch people with claws (b) unlabeled dependency tree Figure 11.1: Dependency grammar is closely linked to lexicalized co... | nlp_Page_276_Chunk276 |
11.1. DEPENDENCY GRAMMAR 259 do we decide which is the head? Here are some possible criteria: • The head sets the syntactic category of the construction: for example, nouns are the heads of noun phrases, and verbs are the heads of verb phrases. • The modifier may be optional while the head is mandatory: for example, in ... | nlp_Page_277_Chunk277 |
260 CHAPTER 11. DEPENDENCY PARSING Abigail and Max like kimchi but not jook root nsubj obj cc conj conj cc advmod Figure 11.2: In the Universal Dependencies annotation system, the left-most item of a coordination is the head. I know New York pizza and this is not it !! nsubj compound compound obj cc nsubj cop advmod co... | nlp_Page_278_Chunk278 |
11.1. DEPENDENCY GRAMMAR 261 VP PP with a fork PP on the table NP dinner V ate (a) Flat VP PP with a fork VP PP on the table VP NP dinner V ate (b) Chomsky adjunction VP PP with a fork PP on the table VP NP dinner V ate (c) Two-level (PTB-style) ate dinner on the table with a fork (d) Dependency representation Figure 1... | nlp_Page_279_Chunk279 |
262 CHAPTER 11. DEPENDENCY PARSING % non-projective edges % non-projective sentences Czech 1.86% 22.42% English 0.39% 7.63% German 2.33% 28.19% Table 11.1: Frequency of non-projective dependencies in three languages (Kuhlmann and Nivre, 2010) Lucia ate a pizza yesterday which was vegetarian root nsubj obj det acl:relcl... | nlp_Page_280_Chunk280 |
11.2. GRAPH-BASED DEPENDENCY PARSING 263 First order h m Second order h s m g h m Third order g h s m h t s m Figure 11.6: Feature templates for higher-order dependency parsing Algorithms that search over this space of possible graphs are known as graph-based de- pendency parsers. In sequence labeling and constituent p... | nlp_Page_281_Chunk281 |
264 CHAPTER 11. DEPENDENCY PARSING 11.2.1 Graph-based parsing algorithms The distinction between projective and non-projective dependency trees (§ 11.1.3) plays a key role in the choice of algorithms. Because projective dependency trees are closely related to (and can be derived from) lexicalized constituent trees, lex... | nlp_Page_282_Chunk282 |
11.2. GRAPH-BASED DEPENDENCY PARSING 265 then applied recursively to the resulting graph, and process repeats until a graph without cycles is obtained. The time complexity of identifying the best incoming edge for each vertex is O(M2R), where M is the length of the input and R is the number of relations; in the worst c... | nlp_Page_283_Chunk283 |
266 CHAPTER 11. DEPENDENCY PARSING Each of these features can be conjoined with the dependency edge label r. Note that features in an arc-factored parser can refer to words other than wi and wj. The restriction is that the features consider only a single arc. Bilexical features (e.g., sushi →chopsticks) are powerful bu... | nlp_Page_284_Chunk284 |
11.2. GRAPH-BASED DEPENDENCY PARSING 267 described in § 7.6. The RNN hidden states at each word can be used as inputs to the arc scoring function (Kiperwasser and Goldberg, 2016). Feature-based arc scores are computationally expensive, due to the costs of storing and searching a huge table of weights. Neural arc scores... | nlp_Page_285_Chunk285 |
268 CHAPTER 11. DEPENDENCY PARSING prediction problem, using MIRA, an online margin-based learning algorithm. Neural arc scores can be learned in the same way, backpropagating from a margin loss to updates on the feedforward network that computes the score for each edge. A conditional random field for arc-factored depen... | nlp_Page_286_Chunk286 |
11.3. TRANSITION-BASED DEPENDENCY PARSING 269 parser from § 10.6.2, this representation consists of a stack, onto which parsing substruc- tures can be pushed and popped. In shift-reduce, these substructures were constituents; in the transition systems that follow, they will be projective dependency trees over partial s... | nlp_Page_287_Chunk287 |
270 CHAPTER 11. DEPENDENCY PARSING where we write i|β to indicate that i is the leftmost item in the input buffer, and σ|i to indicate the result of pushing i on to stack σ. • ARC-LEFT: create a new left-facing arc of type r between the item on the top of the stack and the first item in the input buffer. The head of thi... | nlp_Page_288_Chunk288 |
11.3. TRANSITION-BASED DEPENDENCY PARSING 271 σ β action arc added to A 1. [ROOT] they like bagels with lox SHIFT 2. [ROOT, they] like bagels with lox ARC-LEFT (they ←like) 3. [ROOT] like bagels with lox SHIFT 4. [ROOT, like] bagels with lox SHIFT 5. [ROOT, like, bagels] with lox SHIFT 6. [ROOT, like, bagels, with] lox... | nlp_Page_289_Chunk289 |
272 CHAPTER 11. DEPENDENCY PARSING σ β action arc added to A 1. [ROOT] they like bagels with lox SHIFT 2. [ROOT, they] like bagels with lox ARC-LEFT (they ←like) 3. [ROOT] like bagels with lox ARC-RIGHT (ROOT →like) 4. [ROOT, like] bagels with lox ARC-RIGHT (like →bagels) 5. [ROOT, like, bagels] with lox SHIFT 6. [ROOT... | nlp_Page_290_Chunk290 |
11.3. TRANSITION-BASED DEPENDENCY PARSING 273 t = 1 t = 2 t = 3 t = 4 t = 5 [Root] they can fish [Root, they] can fish [Root, they] fish [Root, can] ∅ [Root] ∅ [Root, can] fish [Root, fish] ∅ [Root] ∅ Shift Arc-Right Arc-Left Arc-Right Arc-Left Arc-Right Arc-Right Figure 11.7: Beam search for... | nlp_Page_291_Chunk291 |
274 CHAPTER 11. DEPENDENCY PARSING element on the stack; the word and part-of-speech of the first, second, and third elements on the input buffer; pairs and triples of words and parts-of-speech from the top of the stack and the front of the buffer; the distance (in tokens) between the element on the top of the stack and... | nlp_Page_292_Chunk292 |
11.3. TRANSITION-BASED DEPENDENCY PARSING 275 Oracle-based training A transition system can be viewed as a function from action sequences (derivations) to parse trees. The inverse of this function is a mapping from parse trees to derivations, which is called an oracle. For the arc-standard and arc-eager parsing system,... | nlp_Page_293_Chunk293 |
276 CHAPTER 11. DEPENDENCY PARSING error. A classifier that is trained on a local objective function will learn to always choose a1, but choosing a2 would minimize the overall number of errors. This observation motivates a global objective, such as the globally-normalized condi- tional likelihood, p(A(i) | w; θ) = exp P... | nlp_Page_294_Chunk294 |
11.4. APPLICATIONS 277 this can be achieved only by using SHIFT for the first two actions. At t = 3, the oracle action sequence has fallen off the beam. The parser should therefore stop, and update the parameters by the gradient ∂ ∂θL(A(i) 1:3, {A(k) 1:3}; θ), where A(i) 1:3 is the first three actions of the oracle seque... | nlp_Page_295_Chunk295 |
278 CHAPTER 11. DEPENDENCY PARSING Figure 11.8: Google n-grams results for the bigram write code and the dependency arc write => code (and their morphological variants) in chapter 17. The goal of relation extraction is to identify entity pairs, such as (MELVILLE, MOBY-DICK) (TOLSTOY, WAR AND PEACE) (MARQU´EZ, 100 YEARS... | nlp_Page_296_Chunk296 |
11.4. APPLICATIONS 279 (11.3) There is no reason at all to believe the polluters will suddenly become reasonable. By tracking the sentiment polarity through the dependency parse, we can better iden- tify the overall polarity of the sentence, determining when key sentiment words are re- versed (Wilson et al., 2005; Naka... | nlp_Page_297_Chunk297 |
280 CHAPTER 11. DEPENDENCY PARSING 3. In arc-factored dependency parsing of an input of length M, the score of a parse is the sum of M scores, one for each arc. In second order dependency parsing, the total score is the sum over many more terms. How many terms are the score of the parse for Figure 11.2, using a second-... | nlp_Page_298_Chunk298 |
11.4. APPLICATIONS 281 9. Count all pairs of words grouped by the CONJ relation. Select all pairs of words (i, j) for which i and j each participate in CONJ relations at least five times. Compute and sort by the pointwise mutual information, which is defined in § 14.3 as, PMI(i, j) = log p(i, j) p(i)p(j). [11.31] Here, p... | nlp_Page_299_Chunk299 |
Part III Meaning 283 | nlp_Page_301_Chunk300 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.