Commit 3edd2773 by 曹润柘

update chapter2-3

parent 2cb7736f
...@@ -320,7 +320,6 @@ ...@@ -320,7 +320,6 @@
\begin{figure}[htp] \begin{figure}[htp]
\centering \centering
\input{./Chapter2/Figures/figure-Self-information-function} \input{./Chapter2/Figures/figure-Self-information-function}
\setlength{\belowcaptionskip}{-1.0em}
\caption{自信息函数图像} \caption{自信息函数图像}
\label{fig:Self-information-function} \label{fig:Self-information-function}
\end{figure} \end{figure}
...@@ -376,7 +375,7 @@ ...@@ -376,7 +375,7 @@
\label{fig:a-simple-pre-processing-process} \label{fig:a-simple-pre-processing-process}
\end{figure} \end{figure}
%------------------------------------------- %-------------------------------------------
\vspace{-0.5em} %\vspace{-0.5em}
\parinterval 分词得到的单元序列可以是语言学上的词序列,也可以是根据其它定义的单元。在本章中,我们把分词得到的一个个单元称为单词,尽管这些单元可以不是语言学上的完整单词。而这个过程也被称作词法分析。除了汉语,词法分析在日语、泰语等单词之间无明确分割符的语言中有着广泛的应用,芬兰语、维吾尔语等一些形态学十分丰富的语言,也需要使用词法分析来解决复杂的词尾、词缀变化等形态学变化。 \parinterval 分词得到的单元序列可以是语言学上的词序列,也可以是根据其它定义的单元。在本章中,我们把分词得到的一个个单元称为单词,尽管这些单元可以不是语言学上的完整单词。而这个过程也被称作词法分析。除了汉语,词法分析在日语、泰语等单词之间无明确分割符的语言中有着广泛的应用,芬兰语、维吾尔语等一些形态学十分丰富的语言,也需要使用词法分析来解决复杂的词尾、词缀变化等形态学变化。
\parinterval 在机器翻译中,分词系统的好坏往往会决定机器翻译的质量。分词的目的是定义系统处理的基本单元,那么什么叫做``词''呢?关于词的定义有很多,比如:\\ \parinterval 在机器翻译中,分词系统的好坏往往会决定机器翻译的质量。分词的目的是定义系统处理的基本单元,那么什么叫做``词''呢?关于词的定义有很多,比如:\\
...@@ -397,7 +396,7 @@ ...@@ -397,7 +396,7 @@
\parinterval 从语言学的角度,普遍认为词是可以单独运用的、包含意义的基本单位。我们使用有限的词可以组合出无限的句子,这也正体现出自然语言的奇妙之处。 \parinterval 从语言学的角度,普遍认为词是可以单独运用的、包含意义的基本单位。我们使用有限的词可以组合出无限的句子,这也正体现出自然语言的奇妙之处。
\parinterval 不过,机器翻译并不仅仅局限在语言学定义的单词,因此机器翻译系统所使用的分词也不仅仅把句子按照词切开,比如,神经机器翻译中广泛使用的BPE子词切分方法,可以被理解为将词的一部分也进行切开,也就是得到词片段送给机器翻译系统使用。比如,对如下英文字符串,可以得到如下切分结果 \parinterval 不过,机器翻译并不仅仅局限在语言学定义的单词,因此机器翻译系统所使用的分词也不仅仅把句子按照词切开,比如,神经机器翻译中广泛使用的BPE子词切分方法,可以被理解为将词的一部分也进行切开,也就是得到词片段送给机器翻译系统使用。比如,对如下英文字符串,可以得到如下切分结果
\parinterval Interesting \; -> \; Interest/ing selection \;->\;se/lect/ion procession \hspace{0.23em} -> \; pro/cess/ion \parinterval Interesting \; -> \; Interest/ing selection \;->\;se/lect/ion procession \hspace{0.23em} -> \; pro/cess/ion
...@@ -419,7 +418,6 @@ ...@@ -419,7 +418,6 @@
\begin{figure}[htp] \begin{figure}[htp]
\centering \centering
\input{./Chapter2/Figures/figure-Example-of-word-segmentation-based-on-dictionary} \input{./Chapter2/Figures/figure-Example-of-word-segmentation-based-on-dictionary}
\setlength{\belowcaptionskip}{-0.2cm}
\caption{基于词典进行分词实例} \caption{基于词典进行分词实例}
\label{fig:Example-of-word-segmentation-based-on-dictionary} \label{fig:Example-of-word-segmentation-based-on-dictionary}
\end{figure} \end{figure}
...@@ -432,7 +430,6 @@ ...@@ -432,7 +430,6 @@
\begin{figure}[htp] \begin{figure}[htp]
\centering \centering
\input{./Chapter2/Figures/figure-cross-type-word-segmentation-ambiguity} \input{./Chapter2/Figures/figure-cross-type-word-segmentation-ambiguity}
\setlength{\belowcaptionskip}{-0.5em}
\caption{交叉型分词歧义} \caption{交叉型分词歧义}
\label{fig:cross-type-word-segmentation-ambiguity} \label{fig:cross-type-word-segmentation-ambiguity}
\end{figure} \end{figure}
...@@ -464,6 +461,7 @@ ...@@ -464,6 +461,7 @@
\begin{figure}[htp] \begin{figure}[htp]
\centering \centering
\input{./Chapter2/Figures/figure-word-segmentation-based-on-statistics} \input{./Chapter2/Figures/figure-word-segmentation-based-on-statistics}
\setlength{\belowcaptionskip}{-0.5cm}
\caption{基于统计的分词流程} \caption{基于统计的分词流程}
\label{fig:word-segmentation-based-on-statistics} \label{fig:word-segmentation-based-on-statistics}
\end{figure} \end{figure}
...@@ -480,7 +478,7 @@ ...@@ -480,7 +478,7 @@
\begin{figure}[htp] \begin{figure}[htp]
\centering \centering
\input{./Chapter2/Figures/figure-the-dice-game} \input{./Chapter2/Figures/figure-the-dice-game}
\setlength{\belowcaptionskip}{-0.2cm} \setlength{\belowcaptionskip}{-0.5cm}
\caption{骰子结果} \caption{骰子结果}
\label{fig:the-dice-game} \label{fig:the-dice-game}
\end{figure} \end{figure}
...@@ -531,7 +529,6 @@ ...@@ -531,7 +529,6 @@
\begin{figure}[htp] \begin{figure}[htp]
\centering \centering
\input{./Chapter2/Figures/figure-the-dice-game-model} \input{./Chapter2/Figures/figure-the-dice-game-model}
\setlength{\belowcaptionskip}{-1.0em}
\caption{预设的骰子模型} \caption{预设的骰子模型}
\label{fig:the-dice-game-model} \label{fig:the-dice-game-model}
\end{figure} \end{figure}
...@@ -780,7 +777,7 @@ ...@@ -780,7 +777,7 @@
\label{fig:no-smoothing&smoothed-probability-distributions} \label{fig:no-smoothing&smoothed-probability-distributions}
\end{figure} \end{figure}
%------------------------------------------- %-------------------------------------------
\vspace{-1.5em}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{古德-图灵估计法}\index{Chapter2.4.2.2} \subsubsection{古德-图灵估计法}\index{Chapter2.4.2.2}
...@@ -799,7 +796,6 @@ r^* = (r + 1)\frac{n_{r + 1}}{n_r} ...@@ -799,7 +796,6 @@ r^* = (r + 1)\frac{n_{r + 1}}{n_r}
\end{eqnarray} \end{eqnarray}
\parinterval 基于这个公式,就可以估计所有0次$n$元语法的频次$n_0 r_0^*=(r_0+1)n_1=n_1$。要把这个重新估计的统计数转化为概率,只需要进行归一化处理:对于每个统计数为$r$的事件,其概率为$\textrm{P}_r=r^*/N$,其中 \parinterval 基于这个公式,就可以估计所有0次$n$元语法的频次$n_0 r_0^*=(r_0+1)n_1=n_1$。要把这个重新估计的统计数转化为概率,只需要进行归一化处理:对于每个统计数为$r$的事件,其概率为$\textrm{P}_r=r^*/N$,其中
\begin{eqnarray} \begin{eqnarray}
N & = & \sum_{r=0}^{\infty}{r^{*}n_r} \nonumber \\ N & = & \sum_{r=0}^{\infty}{r^{*}n_r} \nonumber \\
& = & \sum_{r=0}^{\infty}{(r + 1)n_{r + 1}} \nonumber \\ & = & \sum_{r=0}^{\infty}{(r + 1)n_{r + 1}} \nonumber \\
...@@ -841,10 +837,10 @@ N & = & \sum_{r>0}{p_r n_r} \nonumber \\ ...@@ -841,10 +837,10 @@ N & = & \sum_{r>0}{p_r n_r} \nonumber \\
\vspace{-1.5em} \vspace{-1.5em}
\parinterval 很多时候会出现$n_{r+1}=0$的情况,这是对于当$r$很大的时候很常见的情况,而且通常情况下当$r$很大时,$n_r$也会有噪音的存在。这种简单的Good-Turing方法无法应对这些复杂的情况,随着更多的研究和发展,成为了一些其他平滑方法的基础。 \parinterval 很多时候会出现$n_{r+1}=0$的情况,这是对于当$r$很大的时候很常见的情况,而且通常情况下当$r$很大时,$n_r$也会有噪音的存在。这种简单的Good-Turing方法无法应对这些复杂的情况,随着更多的研究和发展,成为了一些其他平滑方法的基础。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Kneser-Ney平滑方法}\index{Chapter2.4.2.3} \subsubsection{Kneser-Ney平滑方法}\index{Chapter2.4.2.3}
\vspace{-1.0em}
\parinterval Kneser-Ney平滑方法由R.Kneser和H.Ney于1995年提出的用于计算$n$元语法概率分布的方法\cite{kneser1995improved}\cite{chen1999empirical}。基于absolute discounting,并被广泛认为是最有效的平滑方法。这种平滑方法改进了absolute discounting中与高阶分布相结合的低阶分布的计算方法,使不同阶分布得到充分的利用。这种算法综合利用了其他多种平滑算法的思想,是一种先进而且标准的平滑算法。 \parinterval Kneser-Ney平滑方法由R.Kneser和H.Ney于1995年提出的用于计算$n$元语法概率分布的方法\cite{kneser1995improved}\cite{chen1999empirical}。基于absolute discounting,并被广泛认为是最有效的平滑方法。这种平滑方法改进了absolute discounting中与高阶分布相结合的低阶分布的计算方法,使不同阶分布得到充分的利用。这种算法综合利用了其他多种平滑算法的思想,是一种先进而且标准的平滑算法。
\parinterval 首先介绍一下absolute discounting平滑算法,公式如下所示: \parinterval 首先介绍一下absolute discounting平滑算法,公式如下所示:
...@@ -1065,8 +1061,8 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{ ...@@ -1065,8 +1061,8 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{
\parinterval 但是,句子和规则的推导并不是一一对应的。同一个句子,往往有很多推导与之对应,我们称为歧义。甚至同一棵句法树,也可以对应不同的推导。 \parinterval 但是,句子和规则的推导并不是一一对应的。同一个句子,往往有很多推导与之对应,我们称为歧义。甚至同一棵句法树,也可以对应不同的推导。
\vspace{-1.0em}
\parinterval\ref{fig:two-different-derivation-of-regulation}给出一个同一棵句法树所对应的两种不同的规则推导。 \parinterval\ref{fig:two-different-derivation-of-regulation}给出一个同一棵句法树所对应的两种不同的规则推导。
%------------------------------------------- %-------------------------------------------
%图2.5.2.4 %图2.5.2.4
\begin{figure}[htp] \begin{figure}[htp]
...@@ -1078,7 +1074,6 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{ ...@@ -1078,7 +1074,6 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{
\end{figure} \end{figure}
%------------------------------------------- %-------------------------------------------
\vspace{-0.5em}
\parinterval 显然,这样使用不同的规则顺序进行树的生成会导致句法树的推导这一确定的过程变得不确定。因此,需要进行消歧。这里,我们可以使用启发式方法:要求规则使用都服从最左优先原则,这样得到的推导被称为最左优先推导。图中推导1就是符合最左优先原则的推导。 \parinterval 显然,这样使用不同的规则顺序进行树的生成会导致句法树的推导这一确定的过程变得不确定。因此,需要进行消歧。这里,我们可以使用启发式方法:要求规则使用都服从最左优先原则,这样得到的推导被称为最左优先推导。图中推导1就是符合最左优先原则的推导。
\parinterval 这样,对于一个上下文无关文法,每一棵句法树都有唯一的最左推导与之对应。这样,句法分析可以被描述为:对于一个句子找到能够生成它的最佳推导,这个推导所对应的句法树就是这个句子的句法分析结果。 \parinterval 这样,对于一个上下文无关文法,每一棵句法树都有唯一的最左推导与之对应。这样,句法分析可以被描述为:对于一个句子找到能够生成它的最佳推导,这个推导所对应的句法树就是这个句子的句法分析结果。
...@@ -1094,7 +1089,7 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{ ...@@ -1094,7 +1089,7 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{
\label{fig:perspectives-of-expert-ordinary-and-syntactic-parser} \label{fig:perspectives-of-expert-ordinary-and-syntactic-parser}
\end{figure} \end{figure}
%------------------------------------------- %-------------------------------------------
\vspace{-1.0em}
\parinterval 在统计句法分析中,我们需要对每个推导进行统计建模,于是我们得到一个模型$\textrm{P}( \cdot )$,对于任意的推导$d$,都可以用$\textrm{P}(d)$计算推导$d$的概率。这样,给定一个输入句子,我们可以对所有可能的推导用$\textrm{P}(d)$计算其概率值,并选择概率最大的结果作为句法分析的结果输出(图\ref{fig:probability-values-corresponding-to-different-derivations})。 \parinterval 在统计句法分析中,我们需要对每个推导进行统计建模,于是我们得到一个模型$\textrm{P}( \cdot )$,对于任意的推导$d$,都可以用$\textrm{P}(d)$计算推导$d$的概率。这样,给定一个输入句子,我们可以对所有可能的推导用$\textrm{P}(d)$计算其概率值,并选择概率最大的结果作为句法分析的结果输出(图\ref{fig:probability-values-corresponding-to-different-derivations})。
%------------------------------------------- %-------------------------------------------
%图2.5.2.6 %图2.5.2.6
...@@ -1104,8 +1099,8 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{ ...@@ -1104,8 +1099,8 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{
\caption{不同推导(句法树)对应的概率值} \caption{不同推导(句法树)对应的概率值}
\label{fig:probability-values-corresponding-to-different-derivations} \label{fig:probability-values-corresponding-to-different-derivations}
\end{figure} \end{figure}
%------------------------------------------- %-------------------------------------------
\vspace{-1.5em}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{规则和推导的概率}\index{Chapter2.5.3} \subsection{规则和推导的概率}\index{Chapter2.5.3}
......
\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}
\qquad
\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}
...@@ -43,66 +43,23 @@ ...@@ -43,66 +43,23 @@
%------------------------------------------------------------------------- %-------------------------------------------------------------------------
%%% 简易机器翻译系统 - step 3 decoding - example \begin{tabular}{c|c}
\multicolumn{1}{c|}{$x_i$} & c($x_i$) \\ \hline
\multicolumn{1}{c|}{$x_1$} & 2 \\
\begin{tikzpicture} \multicolumn{1}{c|}{$x_2$} & 1 \\
\multicolumn{1}{c|}{$x_3$} & 5 \\ \hline
\multicolumn{2}{c}{$c(X)=8$}
\begin{scope} \end{tabular}
\node [anchor=west,draw,thick,minimum width=3em, minimum height=2.2em,fill=green!30,drop shadow](num1) at (0,0) {C};
\node [anchor=north,circle,draw,thick,minimum width=3em,fill=red!30,drop shadow](num1-1) at ([yshift=-3.0em]num1.south) {};
\draw [->,very thick,ublue]([yshift=-0.2em]num1.south) -- ([yshift=0.2em]num1-1.north); \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 \\
\node [anchor=west,draw,thick,minimum width=3em, minimum height=2.2em,fill=green!30,drop shadow](num2) at ([xshift=3.5em]num1.east) {B}; \multicolumn{1}{c|}{$x_2$} & 1 & 0.3 & 0.3 \\
\node [anchor=north,circle,draw,thick,minimum width=3em,fill=red!30,drop shadow](num2-1) at ([yshift=-3.0em]num2.south) {}; \multicolumn{1}{c|}{$x_3$} & 5 & 0.2 & 1.0 \\ \hline
\draw [->,very thick]([xshift=0.2em]num1.east) -- ([xshift=-0.2em]num2.west); \multicolumn{4}{c}{$c(X)=0.2+0.3+1.0=1.5$}
\draw [->,very thick,ublue]([yshift=-0.2em]num2.south) -- ([yshift=0.2em]num2-1.north); \end{tabular}
%%%%%%%%%%%%%%%%%%%%%%%%%%
\node [anchor=west,draw,thick,minimum width=3em, minimum height=2.2em,fill=green!30,drop shadow](num3) at ([xshift=3.5em]num2.east) {A};
\node [anchor=north,circle,draw,thick,minimum width=3em,fill=red!30,drop shadow](num3-1) at ([yshift=-3.0em]num3.south) {};
\draw [->,very thick]([xshift=0.2em]num2.east) -- ([xshift=-0.2em]num3.west);
\draw [->,very thick,ublue]([yshift=-0.2em]num3.south) -- ([yshift=0.2em]num3-1.north);
%%%%%%%%%%%%%%%%%%%%%%%%%%
\node [anchor=west,draw,thick,minimum width=3em, minimum height=2.2em,fill=green!30,drop shadow](num4) at ([xshift=3.5em]num3.east) {B};
\node [anchor=north,circle,draw,thick,minimum width=3em,fill=red!30,drop shadow](num4-1) at ([yshift=-3.0em]num4.south) {};
\draw [->,very thick]([xshift=0.2em]num3.east) -- ([xshift=-0.2em]num4.west);
\draw [->,very thick,ublue]([yshift=-0.2em]num4.south) -- ([yshift=0.2em]num4-1.north);
%%%%%%%%%%%%%%%%%%%%%%%%%%
\node [anchor=west,draw,thick,minimum width=3em, minimum height=2.2em,fill=green!30,drop shadow](num5) at ([xshift=3.5em]num4.east) {C};
\node [anchor=north,circle,draw,thick,minimum width=3em,fill=red!30,drop shadow](num5-1) at ([yshift=-3.0em]num5.south) {};
\draw [->,very thick]([xshift=0.2em]num4.east) -- ([xshift=-0.2em]num5.west);
\draw [->,very thick,ublue]([yshift=-0.2em]num5.south) -- ([yshift=0.2em]num5-1.north);
%%%%%%%%%%%%%%%%%%%%%%%%%%
\node [anchor=west,draw,thick,minimum width=3em, minimum height=2.2em,fill=green!30,drop shadow](num6) at ([xshift=3.5em]num5.east) {A};
\node [anchor=north,circle,draw,thick,minimum width=3em,fill=red!30,drop shadow](num6-1) at ([yshift=-3.0em]num6.south) {};
\draw [->,very thick]([xshift=0.2em]num5.east) -- ([xshift=-0.2em]num6.west);
\draw [->,very thick,ublue]([yshift=-0.2em]num6.south) -- ([yshift=0.2em]num6-1.north);
\node [anchor=north](word1) at ([xshift=1.0em,yshift=-1.0em]num1-1.south) {图示说明:};
\node [anchor=north,draw,thick,minimum width=3em, minimum height=2.2em,fill=green!30,drop shadow](word2) at ([xshift=-1.0em,yshift=-1.0em]word1.south) {C};
\node [anchor=west](word2-2) at ([xshift=1.5em]word2.east) {一个隐含状态};
\node [anchor=north,circle,draw,thick,minimum width=3em,fill=red!30,drop shadow](word3) at ([xshift=-1.0em,yshift=-5.5em]word1.south) {};
\node [anchor=west](word3-2) at ([xshift=1.5em]word3.east) {一个可见状态};
\draw [->,very thick]([xshift=5.2em]word2-2.east) -- ([xshift=8.3em]word2-2.east);
\node [anchor=west](word4) at ([xshift=9.8em]word2-2.east) {从一个隐含状态到下一个};
\node [anchor=north](word4-1) at ([xshift=-2.0em]word4.south) {隐含状态的转换};
\draw [->,very thick,ublue]([xshift=16.6em,yshift=-0.2em]word3.north) -- ([xshift=16.6em,yshift=0.2em]word3.south);
\node [anchor=north](word5) at ([xshift=2.0em,yshift=-1.65em]word4-1.south) {从一个隐含状态到可见状};
\node [anchor=north](word5-1) at ([xshift=-3.6em]word5.south) {态的输出};
\end{scope}
\end{tikzpicture}
%--------------------------------------------------------------------- %---------------------------------------------------------------------
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论