Commit 5a64fb5b by 曹润柘

update chapter3

parent 3f350c1b
......@@ -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}
......
%%% 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}
%---------------------------------------------------------------------
%%% 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
%-------------------------------------------------------------------------
\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}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论