text stringlengths 1 7.76k | source stringlengths 17 81 |
|---|---|
386 CHAPTER 16. DISCOURSE • TEMPORAL – Asynchronous – Synchronous: precedence, succession • CONTINGENCY – Cause: result, reason – Pragmatic cause: justification – Condition: hypothetical, general, unreal present, unreal past, real present, real past – Pragmatic condition: relevance, implicit assertion • COMPARISON – Con... | nlp_Page_404_Chunk401 |
16.3. RELATIONS 387 (16.4) . . .as this business of whaling has somehow come to be regarded among landsmen as a rather unpoetical and disreputable pursuit; therefore, I am all anxiety to convince ye, ye landsmen, of the injustice hereby done to us hunters of whales. (16.5) But a few funds have taken other defensive ste... | nlp_Page_405_Chunk402 |
388 CHAPTER 16. DISCOURSE to a nonlinear classifier: z(i) =Encode(w(i)) [16.7] z(i+1) =Encode(w(i+1)) [16.8] ˆyi = argmax y Ψ(y, z(i), z(i+1)). [16.9] This basic framework can be instantiated in several ways, including both feature-based and neural encoders. Feature-based approaches Each argument can be encoded into a v... | nlp_Page_406_Chunk403 |
16.3. RELATIONS 389 16.3.2 Hierarchical discourse relations In sentence parsing, adjacent phrases combine into larger constituents, ultimately pro- ducing a single constituent for the entire sentence. The resulting tree structure enables structured analysis of the sentence, with subtrees that represent syntactically co... | nlp_Page_407_Chunk404 |
390 CHAPTER 16. DISCOURSE Concession Justify Conjunction Elaboration Justify Conjunction [It could have been a great movie]1A [It does have beautiful scenery,]1B [some of the best since Lord of the Rings.]1C [The acting is well done,]1D [and I really liked the son of the leader of the Samurai.]1E [He was a likable chap... | nlp_Page_408_Chunk405 |
16.3. RELATIONS 391 Hierarchical discourse parsing The goal of discourse parsing is to recover a hierarchical structural analysis from a doc- ument text, such as the analysis in Figure 16.5. For now, let’s assume a segmentation of the document into elementary discourse units (EDUs); segmentation algorithms are dis- cus... | nlp_Page_409_Chunk406 |
392 CHAPTER 16. DISCOURSE ning i + 1 : j, and this violates the locality assumption that underlie CKY’s optimality guarantee. Bottom-up parsing with recursively constructed span representations is gen- erally not guaranteed to find the best-scoring discourse parse. This problem is explored in an exercise at the end of t... | nlp_Page_410_Chunk407 |
16.3. RELATIONS 393 join any number of vertices. This can be seen by introducing another sentence into the example: (16.12) [In principle it is possible to clean it up,]S3 [but according to the mayor that is too expensive.]S4 S3 acknowledges the validity of S2, but undercuts its support of S1. This can be repre- sented... | nlp_Page_411_Chunk408 |
394 CHAPTER 16. DISCOURSE of the text, and is therefore more important to include in an extractive summary (Marcu, 1997a).10 This insight can be generalized from individual relations using the concept of discourse depth (Hirao et al., 2013): for each elementary discourse unit e, the discourse depth de is the number of ... | nlp_Page_412_Chunk409 |
16.3. RELATIONS 395 h a b d e c f g Figure 16.6: A discourse depth tree (Hirao et al., 2013) for the discourse parse from Fig- ure 16.5, in which each elementary discourse unit is connected to its parent. The discourse units in one valid summary are underlined. mization problem in 16.11 can be solved with integer linea... | nlp_Page_413_Chunk410 |
396 CHAPTER 16. DISCOURSE discourse unit is computed from its arguments and from a parameter correspond- ing to the discourse relation (Ji and Smith, 2017). Shallow, non-hierarchical discourse relations have also been applied to document clas- sification. One approach is to impose a set of constraints on the analyses of... | nlp_Page_414_Chunk411 |
16.3. RELATIONS 397 • Discourse relations should be signaled by connectives that are appropriate to the semantic or functional relationship between the arguments: for example, a coherent text would be more likely to use however to signal a COMPARISON relation than a temporal relation (Kibble and Power, 2004). • Discour... | nlp_Page_415_Chunk412 |
398 CHAPTER 16. DISCOURSE Exercises 1. Some discourse connectives tend to occur between their arguments; others can pre- cede both arguments, and a few can follow both arguments. Indicate whether the following connectives can occur between, before, and after their arguments: how- ever, but, while (contrastive, not temp... | nlp_Page_416_Chunk413 |
16.3. RELATIONS 399 of K segments maximizing the sum of log-probabilities PK k=1 ψα(sk−1, sk), where sk indexes the last token of segment k, and s0 = 0. The time complexity of your dynamic program should not be worse than quadratic in the length of the input and linear in the number of segments. 5. Building on the prev... | nlp_Page_417_Chunk414 |
400 CHAPTER 16. DISCOURSE 9. Both lexical consistency and discourse connectives contribute to the cohesion of a text. We might therefore expect adjacent sentences that are joined by explicit dis- course connectives to also have higher word overlap. Using the Brown corpus, test this theory by computing the average cosin... | nlp_Page_418_Chunk415 |
Part IV Applications 401 | nlp_Page_419_Chunk416 |
Chapter 17 Information extraction Computers offer powerful capabilities for searching and reasoning about structured records and relational data. Some have argued that the most important limitation of artificial in- telligence is not inference or learning, but simply having too little knowledge (Lenat et al., 1990). Nat... | nlp_Page_421_Chunk417 |
404 CHAPTER 17. INFORMATION EXTRACTION (a) A Wikipedia infobox (17.1) In the Aeroplane Over the Sea is the second and final studio album by the American indie rock band Neutral Milk Hotel. (17.2) It was released in the United States on February 10, 1998 on Merge Records and :::: May::::: 1998 on :::: Blue::::: Rose:::::... | nlp_Page_422_Chunk418 |
17.1. ENTITIES 405 (was the album released on MERGE RECORDS or BLUE ROSE RECORDS?), requiring rea- soning across the entire dataset. In addition to the basic tasks of recognizing entities, relations, and events, information extraction systems must handle negation, and must be able to distinguish statements of fact from... | nlp_Page_423_Chunk419 |
406 CHAPTER 17. INFORMATION EXTRACTION different towns and cities, five United States Navy vessels, a magazine, a television show, a band, and a singer — each prominent enough to have its own Wikipedia page. We now consider how to choose among these dozens of possibilities. In this chapter we will focus on supervised ap... | nlp_Page_424_Chunk420 |
17.1. ENTITIES 407 • The similarity of the mention string to the canonical entity name, as quantified by string similarity. This feature would elevate the city ATLANTA over the basketball team ATLANTA HAWKS for the string Atlanta. • The popularity of the entity, which can be measured by Wikipedia page views or PageRank ... | nlp_Page_425_Chunk421 |
408 CHAPTER 17. INFORMATION EXTRACTION on the text of Wikipedia, with hyperlinks substituted for the anchor text.3 • The embedding of the mention x can be computed by averaging the embeddings of the words in the mention (Yang et al., 2016), or by the compositional techniques described in § 14.8. • The embedding of the ... | nlp_Page_426_Chunk422 |
17.1. ENTITIES 409 preference for coherence motivates collectively linking these references to the first three U.S. presidents. A general approach to collective entity linking is to introduce a compatibility score ψc(y). Collective entity linking is then performed by optimizing the global objective, ˆy = argmax y∈Y(x) Ψ... | nlp_Page_427_Chunk423 |
410 CHAPTER 17. INFORMATION EXTRACTION Algorithm 18 WARP approximate ranking loss 1: procedure WARP(y(i), x(i)) 2: N ←0 3: repeat 4: Randomly sample y ∼Y(x(i)) 5: N ←N + 1 6: if ψ(y, x(i)) + 1 > ψ(y(i), x(i)) then ▷check for margin violation 7: r ← |Y(x(i))|/N ▷compute approximate rank 8: return Lrank(r) × (ψ(y, x(... | nlp_Page_428_Chunk424 |
17.2. RELATIONS 411 margin-augmented rank, and the violation of the margin constraint, ℓ(y(i), x(i)) =Lrank(r(y(i), x(i))) r(y(i), x(i)) X y∈Y(x)\y(i) ψ(y, x(i)) −ψ(y(i), x(i)) + 1 + , [17.8] The sum in Equation 17.8 includes non-zero values for every label that is ranked at least as high as the true entity, after ... | nlp_Page_429_Chunk425 |
412 CHAPTER 17. INFORMATION EXTRACTION CAUSE-EFFECT those cancers were caused by radiation exposures INSTRUMENT-AGENCY phone operator PRODUCT-PRODUCER a factory manufactures suits CONTENT-CONTAINER a bottle of honey was weighed ENTITY-ORIGIN letters from foreign countries ENTITY-DESTINATION the boy went to bed COMPONEN... | nlp_Page_430_Chunk426 |
17.2. RELATIONS 413 17.2.2 Relation extraction as a classification task Relation extraction can be formulated as a classification problem, ˆr(i,j),(m,n) = argmax r∈R Ψ(r, (i, j), (m, n), w), [17.11] where r ∈R is a relation type (possibly NIL), wi+1:j is the span of the first argument, and wm+1:n is the span of the second... | nlp_Page_431_Chunk427 |
414 CHAPTER 17. INFORMATION EXTRACTION 1. George Bush traveled to France George Bush ← NSUBJtraveled → OBLFrance 2. Ahab traveled to Nantucket Ahab ← NSUBJtraveled→ OBLNantucket 3. George Bush will travel to France George Bush ← NSUBJtravel → OBLFrance 4. George Bush wants to travel to France George Bush ← NSUBJwants →... | nlp_Page_432_Chunk428 |
17.2. RELATIONS 415 equal to the similarity of the root nodes and the sum of similarities of matched pairs of child subtrees (Zelenko et al., 2003; Culotta and Sorensen, 2004). Alternatively, Bunescu and Mooney (2005) define a kernel function over sequences of unlabeled dependency edges, in which the score is computed a... | nlp_Page_433_Chunk429 |
416 CHAPTER 17. INFORMATION EXTRACTION right subpaths: the path George Bush ← NSUBJwants → XCOMPtravel → OBLFrance is segmented into the subpaths, George Bush ← NSUBJwants and wants → XCOMPtravel → OBLFrance. In each path, a recurrent neural network is run from the argument to the root word (in this case, wants). The fi... | nlp_Page_434_Chunk430 |
17.2. RELATIONS 417 retrieval phase, in which relevant passages of text are obtained by search. • For many entity pairs, there will be multiple passages of text that provide evidence. Slot filling systems must aggregate this evidence to predict a single relation type (or set of relations). • Labeled data is usually avai... | nlp_Page_435_Chunk431 |
418 CHAPTER 17. INFORMATION EXTRACTION that are detected with high confidence in multiple documents are more likely to be valid, motivating the heuristic, ψ(r, e1, e2) = N X i=1 (p(r(e1, e2) | w(i)))α, [17.21] where p(r(e1, e2) | w(i)) is the probability of relation r between entities e1 and e2 condi- tioned on the text... | nlp_Page_436_Chunk432 |
17.2. RELATIONS 419 • Label : MAYOR(ATLANTA, MAYNARD JACKSON) – Elected mayor of Atlanta in 1973, Maynard Jackson ... – Atlanta’s airport will be renamed to honor Maynard Jackson, the city’s first Black mayor – Born in Dallas, Texas in 1938, Maynard Holbrook Jackson, Jr. moved to Atlanta when he was 8. • Label : MAYOR(N... | nlp_Page_437_Chunk433 |
420 CHAPTER 17. INFORMATION EXTRACTION Task Relation ontology Supervision PropBank semantic role labeling VerbNet sentence FrameNet semantic role labeling FrameNet sentence Relation extraction ACE, TAC, SemEval, etc sentence Slot filling ACE, TAC, SemEval, etc relation Open Information Extraction open seed relations or ... | nlp_Page_438_Chunk434 |
17.3. EVENTS 421 with four properties: the office (MAYOR), the district (ATLANTA), the date (1973), and the person elected (MAYNARD JACKSON, JR.). In event detection, a schema is provided for each event type (e.g., an election, a terrorist attack, or a chemical reaction), indicating all the possible properties of the ev... | nlp_Page_439_Chunk435 |
422 CHAPTER 17. INFORMATION EXTRACTION Positive (+) Negative (-) Underspecified (u) Certain (CT) Fact: CT+ Counterfact: CT- Certain, but unknown: CTU Probable (PR) Probable: PR+ Not probable: PR- (NA) Possible (PS) Possible: PS+ Not possible: PS- (NA) Underspecified (U) (NA) (NA) Unknown or uncommitted: UU Table 17.4: Ta... | nlp_Page_440_Chunk436 |
17.4. HEDGES, DENIALS, AND HYPOTHETICALS 423 Modality refers to expressions of the speaker’s attitude towards her own statements, in- cluding “degree of certainty, reliability, subjectivity, sources of information, and perspec- tive” (Morante and Sporleder, 2012). Various systematizations of modality have been proposed... | nlp_Page_441_Chunk437 |
424 CHAPTER 17. INFORMATION EXTRACTION match lexical cues (e.g., Norwood was not elected Mayor), while avoiding “double nega- tives” (e.g., surely all this is not without meaning). Supervised techniques involve classi- fiers over lexical and syntactic features (Uzuner et al., 2009) and sequence labeling (Prab- hakaran e... | nlp_Page_442_Chunk438 |
17.5. QUESTION ANSWERING AND MACHINE READING 425 would be converted to, λx.∃y CAPITAL(GEORGIA, y) ∧MAYOR(y, x). [17.22] This lambda expression can then be used to query an existing knowledge base, returning “true” for all entities that satisfy it. 17.5.2 Machine reading Recent work has focused on answering questions ab... | nlp_Page_443_Chunk439 |
426 CHAPTER 17. INFORMATION EXTRACTION quantities existing documents. An additional constraint is that that missing element from the cloze must appear in the main passage of text: for example, in Who-did- What, the candidates include all entities mentioned in the main passage. In the CNN/Daily Mail dataset, each entity... | nlp_Page_444_Chunk440 |
17.5. QUESTION ANSWERING AND MACHINE READING 427 The attention vector is computed as a softmax over a vector of bilinear products, and the expected representation is computed by summing over attention values, ˜αm =(u(q))⊤Wah(p) m [17.26] α =SoftMax( ˜α) [17.27] o = M X m=1 αmh(p) m . [17.28] Each candidate answer c is ... | nlp_Page_445_Chunk441 |
428 CHAPTER 17. INFORMATION EXTRACTION • Among all entities that have the same type as the mention (e.g., LOC, PER), choose the one whose name has the lowest edit distance from the mention. • If more than one entity has the right type and the lowest edit distance from the mention, choose the most popular one. • If no c... | nlp_Page_446_Chunk442 |
17.5. QUESTION ANSWERING AND MACHINE READING 429 c) Preprocess the Reuters data by running a named entity recognizer, replacing tokens with named entity spans when applicable — e.g., your pattern can now match on the United States if the NER system tags it. Apply your PRESIDENT matcher to this preprocessed data. Does t... | nlp_Page_447_Chunk443 |
430 CHAPTER 17. INFORMATION EXTRACTION 9. Consider the neural QA system described in § 17.5.2, but restrict the set of candidate answers to words in the passage, and set each candidate answer embedding x equal to the vector h(p) m , representing token m in the passage, so that ˆm = argmaxm o·h(p) m . Suppose the system... | nlp_Page_448_Chunk444 |
Chapter 18 Machine translation Machine translation (MT) is one of the “holy grail” problems in artificial intelligence, with the potential to transform society by facilitating communication between people anywhere in the world. As a result, MT has received significant attention and funding since the early 1950s. However,... | nlp_Page_449_Chunk445 |
432 CHAPTER 18. MACHINE TRANSLATION source target text syntax semantics interlingua Figure 18.1: The Vauquois Pyramid translation models, decoding is NP-hard (Knight, 1999). Approaches for dealing with this complexity are described in § 18.4. Estimating translation models is difficult as well. Labeled translation data u... | nlp_Page_450_Chunk446 |
18.1. MACHINE TRANSLATION AS A TASK 433 Adequate? Fluent? To Vinay it like Python yes no Vinay debugs memory leaks no yes Vinay likes Python yes yes Table 18.1: Adequacy and fluency for translations of the Spanish sentence A Vinay le gusta Python. and semantic understanding may still be a promising path, if the resultin... | nlp_Page_451_Chunk447 |
434 CHAPTER 18. MACHINE TRANSLATION Translation p1 p2 p3 p4 BP BLEU Reference Vinay likes programming in Python Sys1 To Vinay it like to program Python 2 7 0 0 0 1 .21 Sys2 Vinay likes Python 3 3 1 2 0 0 .51 .33 Sys3 Vinay likes programming in his pajamas 4 6 3 5 2 4 1 3 1 .76 Figure 18.2: A reference translation and t... | nlp_Page_452_Chunk448 |
18.1. MACHINE TRANSLATION AS A TASK 435 groups. Worse, machine learning can amplify biases in data (Bolukbasi et al., 2016): if a dataset has even a slight tendency towards men as doctors, the resulting translation model may produce translations in which doctors are always he, and nurses are always she. Other metrics A... | nlp_Page_453_Chunk449 |
436 CHAPTER 18. MACHINE TRANSLATION the possibility of automatically identifying parallel sentence pairs from unaligned parallel texts, such as web pages and Wikipedia articles (Kilgarriff and Grefenstette, 2003; Resnik and Smith, 2003; Adafre and De Rijke, 2006). Another approach is to create large parallel corpora th... | nlp_Page_454_Chunk450 |
18.2. STATISTICAL MACHINE TRANSLATION 437 A Vinay le gusta python Vinay likes python Figure 18.3: An example word-to-word alignment 18.2.1 Statistical translation modeling The simplest decomposition of the translation model is word-to-word: each word in the source should be aligned to a word in the translation. This ap... | nlp_Page_455_Chunk451 |
438 CHAPTER 18. MACHINE TRANSLATION • The alignment probability factors across tokens, p(A | w(s), w(t)) = M(s) Y m=1 p(am | m, M(s), M(t)). [18.11] This means that each alignment decision is independent of the others, and depends only on the index m, and the sentence lengths M(s) and M(t). • The translation probabilit... | nlp_Page_456_Chunk452 |
18.2. STATISTICAL MACHINE TRANSLATION 439 where count(u, v) is the count of instances in which word v was aligned to word u in the training set, and count(u) is the total count of the target word u. The smoothing techniques mentioned in chapter 6 can help to reduce the variance of these probability estimates. Conversel... | nlp_Page_457_Chunk453 |
440 CHAPTER 18. MACHINE TRANSLATION Nous allons prendre une verre We’ll have a drink Figure 18.4: A phrase-based alignment between French and English, corresponding to example (18.3) The line we will take a glass is the word-for-word gloss of the French sentence; the transla- tion we’ll have a drink is shown on the thi... | nlp_Page_458_Chunk454 |
18.2. STATISTICAL MACHINE TRANSLATION 441 18.2.4 *Syntax-based translation The Vauquois Pyramid (Figure 18.1) suggests that translation might be easier if we take a higher-level view. One possibility is to incorporate the syntactic structure of the source, the target, or both. This is particularly promising for languag... | nlp_Page_459_Chunk455 |
442 CHAPTER 18. MACHINE TRANSLATION are then assembled into a translation (Yamada and Knight, 2001; Galley et al., 2004); in tree-to-string translation, the source side is parsed, and then transformed into a string on the target side (Liu et al., 2006). A key question for syntax-based translation is the extent to which... | nlp_Page_460_Chunk456 |
18.3. NEURAL MACHINE TRANSLATION 443 h(s,D) m−1 h(s,D) m h(s,D) m+1 . . . . . . . . . h(s,2) m−1 h(s,2) m h(s,2) m+1 h(s,1) m−1 h(s,1) m h(s,1) m+1 x(s) m−1 x(s) m x(s) m+1 Figure 18.5: A deep bidirectional LSTM encoder memory (LSTM) (see § 6.3.3) on the source sentence: h(s) m =LSTM(x(s) m , h(s) m−1) [18.29] z ≜h(s) ... | nlp_Page_461_Chunk457 |
444 CHAPTER 18. MACHINE TRANSLATION as the input to an LSTM at layer i + 1: h(s,1) m =LSTM(x(s) m , h(s) m−1) [18.33] h(s,i+1) m =LSTM(h(s,i) m , h(s,i+1) m−1 ), ∀i ≥1. [18.34] The original work on sequence-to-sequence translation used four layers; in 2016, Google’s commercial machine translation system used eight laye... | nlp_Page_462_Chunk458 |
18.3. NEURAL MACHINE TRANSLATION 445 Output activation α Query ψα Key Value Figure 18.6: A general view of neural attention. The dotted box indicates that each αm→n can be viewed as a gate on value n. operation is differentiable. For each key n in the memory, we compute a score ψα(m, n) with respect to the query m. Tha... | nlp_Page_463_Chunk459 |
446 CHAPTER 18. MACHINE TRANSLATION Sigmoid attention αm→n = σ (ψα(m, n)) [18.38] The attention α is then used to compute a context vector cm by taking a weighted average over the columns of Z, cm = M(s) X n=1 αm→nzn, [18.39] where αm→n ∈[0, 1] is the amount of attention from word m of the target to word n of the sourc... | nlp_Page_464_Chunk460 |
18.3. NEURAL MACHINE TRANSLATION 447 z(i) α(i) m→ ψ(i) α (m, ·) h(i−1) m −1 m m + 1 k q v Figure 18.7: The transformer encoder’s computation of z(i) m from h(i−1). The key, value, and query are shown for token m −1. For example, ψ(i) α (m, m −1) is computed from the key Θkh(i−1) m−1 and the query Θqh(i−1) m , and the g... | nlp_Page_465_Chunk461 |
448 CHAPTER 18. MACHINE TRANSLATION Source: The ecotax portico in Pont-de-buis was taken down on Thursday morning Reference: Le portique ´ecotaxe de Pont-de-buis a ´et´e d´emont´e jeudi matin System: Le unk de unk `a unk a ´et´e pris le jeudi matin Figure 18.8: Translation with unknown words. The system outputs unk to ... | nlp_Page_466_Chunk462 |
18.4. DECODING 449 While compounds could in principle be addressed by better tokenization (see § 8.4), other morphological processes involve more complex transformations of subword units. Names and technical terms can be handled in a postprocessing step: after first identi- fying alignments between unknown words in the ... | nlp_Page_467_Chunk463 |
450 CHAPTER 18. MACHINE TRANSLATION models in either statistical or neural machine translation. Today’s state-of-the-art transla- tion systems use beam search (see § 11.3.1), which is an incremental decoding algorithm that maintains a small constant number of competitive hypotheses. Such greedy approxi- mations are rea... | nlp_Page_468_Chunk464 |
18.5. TRAINING TOWARDS THE EVALUATION METRIC 451 Beam search Beam search is a general technique for avoiding search errors when ex- haustive search is impossible; it was first discussed in § 11.3.1. Beam search can be seen as a variant of the incremental decoding algorithm sketched in Equation 18.50, but at each step m,... | nlp_Page_469_Chunk465 |
452 CHAPTER 18. MACHINE TRANSLATION the parameters θ that minimize the error of the system’s preferred translation, ˆw(t) = argmax w(t) Ψ(w(t), w(s); θ) [18.51] ˆθ = argmin θ ∆( ˆw(t), w(s)) [18.52] However, identifying the top-scoring translation ˆw(t) is usually intractable, as described in the previous section. In m... | nlp_Page_470_Chunk466 |
18.5. TRAINING TOWARDS THE EVALUATION METRIC 453 approximated as (Shen et al., 2016), ˜R(θ) ≈1 Z K X k=1 ˜p(w(t) k | w(s); θ, α) × ∆(w(t) k , w(t)) [18.57] Z = K X k=1 ˜p(w(t) k | w(s); θ, α). [18.58] Shen et al. (2016) report that performance plateaus at K = 100 for minimum risk training of neural machine translation.... | nlp_Page_471_Chunk467 |
454 CHAPTER 18. MACHINE TRANSLATION TENSOR2TENSOR is an implementation of several of the Google translation models in TEN- SORFLOW (Abadi et al., 2016). Literary translation is especially challenging, even for expert human translators. Mes- sud (2014) describes some of these issues in her review of an English translati... | nlp_Page_472_Chunk468 |
18.5. TRAINING TOWARDS THE EVALUATION METRIC 455 (18.4) It is not down on any map; true places never are. Then translate each result back into English. Which is closer to the original? Can you explain the differences? 2. Compute the unsmoothed n-gram precisions p1 . . . p4 for the two back-translations in the previous ... | nlp_Page_473_Chunk469 |
456 CHAPTER 18. MACHINE TRANSLATION 8. Apply byte-pair encoding for the vocabulary it, unit, unite, until no bigram appears more than once. 9. This problem relates to the complexity of machine translation. Suppose you have an oracle that returns the list of words to include in the translation, so that your only task is... | nlp_Page_474_Chunk470 |
Chapter 19 Text generation In many of the most interesting problems in natural language processing, language is the output. The previous chapter described the specific case of machine translation, but there are many other applications, from summarization of research articles, to automated journalism, to dialogue systems... | nlp_Page_475_Chunk471 |
458 CHAPTER 19. TEXT GENERATION Temperature time min mean max 06:00-21:00 9 15 21 Cloud sky cover time percent (%) 06:00-09:00 25-50 09:00-12:00 50-75 Wind speed time min mean max 06:00-21:00 15 20 30 Wind direction time mode 06:00-21:00 S Cloudy, with temperatures between 10 and 20 degrees. South wind around 20 mph. F... | nlp_Page_476_Chunk472 |
19.1. DATA-TO-TEXT GENERATION 459 (a / admire-01 :ARG0 (v / visitor :ARG1-of (c / arrive-01 :ARG4 (j / Japan))) :ARG1 (m / "Mount Fuji")) • Visitors who came to Japan admire Mount Fuji. • Visitors who came in Japan admire Mount Fuji. • Mount Fuji is admired by the visitor who came in Japan. Figure 19.2: Abstract meanin... | nlp_Page_477_Chunk473 |
460 CHAPTER 19. TEXT GENERATION written as sum of local scores (Angeli et al., 2010): Ψ(w, y; θ) = M X m=1 ψw,y(wm, yzm) + ψw(wm, wm−1) + ψz(zm, zm−1), [19.3] where ψw can represent a bigram language model, and ψz can be tuned to reward coher- ence, such as the use of related records in nearby words. 1 The parameters o... | nlp_Page_478_Chunk474 |
19.1. DATA-TO-TEXT GENERATION 461 Figure 19.3: Examples of the image captioning task, with attention masks shown for each of the underlined words (Xu et al., 2015). Sequences Some types of structured records have a natural ordering, such as events in a game (Chen and Mooney, 2008) and steps in a recipe (Tutin and Kittr... | nlp_Page_479_Chunk475 |
462 CHAPTER 19. TEXT GENERATION a 20 % chance of showers and thunderstorms after noon . mostly cloudy with a high near 71 . id-0: temperature(min=52,max=71,mean=63) id-2: windSpeed(min=8,mean=17,max=23) id-5: skyCover(mode=50-75) id-10: precipChance(min=19,mean=32,max=73) id-15: thunderChance(mode=SChc) Figure 19.4: Ne... | nlp_Page_480_Chunk476 |
19.1. DATA-TO-TEXT GENERATION 463 Various modifications to this basic mechanism have been proposed. In coarse-to-fine attention (Mei et al., 2016), each record receives a global attention ar ∈[0, 1], which is independent of the decoder state. This global attention, which represents the overall importance of the record, i... | nlp_Page_481_Chunk477 |
464 CHAPTER 19. TEXT GENERATION of the data, cm = PR r=1 αm→rzr, πm = σ(Θ(2)f(Θ(1)[h(t) m−1; cm])). [19.9] The full generative probability at token m is then, p(w(t) | w(t) 1:m, Z) =πm × exp βw(t) · h(t) m−1 PV j=1 exp βj · h(t) m−1 | {z } generate +(1 −πm) × R X r=1 δ(w(s) r = w(t)) × αm→r | {z } copy . [19.10] 19.2 T... | nlp_Page_482_Chunk478 |
19.2. TEXT-TO-TEXT GENERATION 465 Sentence summarization is closely related to sentence compression, in which the sum- mary is produced by deleting words or phrases from the original (Clarke and Lapata, 2008). But as shown in (19.2b), a sentence summary can also introduce new words, such as against, which replaces the ... | nlp_Page_483_Chunk479 |
466 CHAPTER 19. TEXT GENERATION (19.3) a. Palin actually turned against the bridge project only after it became a national symbol of wasteful spending. b. Ms. Palin supported the bridge project while running for governor, and abandoned it after it became a national scandal. An intersection preserves only the content th... | nlp_Page_484_Chunk480 |
19.3. DIALOGUE 467 (19.6) A: I want to order a pizza. B: What toppings? A: Anchovies. B: Ok, what address? A: The College of Computing building. B: Please confirm: one pizza with artichokes, to be delivered to the College of Computing building. A: No. B: What toppings? . . . q0 start q1 q2 q3 q4 q5 q6 What toppings? Top... | nlp_Page_485_Chunk481 |
468 CHAPTER 19. TEXT GENERATION prefer to communicate more naturally, with phrases like I’d, uh, like some anchovies please. One approach to handling such utterances is to design a custom grammar, with non- terminals for slots such as TOPPING and LOCATION. However, context-free parsing of unconstrained speech input is ... | nlp_Page_486_Chunk482 |
19.3. DIALOGUE 469 result in a transition to the terminal state if the topping is not yet known. This probability distribution over state transitions may be learned from data, or it may be specified in advance. • Each state-action-state tuple earns a reward, ra(st, st+1). In the context of the pizza ordering system, a s... | nlp_Page_487_Chunk483 |
470 CHAPTER 19. TEXT GENERATION of the topping (PEACHES). In a partially observable Markov decision process (POMDP), the system receives an observation o, which is probabilistically conditioned on the state, p(o | s). It must therefore maintain a distribution of beliefs about which state it is in, with qt(s) indicating... | nlp_Page_488_Chunk484 |
19.3. DIALOGUE 471 set of specialized modules: one for recognizing the user input, another for deciding what action to take, and a third for arranging the text of the system output. Recurrent neural network decoders can be integrated into Markov Decision Process dialogue systems, by conditioning the decoder on a repres... | nlp_Page_489_Chunk485 |
472 CHAPTER 19. TEXT GENERATION mention the same first three elements of the box score? Do your templates capture how these elements are expressed in the text? 2. This exercise is to be done by a pair of students. One student should choose an article from the news or from Wikipedia, and manually perform semantic role la... | nlp_Page_490_Chunk486 |
19.3. DIALOGUE 473 7. In § 19.3.2, we considered a pizza delivery service. Let’s simplify the problem to take-out, where it is only necessary to determine the topping and confirm the order. The state is a tuple in which the first element is T if the topping is specified and ? otherwise, and the second element is either YE... | nlp_Page_491_Chunk487 |
Appendix A Probability Probability theory provides a way to reason about random events. The sorts of random events that are typically used to explain probability theory include coin flips, card draws, and the weather. It may seem odd to think about the choice of a word as akin to the flip of a coin, particularly if you a... | nlp_Page_493_Chunk488 |
476 APPENDIX A. PROBABILITY For any event A, there is a complement ¬A, such that: • The probability of the union A ∪¬A is Pr(A ∪¬A) = 1; • The intersection A ∩¬A = ∅is the empty set, and Pr(A ∩¬A) = 0. In the coin flip example, the event of obtaining a single head on two flips corresponds to the set of outcomes {HT, TH};... | nlp_Page_494_Chunk489 |
A.2. CONDITIONAL PROBABILITY AND BAYES’ RULE 477 A B A ∩B Figure A.1: A visualization of the probability of non-disjoint events A and B. A.1.2 Law of total probability A set of events B = {B1, B2, . . . , BN} is a partition of the sample space iff each pair of events is disjoint (Bi ∩Bj = ∅), and the union of the event... | nlp_Page_495_Chunk490 |
478 APPENDIX A. PROBABILITY a rearrangement of terms from Equation A.12. The chain rule can be applied repeatedly: Pr(A ∩B ∩C) = Pr(A | B ∩C) × Pr(B ∩C) = Pr(A | B ∩C) × Pr(B | C) × Pr(C). Bayes’ rule (sometimes called Bayes’ law or Bayes’ theorem) gives us a way to convert between Pr(A | B) and Pr(B | A). It follows f... | nlp_Page_496_Chunk491 |
A.3. INDEPENDENCE 479 Let G be the event of a sentence having a parasitic gap, and T be the event of the test being positive. We are interested in the probability of a sentence having a parasitic gap given that the test is positive. This is the conditional probability Pr(G | T), and it can be computed by Bayes’ rule: P... | nlp_Page_497_Chunk492 |
480 APPENDIX A. PROBABILITY coin, the probability of getting heads on the first flip is independent of the probability of getting heads on the second flip: Pr({HT, HH}) = Pr(HT) + Pr(HH) = 1 4 + 1 4 = 1 2 [A.23] Pr({HH, TH}) = Pr(HH) + Pr(TH) = 1 4 + 1 4 = 1 2 [A.24] Pr({HT, HH}) × Pr({HH, TH}) =1 2 × 1 2 = 1 4 [A.25] Pr(... | nlp_Page_498_Chunk493 |
A.5. EXPECTATIONS 481 a probability mass function (pmf) if X is discrete; it is called a probability density function (pdf) if X is continuous. In either case, the function must sum to one, and all values must be non-negative: Z x pX(x)dx =1 [A.28] ∀x, pX(x) ≥0. [A.29] Probabilities over multiple random variables can w... | nlp_Page_499_Chunk494 |
482 APPENDIX A. PROBABILITY A.6 Modeling and estimation Probabilistic models provide a principled way to reason about random events and ran- dom variables. Let’s consider the coin toss example. Each toss can be modeled as a ran- dom event, with probability θ of the event H, and probability 1 −θ of the complementary eve... | nlp_Page_500_Chunk495 |
A.6. MODELING AND ESTIMATION 483 § 2.4), so it can be maximized by taking the derivative and setting it equal to zero. ℓ(θ) =x log θ + (N −x) log(1 −θ) [A.35] ∂ℓ(θ) ∂θ =x θ −N −x 1 −θ [A.36] N −x 1 −θ =x θ [A.37] N −x x =1 −θ θ [A.38] N x −1 =1 θ −1 [A.39] ˆθ = x N . [A.40] In this case, the maximum likelihood estimate... | nlp_Page_501_Chunk496 |
Appendix B Numerical optimization Unconstrained numerical optimization involves solving problems of the form, min x∈RD f(x), [B.1] where x ∈RD is a vector of D real numbers. Differentiation is fundamental to numerical optimization. Suppose that at some x∗, every partial derivative of f is equal to 0: formally, ∂f ∂xi x... | nlp_Page_503_Chunk497 |
486 APPENDIX B. NUMERICAL OPTIMIZATION derivatives are, ∂d ∂x1 = x1 −2 [B.2] ∂d ∂x2 = x2 −1 [B.3] The unique minimum is x∗= [2, 1]⊤. For non-convex functions, critical points are not necessarily global minima. A local minimum x∗is a point at which the function takes a smaller value than at all nearby neighbors: formall... | nlp_Page_504_Chunk498 |
B.3. EXAMPLE: PASSIVE-AGGRESSIVE ONLINE LEARNING 487 where each gc(x) is a scalar function of x. For example, suppose that x must be non- negative, and that its sum cannot exceed a budget b. Then there are D + 1 inequality constraints, gi(x) = −xi, ∀i = 1, 2, . . . , D [B.7] gD+1(x) = −b + D X i=1 xi. [B.8] Inequality ... | nlp_Page_505_Chunk499 |
488 APPENDIX B. NUMERICAL OPTIMIZATION When the margin loss is zero for θ(i−1), the optimal solution is θ∗= θ(i−1), so we will focus on the case where ℓ(i)(θ(i−1)) > 0. The Lagrangian for this problem is, L(θ, λ) = 1 2||θ −θ(i−1)||2 + λℓ(i)(θ), [B.14] Holding λ constant, we can solve for θ by differentiating, ∇θL =θ −θ... | nlp_Page_506_Chunk500 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.