Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
Toy-MT-Introduction
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
单韦乔
Toy-MT-Introduction
Commits
3edd2773
Commit
3edd2773
authored
Mar 01, 2020
by
曹润柘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update chapter2-3
parent
2cb7736f
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
41 行增加
和
74 行删除
+41
-74
Book/Chapter2/chapter2.tex
+9
-14
Book/Chapter3/Chapter3.tex
+0
-0
Book/Chapter3/Figures/figure-calculation-of-the-expected-frequency-1.tex
+7
-0
Book/Chapter3/Figures/figure-calculation-of-the-expected-frequency-2.tex
+8
-0
Book/Chapter3/Figures/figure000.pdf
+0
-0
Book/Chapter3/Figures/figure000.tex
+17
-60
没有找到文件。
Book/Chapter2/chapter2.tex
查看文件 @
3edd2773
...
...
@@ -320,7 +320,6 @@
\begin{figure}
[htp]
\centering
\input
{
./Chapter2/Figures/figure-Self-information-function
}
\setlength
{
\belowcaptionskip
}{
-1.0em
}
\caption
{
自信息函数图像
}
\label
{
fig:Self-information-function
}
\end{figure}
...
...
@@ -376,7 +375,7 @@
\label
{
fig:a-simple-pre-processing-process
}
\end{figure}
%-------------------------------------------
\vspace
{
-0.5em
}
%
\vspace{-0.5em}
\parinterval
分词得到的单元序列可以是语言学上的词序列,也可以是根据其它定义的单元。在本章中,我们把分词得到的一个个单元称为单词,尽管这些单元可以不是语言学上的完整单词。而这个过程也被称作词法分析。除了汉语,词法分析在日语、泰语等单词之间无明确分割符的语言中有着广泛的应用,芬兰语、维吾尔语等一些形态学十分丰富的语言,也需要使用词法分析来解决复杂的词尾、词缀变化等形态学变化。
\parinterval
在机器翻译中,分词系统的好坏往往会决定机器翻译的质量。分词的目的是定义系统处理的基本单元,那么什么叫做``词''呢?关于词的定义有很多,比如:
\\
...
...
@@ -397,7 +396,7 @@
\parinterval
从语言学的角度,普遍认为词是可以单独运用的、包含意义的基本单位。我们使用有限的词可以组合出无限的句子,这也正体现出自然语言的奇妙之处。
\parinterval
不过,机器翻译并不仅仅局限在语言学定义的单词,因此机器翻译系统所使用的分词也不仅仅把句子按照词切开,比如,神经机器翻译中广泛使用的BPE子词切分方法,可以被理解为将词的一部分也进行切开,也就是得到词片段送给机器翻译系统使用。比如,对如下英文字符串,可以得到如下切分结果
\parinterval
不过,机器翻译并不仅仅局限在语言学定义的单词,因此机器翻译系统所使用的分词也不仅仅把句子按照词切开,比如,神经机器翻译中广泛使用的BPE子词切分方法,可以被理解为将词的一部分也进行切开,也就是得到词片段送给机器翻译系统使用。比如,对如下英文字符串,可以得到如下切分结果
\parinterval
Interesting
\;
->
\;
Interest/ing selection
\;
->
\;
se/lect/ion procession
\hspace
{
0.23em
}
->
\;
pro/cess/ion
...
...
@@ -419,7 +418,6 @@
\begin{figure}
[htp]
\centering
\input
{
./Chapter2/Figures/figure-Example-of-word-segmentation-based-on-dictionary
}
\setlength
{
\belowcaptionskip
}{
-0.2cm
}
\caption
{
基于词典进行分词实例
}
\label
{
fig:Example-of-word-segmentation-based-on-dictionary
}
\end{figure}
...
...
@@ -432,7 +430,6 @@
\begin{figure}
[htp]
\centering
\input
{
./Chapter2/Figures/figure-cross-type-word-segmentation-ambiguity
}
\setlength
{
\belowcaptionskip
}{
-0.5em
}
\caption
{
交叉型分词歧义
}
\label
{
fig:cross-type-word-segmentation-ambiguity
}
\end{figure}
...
...
@@ -464,6 +461,7 @@
\begin{figure}
[htp]
\centering
\input
{
./Chapter2/Figures/figure-word-segmentation-based-on-statistics
}
\setlength
{
\belowcaptionskip
}{
-0.5cm
}
\caption
{
基于统计的分词流程
}
\label
{
fig:word-segmentation-based-on-statistics
}
\end{figure}
...
...
@@ -480,7 +478,7 @@
\begin{figure}
[htp]
\centering
\input
{
./Chapter2/Figures/figure-the-dice-game
}
\setlength
{
\belowcaptionskip
}{
-0.
2
cm
}
\setlength
{
\belowcaptionskip
}{
-0.
5
cm
}
\caption
{
骰子结果
}
\label
{
fig:the-dice-game
}
\end{figure}
...
...
@@ -531,7 +529,6 @@
\begin{figure}
[htp]
\centering
\input
{
./Chapter2/Figures/figure-the-dice-game-model
}
\setlength
{
\belowcaptionskip
}{
-1.0em
}
\caption
{
预设的骰子模型
}
\label
{
fig:the-dice-game-model
}
\end{figure}
...
...
@@ -780,7 +777,7 @@
\label
{
fig:no-smoothing
&
smoothed-probability-distributions
}
\end{figure}
%-------------------------------------------
\vspace
{
-1.5em
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection
{
古德-图灵估计法
}
\index
{
Chapter2.4.2.2
}
...
...
@@ -799,7 +796,6 @@ r^* = (r + 1)\frac{n_{r + 1}}{n_r}
\end{eqnarray}
\parinterval
基于这个公式,就可以估计所有0次
$
n
$
元语法的频次
$
n
_
0
r
_
0
^
*=(
r
_
0
+
1
)
n
_
1
=
n
_
1
$
。要把这个重新估计的统计数转化为概率,只需要进行归一化处理:对于每个统计数为
$
r
$
的事件,其概率为
$
\textrm
{
P
}_
r
=
r
^
*/
N
$
,其中
\begin{eqnarray}
N
&
=
&
\sum
_{
r=0
}^{
\infty
}{
r
^{
*
}
n
_
r
}
\nonumber
\\
&
=
&
\sum
_{
r=0
}^{
\infty
}{
(r + 1)n
_{
r + 1
}}
\nonumber
\\
...
...
@@ -841,10 +837,10 @@ N & = & \sum_{r>0}{p_r n_r} \nonumber \\
\vspace
{
-1.5em
}
\parinterval
很多时候会出现
$
n
_{
r
+
1
}
=
0
$
的情况,这是对于当
$
r
$
很大的时候很常见的情况,而且通常情况下当
$
r
$
很大时,
$
n
_
r
$
也会有噪音的存在。这种简单的Good-Turing方法无法应对这些复杂的情况,随着更多的研究和发展,成为了一些其他平滑方法的基础。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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
首先介绍一下absolute discounting平滑算法,公式如下所示:
...
...
@@ -1065,8 +1061,8 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{
\parinterval
但是,句子和规则的推导并不是一一对应的。同一个句子,往往有很多推导与之对应,我们称为歧义。甚至同一棵句法树,也可以对应不同的推导。
\vspace
{
-1.0em
}
\parinterval
图
\ref
{
fig:two-different-derivation-of-regulation
}
给出一个同一棵句法树所对应的两种不同的规则推导。
%-------------------------------------------
%图2.5.2.4
\begin{figure}
[htp]
...
...
@@ -1078,7 +1074,6 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{
\end{figure}
%-------------------------------------------
\vspace
{
-0.5em
}
\parinterval
显然,这样使用不同的规则顺序进行树的生成会导致句法树的推导这一确定的过程变得不确定。因此,需要进行消歧。这里,我们可以使用启发式方法:要求规则使用都服从最左优先原则,这样得到的推导被称为最左优先推导。图中推导1就是符合最左优先原则的推导。
\parinterval
这样,对于一个上下文无关文法,每一棵句法树都有唯一的最左推导与之对应。这样,句法分析可以被描述为:对于一个句子找到能够生成它的最佳推导,这个推导所对应的句法树就是这个句子的句法分析结果。
...
...
@@ -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
}
\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
}
)。
%-------------------------------------------
%图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}{
\caption
{
不同推导(句法树)对应的概率值
}
\label
{
fig:probability-values-corresponding-to-different-derivations
}
\end{figure}
%-------------------------------------------
\vspace
{
-1.5em
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection
{
规则和推导的概率
}
\index
{
Chapter2.5.3
}
...
...
Book/Chapter3/Chapter3.tex
查看文件 @
3edd2773
差异被折叠。
点击展开。
Book/Chapter3/Figures/figure-calculation-of-the-expected-frequency-1.tex
0 → 100644
查看文件 @
3edd2773
\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}
Book/Chapter3/Figures/figure-calculation-of-the-expected-frequency-2.tex
0 → 100644
查看文件 @
3edd2773
\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}
Book/Chapter3/Figures/figure000.pdf
查看文件 @
3edd2773
No preview for this file type
Book/Chapter3/Figures/figure000.tex
查看文件 @
3edd2773
...
...
@@ -43,66 +43,23 @@
%-------------------------------------------------------------------------
%%% 简易机器翻译系统 - step 3 decoding - example
\begin{tikzpicture}
\begin{scope}
\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);
%%%%%%%%%%%%%%%%%%%%%%%%%%
\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
}
;
\node
[anchor=north,circle,draw,thick,minimum width=3em,fill=red!30,drop shadow](num2-1) at ([yshift=-3.0em]num2.south)
{
正
}
;
\draw
[->,very thick]([xshift=0.2em]num1.east) -- ([xshift=-0.2em]num2.west);
\draw
[->,very thick,ublue]([yshift=-0.2em]num2.south) -- ([yshift=0.2em]num2-1.north);
%%%%%%%%%%%%%%%%%%%%%%%%%%
\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}
\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}
%---------------------------------------------------------------------
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论