%------------------------------------------- \begin{tikzpicture} %\setlength{\hnode}{1.2cm} \tikzstyle{elementnode} = [rectangle,text=white,anchor=center] \tikzstyle{srcnode} = [rotate=45,font=\small,anchor=south west] \tikzstyle{tgtnode} = [left,font=\small,anchor=north east] \tikzstyle{alignmentnode} = [rectangle,draw,minimum height=3.6cm,minimum width=0.36cm] \tikzstyle{probnode} = [fill=blue!30,minimum width=0.4cm] \tikzstyle{labelnode} = [above] % alignment matrix \begin{scope}[scale=1.2,yshift=0.12in] \foreach \i / \j / \c in {0/7/0.2, 1/7/0.45, 2/7/0.15, 3/7/0.15, 4/7/0.15, 5/7/0.15, 0/6/0.35, 1/6/0.45, 2/6/0.15, 3/6/0.15, 4/6/0.15, 5/6/0.15, 0/5/0.25, 1/5/0.15, 2/5/0.15, 3/5/0.35, 4/5/0.15, 5/5/0.15, 0/4/0.15, 1/4/0.25, 2/4/0.2, 3/4/0.30, 4/4/0.15, 5/4/0.15, 0/3/0.15, 1/3/0.15, 2/3/0.8, 3/3/0.25, 4/3/0.15, 5/3/0.25, 0/2/0.15, 1/2/0.15, 2/2/0.15, 3/2/0.15, 4/2/0.25, 5/2/0.3, 0/1/0.15, 1/1/0.15, 2/1/0.15, 3/1/0.15, 4/1/0.8, 5/1/0.15, 0/0/0.15, 1/0/0.15, 2/0/0.15, 3/0/0.15, 4/0/0.25, 5/0/0.60} \node[elementnode,minimum size=0.8*1.2cm*\c,inner sep=0.1pt,fill=blue] (a\i\j) at (0.5*1.2cm*\i-5.4*0.5*1.2cm,0.5*1.2cm*\j-1.05*1.2cm) {}; %attention score labels \node[align=center] (l17) at (a17) {\scriptsize{{\color{white} .4}}}; \node[align=center] (l26) at (a06) {\scriptsize{{\color{white} .3}}}; \node[align=center] (l26) at (a16) {\scriptsize{{\color{white} .4}}}; \node[align=center] (l17) at (a35) {\scriptsize{{\color{white} .3}}}; \node[align=center] (l17) at (a34) {\tiny{{\color{white} .3}}}; \node[align=center] (l17) at (a23) {\small{{\color{white} .8}}}; \node[align=center] (l17) at (a41) {\small{{\color{white} .8}}}; \node[align=center] (l17) at (a50) {\small{{\color{white} .7}}}; % source \node[srcnode] (src1) at (-5.4*0.5*1.2cm,-1.05*1.2cm+7.5*0.5*1.2cm) {\small{Have}}; \node[srcnode] (src2) at ([xshift=0.6cm]src1.south west) {\small{you}}; \node[srcnode] (src3) at ([xshift=0.6cm]src2.south west) {\small{learned}}; \node[srcnode] (src4) at ([xshift=0.6cm]src3.south west) {\small{nothing}}; \node[srcnode] (src5) at ([xshift=0.6cm]src4.south west) {\small{?}}; \node[srcnode] (src6) at ([xshift=0.6cm]src5.south west) {\small{$\langle$eos$\rangle$}}; % target \node[tgtnode] (tgt1) at (-6.0*0.5*1.2cm,-1.05*1.2cm+7.5*0.5*1.2cm) {\small{你}}; \node[tgtnode] (tgt2) at ([yshift=-0.6cm]tgt1.north east) {\small{什么}}; \node[tgtnode] (tgt3) at ([yshift=-0.6cm]tgt2.north east) {\small{都}}; \node[tgtnode] (tgt4) at ([yshift=-0.6cm]tgt3.north east) {\small{没}}; \node[tgtnode] (tgt5) at ([yshift=-0.6cm]tgt4.north east) {\small{学}}; \node[tgtnode] (tgt6) at ([yshift=-0.6cm]tgt5.north east) {\small{到}}; \node[tgtnode] (tgt7) at ([yshift=-0.6cm]tgt6.north east) {\small{?}}; \node[tgtnode] (tgt8) at ([yshift=-0.6cm]tgt7.north east) {\small{$\langle$eos$\rangle$}}; \end{scope} \end{tikzpicture} %-------------------------------------------