Commit 8819b9d4 by 曹润柘

合并分支 'caorunzhe' 到 'master'

Caorunzhe

查看合并请求 !262
parents 5fffa8cc f22868cc
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
{\small
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=1em]s1.east) {桌子};
\node [anchor=west,inner sep=2pt] (s3) at ([xshift=1em]s2.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.7em]s1.center) {on};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.5em]s2.center) {the};
\node [anchor=north,inner sep=2pt] (t3) at ([yshift=-1.5em]s3.center) {table};
\node [anchor=east,inner sep=2pt] (t0) at ([xshift=-1.5em]t1.west) {$t_0$};
\draw [-] (s1.south) -- (t0.north);
\draw [-] (s2.south) -- (t3.north);
\draw [-] (s3.south) .. controls +(south:1em) and +(north:1em) .. (t1.north);
}
\end{tikzpicture}
%---------------------------------------------------------------------
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
......
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
{\footnotesize
\node [anchor=north west,inner sep=2pt,align=left] (line1) at (0,0) {\textrm{\textbf{Function} \textsc{WordDecoding}($s$)}};
\node [anchor=north west,inner sep=2pt,align=left] (line2) at ([yshift=-1pt]line1.south west) {\textrm{1: $\pi = $\textsc{GetTransOptions}($s$)}};
\node [anchor=north west,inner sep=2pt,align=left] (line3) at ([yshift=-1pt]line2.south west) {\textrm{2: $best = \phi$}};
\node [anchor=north west,inner sep=2pt,align=left] (line4) at ([yshift=-1pt]line3.south west) {\textrm{3: \textbf{for} $i$ in $[1,m]$ \textbf{do}}};
\node [anchor=north west,inner sep=2pt,align=left] (line5) at ([yshift=-1pt]line4.south west) {\textrm{4: \hspace{1em} $h = \phi$}};
\node [anchor=north west,inner sep=2pt,align=left] (line6) at ([yshift=-1pt]line5.south west) {\textrm{5: \hspace{1em} \textbf{foreach} $j$ in $[1,m]$ \textbf{do}}};
\node [anchor=north west,inner sep=2pt,align=left] (line7) at ([yshift=-1pt]line6.south west) {\textrm{6: \hspace{2em} \textbf{if} $used[j]=$ \textbf{true} \textbf{then}}};
\node [anchor=north west,inner sep=2pt,align=left] (line8) at ([yshift=-1pt]line7.south west) {\textrm{7: \hspace{3em} $h = h \cup \textrm{\textsc{Join}}(best,\pi[j])$}};
\node [anchor=north west,inner sep=2pt,align=left] (line9) at ([yshift=-1pt]line8.south west) {\textrm{8: \hspace{1em} $best = \textrm{\textsc{PruneForTop1}}(h)$}};
\node [anchor=north west,inner sep=2pt,align=left] (line10) at ([yshift=-1pt]line9.south west) {\textrm{9: \hspace{1em} $used[best.j] = \textrm{\textsc{\textbf{true}}}$}};
\node [anchor=north west,inner sep=2pt,align=left] (line11) at ([yshift=-1pt]line10.south west) {\textrm{10: \textbf{return} $best.translatoin$}};
\node [anchor=south west,inner sep=2pt,align=left] (head1) at ([yshift=1pt]line1.north west) {输出: 找的最佳译文};
\node [anchor=south west,inner sep=2pt,align=left] (head2) at ([yshift=1pt]head1.north west) {输入: 源语句子$s=s_1...s_m$};
}
\begin{pgfonlayer}{background}
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow,minimum height=1.6cm] [fit = (head2) (line8) (line11)] (algorithm) {};
%% highlights
%\begin{pgfonlayer}{background}
{
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.85in] (line2highlight) at (line2.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.85in] (line3highlight) at (line3.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.85in] (line5highlight) at (line5.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.85in] (line8highlight) at (line8.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.85in] (line9highlight) at (line9.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.85in] (line10highlight) at (line10.west) {};
}
%\end{pgfonlayer}
\end{pgfonlayer}
{
%% remark 1
\begin{scope}
{\footnotesize
\node [anchor=north west,align=left] (remark1) at ([xshift=0.6in,yshift=-0.8em]algorithm.north east) {获取每个单词\\的翻译候选};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,red] (s1) at ([yshift=-0.3em,xshift=0.5em]remark1.north east){1};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,ugreen] (s2) at ([xshift=0.4em]s1.east) {2};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,orange] (s3) at ([xshift=0.4em]s2.east) {3};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=3.0pt,ublue] (s4) at ([xshift=0.4em]s3.east) {...};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=1.5pt,purple] (s5) at ([xshift=0.4em]s4.east) {$m$};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,red,fill=red] (t1) at ([yshift=-2.2em]s1.center) {{\color{white} $n$}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,ugreen,fill=ugreen] (t2) at ([yshift=-2.2em]s2.center) {{\color{white} $n$}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,orange,fill=orange] (t3) at ([yshift=-2.2em]s3.center) {{\color{white} $n$}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,ublue,fill=ublue] (t4) at ([yshift=-2.2em]s4.center) {{\color{white} $n$}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,purple,fill=purple] (t5) at ([yshift=-2.2em]s5.center) {{\color{white} $n$}};
\draw [->,thick] ([yshift=-0.1em]s1.south) -- ([yshift=0.1em]t1.north);
\draw [->,thick] ([yshift=-0.1em]s2.south) -- ([yshift=0.1em]t2.north);
\draw [->,thick] ([yshift=-0.1em]s3.south) -- ([yshift=0.1em]t3.north);
\draw [->,thick] ([yshift=-0.1em]s4.south) -- ([yshift=0.1em]t4.north);
\draw [->,thick] ([yshift=-0.1em]s5.south) -- ([yshift=0.1em]t5.north);
\begin{pgfonlayer}{background}
{
\node[rectangle,draw,inner sep=0.2em,fill=blue!10,minimum width=2.4in] [fit = (remark1) (s1) (t5)] (remark1label) {};
}
\end{pgfonlayer}
}
\end{scope}
%% end of remark 1
%% remark 2
\begin{scope}
{\footnotesize
\node [anchor=north west,draw,inner sep=2pt,fill=blue!10,minimum width=2.4in] (remark2) at ([yshift=-0.5em]remark1label.south west) {$best$用于保存当前最好的翻译结果};
}
\end{scope}
%% end of remark 2
%% remark 3
\begin{scope}
{\footnotesize
\node [anchor=north west,draw,inner sep=2pt,fill=blue!10,minimum width=2.4in] (remark3) at ([yshift=-0.5em]remark2.south west) {$h$用于保存每步生成的所有译文候选};
}
\end{scope}
%% end of remark 3
%% remark 4
\begin{scope}
{\footnotesize
\node [anchor=north west,inner sep=2pt,align=left] (remark4) at ([xshift=0.7em,yshift=-0.8em]remark3.south west) {\textsc{Join}($a,b$) 返回\\$a$$b$ 的所有组合};
{
\node [anchor=north west,inner sep=1pt,align=center,draw] (a1) at ([yshift=-0.2em]remark4.north east) {a1\\a2};
\node [anchor=west] (join) at (a1.east) {$\times$};
\node [anchor=north west,inner sep=1pt,align=center,draw] (b1) at ([xshift=1.5em]a1.north east) {b1\\b2};
\node [anchor=west] (join) at (b1.east) {$=$};
\node [anchor=north west,inner sep=1pt,align=center,draw] (result) at ([xshift=1.5em]b1.north east) {a1b1 a1b2\\a2b1 a2b2};
}
\begin{pgfonlayer}{background}
{
\node[rectangle,draw,inner sep=2pt,fill=blue!10,minimum width=2.4in] [fit = (remark4) (result)] (remark4label) {};
}
\end{pgfonlayer}
}
\end{scope}
%% end of remark 4
%% remark 5
\begin{scope}
{\footnotesize
\node [anchor=north west,align=left] (remark5) at ([xshift=0.3em,yshift=-1.6em]remark4.south west) {\textsc{PruneForTop1}\\保留得分最高的结果};
\node [anchor=west,draw,inner sep=1pt] (s1) at ([yshift=-0.2em,xshift=1.2em]remark5.north east){0.234};
\node [anchor=north west,draw,inner sep=1pt] (s2) at ([yshift=-0.2em]s1.south west){0.197};
\node [anchor=north west,draw,inner sep=1pt] (s3) at ([yshift=-0.2em]s2.south west){0.083};
\draw [-] ([yshift=-0.1em,xshift=-0.2em]s1.south west) -- ([yshift=-0.1em,xshift=3em]s1.south east);
\node [anchor=west] (top1) at ([xshift=0.1em]s1.east) {\color{red}{$\gets$ top1}};
\begin{pgfonlayer}{background}
{
\node[rectangle,draw,inner sep=0.2em,fill=blue!10,minimum width=2.4in] [fit = (remark5) (s3) (top1)] (remark5label) {};
}
\end{pgfonlayer}
}
\end{scope}
% end of remark 5
%% remark 6
\begin{scope}
{\footnotesize
\node [anchor=north west,align=left] (remark6) at ([xshift=-0.3em,yshift=-1.3em]remark5.south west) {记录已经翻译过\\的源语单词};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,red] (s1) at ([yshift=-1.3em,xshift=0.5em]remark6.north east){1};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,ugreen] (s2) at ([xshift=0.4em]s1.east) {2};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,orange] (s3) at ([xshift=0.4em]s2.east) {3};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=3.0pt,ublue] (s4) at ([xshift=0.4em]s3.east) {...};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=1.5pt,purple] (s5) at ([xshift=0.4em]s4.east) {$m$};
\draw [-,thick,red] (s1.north east) -- (s1.south west);
\draw [-,thick,orange] (s3.north east) -- (s3.south west);
\begin{pgfonlayer}{background}
{
\node[rectangle,draw,inner sep=0.2em,fill=blue!10,minimum width=2.4in] [fit = (remark6) (s5)] (remark6label) {};
}
\end{pgfonlayer}
}
\end{scope}
% end of remark 6
{
\draw [->,thick] (line2highlight.east) ..controls +(east:1em) and +(west:1em).. (remark1label.west);
}
{
\draw [->,thick] (line3highlight.east) ..controls +(east:1em) and +(west:1em).. ([yshift=0.0em]remark2.west);
\draw [->,thick] (line5highlight.east) ..controls +(east:1em) and +(west:1em).. ([yshift=0.0em]remark3.west);
}
{
\draw [->,thick] (line8highlight.east) ..controls +(east:1em) and +(west:1em).. ([yshift=1.2em]remark4label.south west);
}
{
\draw [->,thick] (line9highlight.east) ..controls +(east:1em) and +(west:1em).. ([yshift=1.6em]remark5label.south west);
}
{
\draw [->,thick] (line10highlight.east) ..controls +(east:1em) and +(west:1em).. ([yshift=0.0em]remark6label.west);
}
}
\end{tikzpicture}
%---------------------------------------------------------------------
%%% outline
%-------------------------------------------------------------------------
......
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
{
\node [pos=0.5,left,xshift=-0.5em,yshift=2.0em] (label2) {Input: a word pair (x, y) and a sentence pair (s, t)};
\node [anchor=north west] (label2part2) at ([yshift=0.3em]label2.south west) {Output: the number of (x, y) in the (s, t)};
\node [anchor=north west] (label2part3) at ([yshift=0.3em]label2part2.south west) {{1:$count$ $\leftarrow$ 0}};
\node [anchor=north west] (label2part4) at ([yshift=0.3em]label2part3.south west) {{2:\textbf{for} $s\underline{\hbox to 0.1cm{}}word$ $\leftarrow$ $S_1$$S_{length(s)}$ \textbf{do} }};
\node [anchor=north west] (label2part5)at ([yshift=0.3em]label2part4.south west) {{3:\quad\textbf{for} $t\underline{\hbox to 0.1cm{}}word$ $\leftarrow$ $t_1$$t_{length(t)}$ \textbf{do} }};
\node [anchor=north west] (label2part6)at ([yshift=0.3em]label2part5.south west) {{4:\quad\quad\textbf{if} $s\underline{\hbox to 0.1cm{}}word$ == x \textbf{and} $t\underline{\hbox to 0.1cm{}}word$==y \textbf{then} }};
\node [anchor=north west] (label2part7) at ([yshift=0.3em]label2part6.south west) {{5:\quad\quad\quad\quad $count$ $\leftarrow$ $count$ + 1 }};
\node [anchor=north west] (label2part8) at ([yshift=0.3em]label2part7.south west) {{6:\quad\quad \textbf{end if} }};
\node [anchor=north west] (label2part9) at ([yshift=0.3em]label2part8.south west) {{7:\quad \textbf{end for} }};
\node [anchor=north west] (label2part10) at ([yshift=0.3em]label2part9.south west) {{8: \textbf{end for} }};
}
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
{
\node [pos=0.5,left,xshift=-0.5em,yshift=2.0em] (label2) {\footnotesize{{$s^1$ = 机器\quad {\color{red}翻译}\quad\quad\quad\quad 计算机\quad\quad 进行\quad {\color{red}翻译} }}};
\node [anchor=north west] (label2part2) at ([yshift=0.3em]label2.south west) {\footnotesize{{$t^1$ = machine\; {\color{red}translation}\; is\; just\; {\color{red}translation}\; by\; computer }}};
\node [anchor=north west] (label2part3) at ([yshift=0.3em]label2part2.south west) {\footnotesize{{$s^2$ = 那\quad 人工\quad {\color{red}翻译}\quad\quad ? }}};
\node [anchor=north west] (label2part4) at ([yshift=0.3em]label2part3.south west) {\footnotesize{{$t^2$ = so\; what\; is\; human\; {\color{red}translation}\;? }}};
}
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
{
\node [pos=0.5,left,xshift=-0.5em,yshift=2.0em] (label2) {\footnotesize{{s = 机器\quad {\color{red}翻译}\quad\quad\quad\quad 计算机\quad\quad 进行\quad {\color{red}翻译} }}};
\node [anchor=north west] (label2part2) at ([yshift=0.3em]label2.south west) {\footnotesize{{t = machine\; {\color{red}translation}\; is\; just\; {\color{red}translation}\; by\; computer }}};
}
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\begin{tabular}{c|c}
\multicolumn{1}{c|}{$x_i$} & c($x_i$) \\ \hline
\multicolumn{1}{c|}{$x_1$} & 2 \\
\multicolumn{1}{c|}{$x_2$} & 1 \\
\multicolumn{1}{c|}{$x_3$} & 5 \\ \hline
\multicolumn{2}{c}{$c(X)=8$}
\end{tabular}
\begin{tabular}{cccc}
\multicolumn{1}{c|}{$x_i$} & c($x_i$) & P($x_i$) & $c(x_i)\cdot$P($x_i$) \\ \hline
\multicolumn{1}{c|}{$x_1$} & 2 & 0.1 & 0.2 \\
\multicolumn{1}{c|}{$x_2$} & 1 & 0.3 & 0.3 \\
\multicolumn{1}{c|}{$x_3$} & 5 & 0.2 & 1.0 \\ \hline
\multicolumn{4}{c}{$c(X)=0.2+0.3+1.0=1.5$}
\end{tabular}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
%%% outline
%-------------------------------------------------------------------------
......
%%% outline
%-------------------------------------------------------------------------
......
......@@ -17,7 +17,7 @@
\renewcommand\tablename{}% Table => 表
\definecolor{ublue}{rgb}{0.152,0.250,0.545} % Color of deep blue
\definecolor{ugreen}{rgb}{0,0.5,0} % Color of deep green
\chapterimage{fig-NEU-4.jpg} % Chapter heading image
\chapterimage{../Figures/fig-NEU-4.jpg} % Chapter heading image
%----------------------------------------------------------------------------------------
% PART 2
......@@ -317,7 +317,7 @@
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figurerole-of-P-in-sentence-level-translation}
\input{./Chapter3/Figures/figurerole-of-p-in-sentence-level-translation}
\caption{$\textrm{P}(\mathbf{t}|\mathbf{s})$在句子级翻译中的作用}
\label{fig:3-6}
\end{figure}
......@@ -615,7 +615,7 @@ g(\mathbf{s},\mathbf{t}) \equiv \prod_{j,i \in \widehat{A}}{\textrm{P}(s_j,t_i)}
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure-correspondence-between-IBM-model&formula-1.13}
\input{./Chapter3/Figures/figure-correspondence-between-ibm-model&formula-1.13}
\caption{IBM模型与公式\ref{eq:3-10}的对应关系}
\label{fig:3-14}
\end{figure}
......@@ -824,7 +824,7 @@ g(\mathbf{s},\mathbf{t}) \equiv \prod_{j,i \in \widehat{A}}{\textrm{P}(s_j,t_i)}
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure-different-translation-result-in-different-score-IBM1}
\input{./Chapter3/Figures/figure-different-translation-result-in-different-score-ibm1}
\caption{不同的译文导致不同IBM模型1得分的情况}
\label{fig:3-20}
\end{figure}
......@@ -949,7 +949,7 @@ L(f,\lambda)=\frac{\varepsilon}{(l+1)^m}\prod_{j=1}^{m}\sum_{i=0}^{l}{f(s_j|t_i)
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure-lagrange-multiplier-method-(IBM-model-1)}
\input{./Chapter3/Figures/figure-lagrange-multiplier-method-(ibm-model-1)}
\caption{拉格朗日乘数法(IBM模型1)}
\label{fig:3-23}
\end{figure}
......@@ -1010,7 +1010,7 @@ f(s_u|t_v) = \lambda_{t_v}^{-1} \frac{\varepsilon}{(l+1)^{m}} \prod\limits_{j=1}
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure-IBM-model-iteration-process-diagram}
\input{./Chapter3/Figures/figure-ibm-model-iteration-process-diagram}
\caption{IBM模型迭代过程示意图}
\label{fig:3-24}
\end{figure}
......@@ -1095,7 +1095,7 @@ f(s_u|t_v)=\frac{c_{\mathbb{E}}(s_u|t_v;\mathbf{s},\mathbf{t})} { \sum\limits_{
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure-EM-algorithm-flow-chart}
\input{./Chapter3/Figures/figure-em-algorithm-flow-chart}
%\setlength{\belowcaptionskip}{-0.5em}
\caption{EM算法流程图(IBM模型1)}
\label{fig:3-28}
......@@ -1310,7 +1310,7 @@ p_0+p_1 & = & 1 \label{eq:3-56}
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure-word-alignment&probability-distribution-in-IBM-model-3}
\input{./Chapter3/Figures/figure-word-alignment&probability-distribution-in-ibm-model-3}
\caption{IBM模型3的词对齐及概率分配}
\label{fig:3-33}
\end{figure}
......@@ -1357,7 +1357,7 @@ p_0+p_1 & = & 1 \label{eq:3-56}
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure-example-HMM}
\input{./Chapter3/Figures/figure-example-hmm}
\caption{抛硬币的隐马尔可夫模型实例}
\label{fig:3-34}
\end{figure}
......
%------------------------------------------------------------------------------------------------------------
%%% CYK解码
% 看NiuTrans Manual
\begin{center}
\begin{tikzpicture}
\tikzstyle{alignmentnode} = [rectangle,fill=blue!30,minimum size=0.45em,text=white,inner sep=0.1pt]
\tikzstyle{selectnode} = [rectangle,fill=green!20,minimum height=1.5em,minimum width=1.5em,inner sep=1.2pt]
\tikzstyle{srcnode} = [anchor=south west]
\begin{scope}[scale=0.85]
\node[srcnode] (c1) at (0,0) {\normalsize{\textbf{Function} CYK-Algorithm($\textbf{s},G$)}};
\node[srcnode,anchor=north west] (c21) at ([xshift=1.5em,yshift=0.4em]c1.south west) {\normalsize{\textbf{fore} $j=0$ to $ J - 1$}};
\node[srcnode,anchor=north west] (c22) at ([xshift=1.5em,yshift=0.4em]c21.south west) {\normalsize{$span[j,j+1 ]$.Add($A \to a \in G$)}};
\node[srcnode,anchor=north west] (c3) at ([xshift=-1.5em,yshift=0.4em]c22.south west) {\normalsize{\textbf{for} $l$ = 1 to $J$}};
\node[srcnode,anchor=west] (c31) at ([xshift=6em]c3.east) {\normalsize{// length of span}};
\node[srcnode,anchor=north west] (c4) at ([xshift=1.5em,yshift=0.4em]c3.south west) {\normalsize{\textbf{for} $j$ = 0 to $J-l$}};
\node[srcnode,anchor=north west] (c41) at ([yshift=0.4em]c31.south west) {\normalsize{// beginning of span}};
\node[srcnode,anchor=north west] (c5) at ([xshift=1.5em,yshift=0.4em]c4.south west) {\normalsize{\textbf{for} $k$ = $j$ to $j+l$}};
\node[srcnode,anchor=north west] (c51) at ([yshift=0.4em]c41.south west) {\normalsize{// partition of span}};
\node[srcnode,anchor=north west] (c6) at ([xshift=1.5em,yshift=0.4em]c5.south west) {\normalsize{$hypos$ = Compose($span[j, k], span[k, j+l]$)}};
\node[srcnode,anchor=north west] (c7) at ([yshift=0.4em]c6.south west) {\normalsize{$span[j, j+l]$.Update($hypos$)}};
\node[srcnode,anchor=north west] (c8) at ([xshift=-4.5em,yshift=0.4em]c7.south west) {\normalsize{\textbf{return} $span[0, J]$}};
\node[anchor=west] (c9) at ([xshift=-3.2em,yshift=1.7em]c1.west) {\small{\textrm{参数:}\textbf{s}为输入字符串。$G$为输入CFG。$J$为待分析字符串长度。}};
\node[anchor=west] (c10) at ([xshift=0em,yshift=1.3em]c9.west) {\small{\textrm{输出:字符串全部可能的语法分析结果}}};
\node[anchor=west] (c11) at ([xshift=0em,yshift=1.3em]c10.west) {\small{\textrm{输入:符合乔姆斯基范式的待分析字符串和一个上下文无关文法(CFG)}}};
\begin{pgfonlayer}{background}
\node [rectangle,inner sep=0.2em,rounded corners=1pt,fill=blue!10!white] [fit = (c1) (c21) (c3) (c6) (c7) (c8) (c11)] (gl1) {};
\end{pgfonlayer}
\end{scope}
\end{tikzpicture}
\end{center}
%------------------------------------------------------------------------------------------------------------
%%% 基于树的解码方法 - chart-based decoding
\begin{center}
\begin{tikzpicture}\footnotesize
\begin{scope}[scale=0.2]
\node[anchor=south east] (g1) at (0,0) {\small{$\textrm{S} \to \textrm{AB}\ \ \ \textrm{A} \to \textrm{CD}\ \vert \ \textrm{CF}\ \ \ \textrm{B} \to \textrm{c}\ \vert \ \textrm{BE}$}};
\node[anchor=north west] (g2) at ([yshift=0.3em]g1.south west) {\small{$\textrm{C} \to \textrm{a}\ \ \ \ \textrm{D} \to \textrm{b}\ \ \ \ \textrm{E} \to \textrm{c}\ \ \ \ \textrm{F} \to \textrm{AD}$}};
\begin{pgfonlayer}{background}
\node [rectangle,inner sep=0.1em,rounded corners=1pt,fill=green!10,drop shadow,draw=ugreen] [fit = (g1) (g2)] (gl1) {};
\end{pgfonlayer}
\end{scope}
\end{tikzpicture}
\end{center}
......@@ -18,7 +18,7 @@
\renewcommand\tablename{}% Table => 表
\definecolor{ublue}{rgb}{0.152,0.250,0.545} % Color of deep blue
\definecolor{ugreen}{rgb}{0,0.5,0} % Color of deep green
\chapterimage{fig-NEU-6.jpg} % Chapter heading image
\chapterimage{../Figures/fig-NEU-6.jpg} % Chapter heading image
%----------------------------------------------------------------------------------------
% CHAPTER 5
......@@ -1372,7 +1372,7 @@ y&=&{\rm{Sigmoid}}({\rm{Tanh}}(\mathbf x\cdot \mathbf w^{[1]}+\mathbf b^{[1]})\c
%----------------------------------------------
\begin{figure}[htp]
\centering
\includegraphics{./Chapter5/Figures/fig-gradient-descent.pdf}
\input{./Chapter5/Figures/fig-gradient-descent}
\caption{函数上一个点沿着不同方向移动的示例}
\label{fig:5-43}
\end{figure}
......@@ -2144,7 +2144,7 @@ w_{t+1}&=&w_t-\frac{\eta}{\sqrt{z_t+\epsilon}} v_t
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter5/Figures/fig-code-FNNLM}
\input{./Chapter5/Figures/fig-code-fnnlm}
\caption{FNNLM模型代码示例(NiuTensor)}
\label{fig:5-61}
\end{figure}
......@@ -2197,7 +2197,7 @@ w_{t+1}&=&w_t-\frac{\eta}{\sqrt{z_t+\epsilon}} v_t
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter5/Figures/fig-rnn-LM}
\input{./Chapter5/Figures/fig-rnn-lm}
\caption{基于循环神经网络的语言模型结构}
\label{fig:5-62}
\end{figure}
......@@ -2220,7 +2220,7 @@ w_{t+1}&=&w_t-\frac{\eta}{\sqrt{z_t+\epsilon}} v_t
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter5/Figures/fig-transformer-LM}
\input{./Chapter5/Figures/fig-transformer-lm}
\caption{Transformer语言模型结构}
\label{fig:5-63}
\end{figure}
......
......@@ -137,7 +137,7 @@
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter6/Figures/figure-numbers-of-WMT-systems}
\input{./Chapter6/Figures/figure-numbers-of-wmt-systems}
\caption{WMT冠军系统的数量}
\label{fig:6-3}
\end{figure}
......@@ -148,7 +148,7 @@
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter6/Figures/figure-score-of-mTER}
\input{./Chapter6/Figures/figure-score-of-mter}
\caption{不同系统在不同长度句子上的mTER分值(得分越低越好)}
\label{fig:6-4}
\end{figure}
......@@ -341,7 +341,7 @@ NMT & $ 21.7^{\ast}$ & $18.7^{\ast}$ & -1
\end{figure}
%----------------------------------------------
\parinterval 翻译过程的神经网络结构如图\ref{fig:6-7}所示,其中下方是编码器,上方是解码器。编码器会顺序处理源语言单词,将每个单词都表示成一个实数向量,也就是每个单词的词嵌入结果(绿色方框)。在词嵌入的基础上运行循环神经网络(蓝色方框)。在编码下一个时间步状态的时候,上一个时间步的隐藏状态会作为历史信息传入给循环神经网络。这样,句子中每个位置的信息都被向后传递,最后一个时间步的隐藏状态(红色方框)就包含了整个源语言句子的信息,也就得到了编码器的编码结果$\ \dash\ $源语言句子的分布式表示。
\parinterval 翻译过程的神经网络结构如图\ref{fig:6-7}所示,其中左边是编码器,右边是解码器。编码器会顺序处理源语言单词,将每个单词都表示成一个实数向量,也就是每个单词的词嵌入结果(绿色方框)。在词嵌入的基础上运行循环神经网络(蓝色方框)。在编码下一个时间步状态的时候,上一个时间步的隐藏状态会作为历史信息传入给循环神经网络。这样,句子中每个位置的信息都被向后传递,最后一个时间步的隐藏状态(红色方框)就包含了整个源语言句子的信息,也就得到了编码器的编码结果$\ \dash\ $源语言句子的分布式表示。
\parinterval 解码器直接把源语言句子的分布式表示作为输入的隐层状态,之后像编码器一样依次读入目标语言单词,这是一个标准的循环神经网络的执行过程。与编码器不同的是,解码器会有一个输出层,用于根据当前时间步的隐层状态生成目标语单词及其概率分布。可以看到,解码端当前时刻的输出单词与下一个时刻的输入单词是一样的。从这个角度说,解码器也是一种神经语言模型,只不过它会从另外一种语言(源语言)获得一些信息,而不是仅仅做单语句子的生成。具体来说,当生成第一个单词``I''时,解码器利用了源语言句子表示(红色方框)和目标语的起始词``<sos>''。在生成第二个单词``am''时,解码器利用了上一个时间步的隐藏状态(隐藏层变量)和已经生成的``I''的信息。这个过程会循环执行,直到生成完整的目标语句子。
......@@ -504,7 +504,7 @@ $\textrm{P}({y_j | \mathbf{s}_{j-1} ,y_{j-1},\mathbf{C}})$由Softmax实现,Sof
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter6/Figures/figure-3-base-problom-of-P}
\input{./Chapter6/Figures/figure-3-base-problom-of-p}
\caption{求解$\textrm{P} (y_j | \mathbf{y}_{<j},\mathbf{x})$的三个基本问题}
\label{fig:6-11}
\end{figure}
......@@ -638,10 +638,10 @@ $\textrm{P}({y_j | \mathbf{s}_{j-1} ,y_{j-1},\mathbf{C}})$由Softmax实现,Sof
%----------------------------------------------
\begin{figure}[htp]
\centering
\subfigure[遗忘门]{\input{./Chapter6/Figures/figure-LSTM01}}
\subfigure[输入门]{\input{./Chapter6/Figures/figure-LSTM02}}
\subfigure[记忆更新]{\input{./Chapter6/Figures/figure-LSTM03}}
\subfigure[输出门]{\input{./Chapter6/Figures/figure-LSTM04}}
\subfigure[遗忘门]{\input{./Chapter6/Figures/figure-lstm01}}
\subfigure[输入门]{\input{./Chapter6/Figures/figure-lstm02}}
\subfigure[记忆更新]{\input{./Chapter6/Figures/figure-lstm03}}
\subfigure[输出门]{\input{./Chapter6/Figures/figure-lstm04}}
\caption{LSTM中的门控结构}
\label{fig:6-15}
\end{figure}
......@@ -687,7 +687,7 @@ $\textrm{P}({y_j | \mathbf{s}_{j-1} ,y_{j-1},\mathbf{C}})$由Softmax实现,Sof
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter6/Figures/figure-the-whole-of-LSTM}
\input{./Chapter6/Figures/figure-the-whole-of-lstm}
\caption{LSTM的整体结构}
\label{fig:6-16}
\end{figure}
......@@ -706,9 +706,9 @@ $\textrm{P}({y_j | \mathbf{s}_{j-1} ,y_{j-1},\mathbf{C}})$由Softmax实现,Sof
%----------------------------------------------
\begin{figure}[htp]
\centering
\subfigure[重置门]{\input{./Chapter6/Figures/figure-GRU01}}
\subfigure[更新门]{\input{./Chapter6/Figures/figure-GRU02}}
\subfigure[隐藏状态更新]{\input{./Chapter6/Figures/figure-GRU03}}
\subfigure[重置门]{\input{./Chapter6/Figures/figure-gru01}}
\subfigure[更新门]{\input{./Chapter6/Figures/figure-gru02}}
\subfigure[隐藏状态更新]{\input{./Chapter6/Figures/figure-gru03}}
\caption{GRU中的门控结构}
\label{fig:6-17}
\end{figure}
......@@ -747,7 +747,7 @@ $\textrm{P}({y_j | \mathbf{s}_{j-1} ,y_{j-1},\mathbf{C}})$由Softmax实现,Sof
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter6/Figures/figure-bi-RNN}
\input{./Chapter6/Figures/figure-bi-rnn}
\caption{基于双向循环神经网络的机器翻译模型结构}
\label{fig:6-18}
\end{figure}
......@@ -768,7 +768,7 @@ $\textrm{P}({y_j | \mathbf{s}_{j-1} ,y_{j-1},\mathbf{C}})$由Softmax实现,Sof
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter6/Figures/figure-double-layer-RNN} \hspace{10em}
\input{./Chapter6/Figures/figure-double-layer-rnn} \hspace{10em}
\caption{基于双层循环神经网络的机器翻译模型结构}
\label{fig:6-19}
\end{figure}
......@@ -861,7 +861,7 @@ $\textrm{P}({y_j | \mathbf{s}_{j-1} ,y_{j-1},\mathbf{C}})$由Softmax实现,Sof
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter6/Figures/figure-calculation-process-of-context-vector-C}
\input{./Chapter6/Figures/figure-calculation-process-of-context-vector-c}
\caption{上下文向量$\mathbf{C}_j$的计算过程}
\label{fig:6-23}
\end{figure}
......@@ -1353,7 +1353,7 @@ L(\mathbf{Y},\widehat{\mathbf{Y}}) = \sum_{j=1}^n L_{\textrm{ce}}(\mathbf{y}_j,\
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter6/Figures/figure-structure-of-GNMT}
\input{./Chapter6/Figures/figure-structure-of-gnmt}
\caption{GNMT结构}
\label{fig:6-35}
\end{figure}
......@@ -1538,7 +1538,7 @@ L(\mathbf{Y},\widehat{\mathbf{Y}}) = \sum_{j=1}^n L_{\textrm{ce}}(\mathbf{y}_j,\
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter6/Figures/figure-calculation-of-context-vector-C}
\input{./Chapter6/Figures/figure-calculation-of-context-vector-c}
\caption{``机票''的更进一步抽象表示$\tilde{\mathbf{h}}$的计算}
\label{fig:6-41}
\end{figure}
......
\begin{tikzpicture}
\node [rectangle,inner sep=2pt,font=\scriptsize] (center) at (0,0) {
\begin{tabular}{c}
Feedback signals during the loop:\\
$R(x,f,g)=s(x,x')$:BLEU of $x'$ given $x$ \\
$L(y)$ and $L(x')$:Language model of $y$ and $x'$
\end{tabular}
};
\node [rectangle,inner sep=2pt,font=\scriptsize] (top) at ([yshift=3em,xshift=0em]center.north) {
\begin{tabular}{c}
En$->$Ch translation \\
Primal Task $f:x\rightarrow y$
\end{tabular}
};
\node [rectangle,inner sep=2pt,font=\scriptsize] (left) at ([yshift=0em,xshift=-3em]center.west) {
\begin{tabular}{c}
English sentence $x$ \\
New English sentence \\
$x' = g(y)$
\end{tabular}
};
\node [rectangle,inner sep=2pt,font=\scriptsize] (right) at ([yshift=0em,xshift=3em]center.east) {
\begin{tabular}{c}
Chinese sentence \\
$y= f(y) $
\end{tabular}
};
\node [rectangle,inner sep=2pt,font=\scriptsize] (down) at ([yshift=-3em,xshift=0em]center.south) {
Dual Task $g:y\rightarrow x$
};
\node [rectangle,inner sep=2pt,draw,thick,fill=green!20] (agent1) at ([xshift=-1em]left.west) {Agent};
\node [rectangle,inner sep=2pt,draw,thick,fill=blue!20] (agent2) at ([xshift=1em]right.east) {Agent};
\draw [-,line width=0.8pt] (left.north) .. controls +(north:0.8) and +(west:0.8) .. (top.west);
\draw [->,line width=0.8pt] (top.east) .. controls +(east:0.8) and +(north:0.8) .. (right.north);
\draw [->,line width=0.8pt] (down.west) .. controls +(west:0.8) and +(south:0.8) .. (left.south);
\draw [-,line width=0.8pt] (right.south) .. controls +(south:0.8) and +(east:0.8) .. (down.east) ;
\end{tikzpicture}
\ No newline at end of file
......@@ -994,7 +994,7 @@ y_{j}^{ls}=(1-\alpha) \cdot \tilde{y}_j + \alpha \cdot q
\noindent 即译文单词$y_j$依赖前面已经生成的单词$\mathbf{y}_{<j}=\{y_1,...,y_{j-1}\}$和源语言句子$\mathbf{x}$。显然,这个模型中,每一个目标语位置$j$都需要等待前面$j-1$个位置输出的结果。因此,自回归翻译会阻碍不同译文单词生成的并行化。特别是在GPU上,翻译的自回归性会大大降低计算的并行度,导致推断过程的效率不高。
\parinterval 对于这个问题,研究者也考虑移除翻译的自归回性\cite{Gu2017NonAutoregressiveNM},进行{\small\bfnew{非自回归翻译}}\index{非自回归翻译}Regressive Translation)\index{Regressive Translation}。非自回归翻译可以用如下公式描述:
\parinterval 对于这个问题,研究者也考虑移除翻译的自归回性\cite{Gu2017NonAutoregressiveNM},进行{\small\bfnew{非自回归翻译}}\index{非自回归翻译}Non-Autoregressive Translation)\index{Non-Autoregressive Translation}。非自回归翻译可以用如下公式描述:
\begin{eqnarray}
\textrm{P}(\mathbf{y}|\mathbf{x}) = \prod_{j=1}^{n} \textrm{P}(y_j| \mathbf{x})
\label{eq:7-7}
......@@ -1524,7 +1524,7 @@ p_l=\frac{l}{2L}\cdot \varphi
% NEW SUB-SECTION
%----------------------------------------------------------------------------------------
\subsection{单语数据的使用}\label{subsection-4.2.6}
\subsection{单语数据的使用}\label{subsection-7.2.6}
\parinterval 在统计机器翻译时代,使用单语数据训练语言模型就是构建机器翻译系统的关键步骤。好的语言模型往往会带来性能的增益。而这个现象在神经机器翻译中似乎并不明显,因为在大多数神经机器翻译的范式中,并不要求使用大规模单语数据来帮助机器翻译系统。甚至,连语言模型都不会作为一个独立的模块。这一方面是由于神经机器翻译系统的解码端本身就起着语言模型的作用,另一方面是由于数据的增多使得翻译模型可以更好的捕捉目标语言的规律。
......@@ -1618,7 +1618,7 @@ p_l=\frac{l}{2L}\cdot \varphi
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter7/Figures/figure-MASS}
\input{./Chapter7/Figures/figure-mass}
\caption{MASS 预训练方法}
\label{fig:7-39}
\end{figure}
......@@ -1672,7 +1672,7 @@ p_l=\frac{l}{2L}\cdot \varphi
\begin{itemize}
\vspace{0.5em}
\item ``知识''在模型间是可迁移的。也就是说,一个模型中蕴含的规律可以被另一个模型使用。最典型的例子就是预训练模型(见\ref{subsection-4.2.6})。使用单语数据学习到的表示模型,在双语的翻译任务中仍然可以发挥很好的作用。也就是,把单语语言模型学习到的知识迁移到双语翻译中对句子表示的任务中;
\item ``知识''在模型间是可迁移的。也就是说,一个模型中蕴含的规律可以被另一个模型使用。最典型的例子就是预训练模型(见\ref{subsection-7.2.6})。使用单语数据学习到的表示模型,在双语的翻译任务中仍然可以发挥很好的作用。也就是,把单语语言模型学习到的知识迁移到双语翻译中对句子表示的任务中;
\vspace{0.5em}
\item 模型所蕴含的``知识''比原始数据中的``知识''更容易被学习到。比如,机器翻译中大量使用的回译(伪数据)方法,就把模型的输出作为数据让系统进行学习。
\vspace{0.5em}
......
......@@ -17,7 +17,7 @@
\renewcommand\figurename{}%将figure改为图
\renewcommand\tablename{}%将figure改为图
\chapterimage{fig-NEU-1.jpg} % Chapter heading image
\chapterimage{../Figures/fig-NEU-1.jpg} % Chapter heading image
%----------------------------------------------------------------------------------------
% CHAPTER APPENDIX A
......
......@@ -588,6 +588,7 @@ addtohook={%
% Chapter 4
%----------------------------------------------------------------------------------------
\usepackage{pgffor}%图片中使用\foreach语句
\usepackage{ulem}%使用/sout
%----------------------------------------------------------------------------------------
% Chapter 6
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论