%%% outline %------------------------------------------------------------------------- %%% 简易机器翻译系统 - step 3 decoding - example \begin{tikzpicture} \begin{scope}[scale=0.6] {\scriptsize %% input words \node [anchor=west] (s1) at (0,0) {{我}}; \node [anchor=west] (s2) at ([xshift=3em]s1.east) {{对}}; \node [anchor=west] (s3) at ([xshift=3em]s2.east) {{你}}; \node [anchor=west] (s4) at ([xshift=2.5em]s3.east) {{感到}}; \node [anchor=west] (s5) at ([xshift=2.5em]s4.east) {{满意}}; \node [anchor=south west,inner sep=1pt] (sentlabel) at ([yshift=0.3em]s1.north west) {\scriptsize{{输入: 待翻译句子(已经分词)}}}; { \draw [->,very thick,ublue] ([yshift=0.2em]s1.south) -- ([yshift=-0.8em]s1.south) node [pos=0.5,right] (pi1) {\tiny{$\pi$(1)}}; \draw [->,very thick,ublue] ([yshift=0.2em]s2.south) -- ([yshift=-0.8em]s2.south) node [pos=0.5,right] (pi2) {\tiny{$\pi$(2)}}; \draw [->,very thick,ublue] ([yshift=0.2em]s3.south) -- ([yshift=-0.8em]s3.south) node [pos=0.5,right] (pi3) {\tiny{$\pi$(3)}}; \draw [->,very thick,ublue] ([yshift=0.2em]s4.south) -- ([yshift=-0.8em]s4.south) node [pos=0.5,right] (pi4) {\tiny{$\pi$(4)}}; \draw [->,very thick,ublue] ([yshift=0.2em]s5.south) -- ([yshift=-0.8em]s5.south) node [pos=0.5,right] (pi5) {\tiny{$\pi$(5)}}; } } {\tiny %% translation options { \node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t11) at ([yshift=-1.3em]s1.south) {I'm}; \node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t12) at ([yshift=-0.2em]t11.south) {I}; \node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t13) at ([yshift=-0.2em]t12.south) {me}; } { \node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t21) at ([yshift=-1.3em]s2.south) {to}; \node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t22) at ([yshift=-0.2em]t21.south) {with}; \node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t23) at ([yshift=-0.2em]t22.south) {for}; } { \node [anchor=north,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (t31) at ([yshift=-1.3em]s3.south) {you}; \node [anchor=north,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (t32) at ([yshift=-0.2em]t31.south) {your}; } { \node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3.5em] (t41) at ([yshift=-1.3em]s4.south) {$\phi$}; \node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3.5em] (t42) at ([yshift=-0.2em]t41.south) {feel}; \node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3.5em] (t43) at ([yshift=-0.2em]t42.south) {feels}; } { \node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t51) at ([yshift=-1.3em]s5.south) {satisfy}; \node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t52) at ([yshift=-0.2em]t51.south) {satisfied}; \node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t53) at ([yshift=-0.2em]t52.south) {satisfies}; } { \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt11) at (t11.east) {{\color{white} 0.4}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt12) at (t12.east) {{\color{white} 0.3}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt13) at (t13.east) {{\color{white} 0.1}}; } { \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt21) at (t21.east) {{\color{white} 0.3}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt22) at (t22.east) {{\color{white} 0.3}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt23) at (t23.east) {{\color{white} 0.2}}; } { \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt31) at (t31.east) {{\color{white} 0.7}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt32) at (t32.east) {{\color{white} 0.3}}; } { \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt41) at (t41.east) {{\color{white} 0.4}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt42) at (t42.east) {{\color{white} 0.2}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt43) at (t43.east) {{\color{white} 0.1}}; } { \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt51) at (t51.east) {{\color{white} 0.3}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt52) at (t52.east) {{\color{white} 0.2}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt53) at (t53.east) {{\color{white} 0.2}}; } } {\scriptsize \node [anchor=west] (translation) at ([yshift=-2em]t13.south west) {$best.translation = $}; } {\scriptsize \node [anchor=west,inner sep=2pt,minimum height=1.5em,minimum width=2em] (transword0) at (translation.east) {$\phi$}; } {\scriptsize \node [anchor=north west] (jlabel) at (translation.south west) {$best.j = -1$}; } {\scriptsize \node [anchor=west] (hlabel) at ([yshift=-2.5em]jlabel.west) {\scriptsize{$i = 1, j = 1$}}; } {\tiny \node [anchor=north west] (glabel) at (hlabel.south west) {$g(\seq{s},\seq{t})$}; \node [anchor=west] (translabel) at (glabel.east) {翻译结果}; \draw [-] (glabel.north east) -- ([yshift=-1.5in]glabel.north east); \draw [-] (glabel.south west) -- ([xshift=3.5in]glabel.south west); \node [anchor=center,rotate=90] (hlabel2) at ([xshift=-1.3em,yshift=-8.5em]glabel.west) {\tiny{$h$存放临时翻译结果}}; \node [anchor=north west] (foot1) at ([xshift=4.0em,yshift=-18.0em]translabel.south west) {\small{(a)\; 4:$h = \phi$}}; } \end{scope} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{scope}[scale=0.6,xshift=30.0em] {\scriptsize %% input words \node [anchor=west] (s1) at (0,0) {{我}}; \node [anchor=west] (s2) at ([xshift=3em]s1.east) {{对}}; \node [anchor=west] (s3) at ([xshift=3em]s2.east) {{你}}; \node [anchor=west] (s4) at ([xshift=2.5em]s3.east) {{感到}}; \node [anchor=west] (s5) at ([xshift=2.5em]s4.east) {{满意}}; \node [anchor=south west,inner sep=1pt] (sentlabel) at ([yshift=0.3em]s1.north west) {\scriptsize{{输入: 待翻译句子(已经分词)}}}; { \draw [->,very thick,ublue] ([yshift=0.2em]s1.south) -- ([yshift=-0.8em]s1.south) node [pos=0.5,right] (pi1) {\tiny{$\pi$(1)}}; \draw [->,very thick,ublue] ([yshift=0.2em]s2.south) -- ([yshift=-0.8em]s2.south) node [pos=0.5,right] (pi2) {\tiny{$\pi$(2)}}; \draw [->,very thick,ublue] ([yshift=0.2em]s3.south) -- ([yshift=-0.8em]s3.south) node [pos=0.5,right] (pi3) {\tiny{$\pi$(3)}}; \draw [->,very thick,ublue] ([yshift=0.2em]s4.south) -- ([yshift=-0.8em]s4.south) node [pos=0.5,right] (pi4) {\tiny{$\pi$(4)}}; \draw [->,very thick,ublue] ([yshift=0.2em]s5.south) -- ([yshift=-0.8em]s5.south) node [pos=0.5,right] (pi5) {\tiny{$\pi$(5)}}; } } {\tiny %% translation options { \node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t11) at ([yshift=-1.3em]s1.south) {I'm}; \node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t12) at ([yshift=-0.2em]t11.south) {I}; \node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t13) at ([yshift=-0.2em]t12.south) {me}; } { \node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t21) at ([yshift=-1.3em]s2.south) {to}; \node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t22) at ([yshift=-0.2em]t21.south) {with}; \node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t23) at ([yshift=-0.2em]t22.south) {for}; } { \node [anchor=north,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (t31) at ([yshift=-1.3em]s3.south) {you}; \node [anchor=north,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (t32) at ([yshift=-0.2em]t31.south) {your}; } { \node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3.5em] (t41) at ([yshift=-1.3em]s4.south) {$\phi$}; \node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3.5em] (t42) at ([yshift=-0.2em]t41.south) {feel}; \node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3.5em] (t43) at ([yshift=-0.2em]t42.south) {feels}; } { \node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t51) at ([yshift=-1.3em]s5.south) {satisfy}; \node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t52) at ([yshift=-0.2em]t51.south) {satisfied}; \node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t53) at ([yshift=-0.2em]t52.south) {satisfies}; } { \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt11) at (t11.east) {{\color{white} 0.4}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt12) at (t12.east) {{\color{white} 0.3}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt13) at (t13.east) {{\color{white} 0.1}}; } { \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt21) at (t21.east) {{\color{white} 0.3}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt22) at (t22.east) {{\color{white} 0.3}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt23) at (t23.east) {{\color{white} 0.2}}; } { \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt31) at (t31.east) {{\color{white} 0.7}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt32) at (t32.east) {{\color{white} 0.3}}; } { \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt41) at (t41.east) {{\color{white} 0.4}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt42) at (t42.east) {{\color{white} 0.2}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt43) at (t43.east) {{\color{white} 0.1}}; } { \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt51) at (t51.east) {{\color{white} 0.3}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt52) at (t52.east) {{\color{white} 0.2}}; \node [anchor=north,rotate=90,inner sep=1pt,minimum width=1.5em,fill=black] (pt53) at (t53.east) {{\color{white} 0.2}}; } } %中间的三句话 {\scriptsize \node [anchor=west] (translation) at ([yshift=-2em]t13.south west) {$best.translation = $}; } {\scriptsize \node [anchor=west,inner sep=2pt,minimum height=1.5em,minimum width=2em] (transword0) at (translation.east) {$\phi$}; } {\scriptsize \node [anchor=north west] (jlabel) at (translation.south west) {$best.j = -1$}; } {\scriptsize \node [anchor=west] (hlabel) at ([yshift=-2.5em]jlabel.west) {\scriptsize{$i = 1, j = 1$}}; } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% {%第一个矩形框 \node[anchor=west,draw,minimum height=2.9em,minimum width=2.2em] (list1) at ([xshift=-0.2em]t12.west) {}; } { \node [anchor=west,draw,inner sep=0pt,minimum height=1.0em,minimum width=1.5em] (hypotrans1) at ([xshift=-0.1em]transword0.west) {}; } {\tiny%下面的表格 \node [anchor=north west] (glabel) at (hlabel.south west) {$g(\seq{s},\seq{t})$}; \node [anchor=west] (translabel) at (glabel.east) {翻译结果}; \draw [-] (glabel.north east) -- ([yshift=-1.5in]glabel.north east); \draw [-] (glabel.south west) -- ([xshift=3.5in]glabel.south west); \node [anchor=center,rotate=90] (hlabel2) at ([xshift=-1.3em,yshift=-8.5em]glabel.west) {\tiny{$h$存放临时翻译结果}}; \node [anchor=north west] (foot2) at ([xshift=-4.0em,yshift=-18.0em]translabel.south west) {\small{(b)\; 6: \textbf{if} $used[j]=$ \textbf{false} \textbf{then}}}; } {%大大的join \node [anchor=center,draw=ublue,circle,thick,fill=white,inner sep=2.5pt,circular drop shadow={shadow xshift=0.1em,shadow yshift=-0.1em}] (join) at ([xshift=4em,yshift=-1em]hlabel.north east) {\tiny{\textsc{Join}}}; } {\tiny \node [anchor=north west] (g1) at ([yshift=-3pt]glabel.south west) {.1744}; \node [anchor=north west] (g2) at ([yshift=-1pt]g1.south west) {.1674}; \node [anchor=north west] (g3) at ([yshift=-1pt]g2.south west) {.1041}; } {\tiny \node [anchor=west,inner sep=2pt,minimum height=1.3em,fill=red!20] (hword11) at ([xshift=2.0em]g1.east) {I'm}; \node [anchor=west,inner sep=2pt,minimum height=1.3em,fill=red!20] (hword21) at ([xshift=2.0em]g2.east) {I}; \node [anchor=west,inner sep=2pt,minimum height=1.3em,fill=red!20] (hword31) at ([xshift=2.0em]g3.east) {me}; } { \draw [->,thick] (hypotrans1.south) ..controls +(south:0.5) and +(north:0.5).. (join.north); } { \draw [->,thick] (list1.west) ..controls +(249:3.1) and +(north west:2.2).. (join.north west); \draw [->,thick] (join.south) ..controls +(south:1) and +(east:1).. ([xshift=4em]g2.east); } \end{scope} \end{tikzpicture}