jurafsky&martin_3rdEd_17 (1).pdf

Putting all this together the maximum spanning tree

Info icon This preview shows pages 263–266. Sign up to view the full content.

View Full Document Right Arrow Icon
Putting all this together, the maximum spanning tree algorithm consists of greedy edge selection, re-scoring of edge costs and a recursive cleanup phase when needed. The full algorithm is shown in Fig. 14.13 .
Image of page 263

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
264 C HAPTER 14 D EPENDENCY P ARSING function M AX S PANNING T REE ( G=(V,E) , root , score ) returns spanning tree F [] T’ [] score’ [] for each v 2 V do bestInEdge argmax e =( u , v ) 2 E score[e] F F [ bestInEdge for each e=(u,v) 2 E do score’[e] score[e] - score[bestInEdge] if T=(V,F) is a spanning tree then return it else C a cycle in F G’ C ONTRACT ( G , C ) T’ M AX S PANNING T REE ( G’ , root , score’ ) T E XPAND ( T’ , C ) return T function C ONTRACT ( G , C ) returns contracted graph function E XPAND ( T , C ) returns expanded graph Figure 14.13 The Chu-Liu Edmonds algorithm for finding a maximum spanning tree in a weighted directed graph. Fig. 14.14 steps through the algorithm with our Book that flight example. The first row of the figure illustrates greedy edge selection with the edges chosen shown in blue (corresponding to the set F in the algorithm). This results in a cycle between that and flight . The scaled weights using the maximum value entering each node are shown in the graph to the right. Collapsing the cycle between that and flight to a single node (labelled tf ) and recursing with the newly scaled costs is shown in the second row. The greedy selec- tion step in this recursion yields a spanning tree that links root to book , as well as an edge that links book to the contracted node. Expanding the contracted node, we can see that this edge corresponds to the edge from book to flight in the original graph. This in turn tells us which edge to drop to eliminate the cycle On arbitrary directed graphs, this version of the CLE algorithm runs in O ( mn ) time, where m is the number of edges and n is the number of nodes. Since this par- ticular application of the algorithm begins by constructing a fully connected graph m = n 2 yielding a running time of O ( n 3 ) . Gabow et al. (1986) present a more effi- cient implementation with a running time of O ( m + nlogn ) . 14.5.2 Features and Training Given a sentence, S , and a candidate tree, T , edge-factored parsing models reduce the score for the tree to a sum of the scores of the edges that comprise the tree. score ( S , T ) = X e 2 T score ( S , e ) Each edge score can, in turn, be reduced to a weighted sum of features extracted
Image of page 264
14.5 G RAPH -B ASED D EPENDENCY P ARSING 265 root Book tf root Book that flight 0 -3 -4 -7 -1 -6 -2 root Book 12 that 7 flight 8 -4 -3 0 -2 -6 -1 -7 0 0 root Book 0 tf -1 0 -3 -4 -7 -1 -6 -2 root Book 12 that 7 flight 8 12 4 4 5 6 8 7 5 7 Deleted from cycle Figure 14.14 Chu-Liu-Edmonds graph-based example for Book that flight from it. score ( S , e ) = N X i = 1 w i f i ( S , e ) Or more succinctly. score ( S , e ) = w · f Given this formulation, we are faced with two problems in training our parser: identifying relevant features and finding the weights used to score those features.
Image of page 265

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 266
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern