figure-evaluation-of-probability-for-grammar.tex 4.46 KB
Newer Older
曹润柘 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58

\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}

%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}

\begin{scope}[sibling distance=0pt,level distance=17pt]
{\footnotesize
\Tree[.\node[inner sep=2pt](t1n1){IP};
          [.\node[inner sep=2pt](t1n2){NP};
               [.\node[inner sep=2pt](t1n3){NN}; 狗 ]
          ]
          [.\node[inner sep=2pt](t1n4){VP};
               [.\node[inner sep=2pt](t1n5){VV}; 喜欢 ]
               [.\node[inner sep=2pt](t1n6){VP};
                     [.\node[inner sep=2pt](t1n7){VV}; 吃 ]
                     [.\node[inner sep=2pt](t1n8){NN}; 骨头 ]
               ]
          ]
     ]
}
\end{scope}

\begin{scope}[sibling distance=0pt,level distance=17pt,yshift=-7em]
{\footnotesize
\Tree[.\node[inner sep=2pt](t2n1){IP};
          [.\node[inner sep=2pt](t2n2){VP};
               [.\node[inner sep=2pt](t2n3){VV}; \node[](t2w1){}; ]
          ]
          [.\node[inner sep=2pt](t2n4){IP};
               [.\node[inner sep=2pt](t2n5){VP};
                    [.\node[inner sep=2pt](t2n6){VV}; 看 ]
               ]
               [.\node[inner sep=2pt](t2n7){NP};
                    [.\node[inner sep=2pt](t2n8){QP};
                          [.\node[inner sep=2pt](t2n9){CD}; 一 ]
                          [.\node[inner sep=2pt](t2n10){M}; 个 ]
                    ]
                    [.\node[inner sep=2pt](t2n11){ADJP};
                          [.\node[inner sep=2pt](t2n12){JJ}; 新 ]
                    ]
                    [.\node[inner sep=2pt](t2n13){NP};
                          [.\node[inner sep=2pt](t2n14){NN}; \node[](t2wn){句子}; ]
                    ]
               ]
          ]
     ]
}
\end{scope}

\node [anchor=south] (treebanklabel) at (t1n1.north) {{\color{ublue} 数据:树库}};

\begin{pgfonlayer}{background}
\node[rectangle,draw=ublue, inner sep=0.2em] [fit = (treebanklabel) (t1n1) (t2w1) (t2wn)] (treebank) {};
\end{pgfonlayer}

曹润柘 committed
59 60
\node [anchor=north west] (math1) at ([xshift=2em]treebank.north east) {P(``VP $\to$ VV NN'')};
\node [anchor=north west] (math1part2) at ([xshift=-1em,yshift=0.2em]math1.south west) {$=\frac{\textrm{``VP''和``VV NN''同时出现的次数=1}}{\textrm{``VP''出现的次数}=4}$};
曹润柘 committed
61 62 63

\node [anchor=north west] (math1part3) at ([yshift=0.2em]math1part2.south west){$=\frac{1}{4}$};

曹润柘 committed
64 65
\node [anchor=north west] (math2) at ([yshift=-6em]math1.north west) {P(``NP $\to$ NN'')};
\node [anchor=north west] (math2part2) at ([xshift=-1em,yshift=0.2em]math2.south west) {$=\frac{\textrm{``NP''和``NN''同时出现的次数=2}}{\textrm{``NP''出现的次数}=3}$};
曹润柘 committed
66 67 68
\node [anchor=north west] (math2part3) at ([yshift=0.2em]math2part2.south west){$=\frac{2}{3}$};


曹润柘 committed
69 70
\node [anchor=north west] (math3) at ([yshift=-6em]math2.north west) {P(``IP $\to$ NP NP'')};
\node [anchor=north west] (math3part2) at ([xshift=-1em,yshift=0.2em]math3.south west) {$=\frac{\textrm{``IP''和``NP NP''同时出现的次数=0}}{\textrm{``IP''出现的次数}=3}$};
xiaotong committed
71
\node [anchor=north west] (math3part3) at ([yshift=0.2em]math3part2.south west){$=\frac{0}{3}$};
曹润柘 committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

\begin{pgfonlayer}{background}

\path [] (t1n4.north east) -- (t1n4.north west) -- (t1n4.south west) -- (t1n4.south east);
\path [] (t1n6.north east) -- (t1n6.north west) -- (t1n6.south west) -- (t1n6.south east);
\path [] (t2n2.north east) -- (t2n2.north west) -- (t2n2.south west) -- (t2n2.south east);
\path [] (t2n5.north east) -- (t2n5.north west) -- (t2n5.south west) -- (t2n5.south east);

\path [] (t1n6.north west) -- (t1n7.north west) -- (t1n7.south west) -- (t1n8.south east) -- (t1n8.north east) -- (t1n6.north east);

\path [] (t1n2.north east) -- (t1n2.north west) -- (t1n2.south west) -- (t1n2.south east);
\path [] (t2n7.north east) -- (t2n7.north west) -- (t2n7.south west) -- (t2n7.south east);
\path [] (t2n13.north east) -- (t2n13.north west) -- (t2n13.south west) -- (t2n13.south east);

\path [] (t1n2.north west) -- (t1n3.south west) -- (t1n3.south east) -- (t1n2.north east) -- (t1n2.north west);
\path [] (t2n13.north west) -- (t2n14.south west) -- (t2n14.south east) -- (t2n13.north east) -- (t2n13.north west);

\path [] (t1n1.north east) -- (t1n1.north west) -- (t1n1.south west) -- (t1n1.south east);
\path [] (t2n4.north east) -- (t2n4.north west) -- (t2n4.south west) -- (t2n4.south east);
\path [] (t2n1.north east) -- (t2n1.north west) -- (t2n1.south west) -- (t2n1.south east);


\end{pgfonlayer}

\end{tikzpicture}
%---------------------------------------------------------------------