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
NiuTrans
Toy-MT-Introduction
Commits
5acc4f13
Commit
5acc4f13
authored
Dec 26, 2019
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new pages
parent
d9d8616e
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
293 行增加
和
19 行删除
+293
-19
Section04-Phrasal-and-Syntactic-Models/section04-test.tex
+23
-16
Section04-Phrasal-and-Syntactic-Models/section04.tex
+270
-3
没有找到文件。
Section04-Phrasal-and-Syntactic-Models/section04-test.tex
查看文件 @
5acc4f13
...
...
@@ -256,6 +256,13 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
%%% 规则的组装对应翻译过程
\begin{frame}
{
使用规则定义翻译过程
}
\begin{itemize}
\item
规则的推导描述双语句子同步生成(和分析)的过程
\begin{itemize}
\item
\raisebox
{
0.3em
}{
\tikz
{
\draw
[*-*]
(0,0)--(0.5,0);
}}
表示对边缘阶段(变量)的替换操作
\end{itemize}
\end{itemize}
\begin{tikzpicture}
% target side
...
...
@@ -263,11 +270,11 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
\node
[scale=0.8]
at (1.5, 2.2)
{
目标语言
}
;
\node
[scale=0.6, inner sep=0.1cm, draw]
(tfrag1) at
\node
[scale=0.6, inner sep=0.1cm, draw
,xshift=1em
]
(tfrag1) at
(0,0.05)
{
\Tree
[.NP [.DT the ]
[.NNS imports ]]
}
;
\visible
<4->
{
\node
[scale=0.6, inner sep=0.1cm, draw, sibling distance=1
15
pt]
(tfrag2) at
\node
[scale=0.6, inner sep=0.1cm, draw, sibling distance=1
00
pt]
(tfrag2) at
(1.4,1.4)
{
\Tree
[.S [.NP ]
[.VP ]]
}
;
}
...
...
@@ -281,9 +288,9 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
(2.8,-1.8)
{
\Tree
[.RB drastically ]
}
;
}
\visible
<4->
{
\draw
[
<->]
(0.00,0.7) -- (0.00,1.0
);
}
\visible
<4->
{
\draw
[
<->]
(2.9,0.7) -- (2.9,1.0
);
}
\visible
<3->
{
\draw
[
<->
]
(2.4,-1.4) .. controls +(north:0.6) and +(south:0.6) .. (3.0,-0.6);
}
\visible
<4->
{
\draw
[
*-*]
(0.15,0.7) -- (0.15,1.05
);
}
\visible
<4->
{
\draw
[
*-*]
(2.7,0.7) -- (2.7,1.05
);
}
\visible
<3->
{
\draw
[
*-*
]
(2.4,-1.4) .. controls +(north:0.6) and +(south:0.6) .. (3.0,-0.6);
}
\end{scope}
% source side
...
...
@@ -311,14 +318,14 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
(1.3,-1.3)
{
\Tree
[.AD 大幅度 ]
}
;
}
\visible
<4->
{
\draw
[
<->
]
(0.05,0.5) -- (0.05,0.95);
}
\visible
<4->
{
\draw
[
<->
]
(4.15,0.5) -- (4.15,0.95);
}
\visible
<3->
{
\draw
[
<->
]
(1.55,-0.95) .. controls +(east:1.0) and +(south:0.4) .. (3.5,-0.6);
}
\visible
<4->
{
\draw
[
*-*
]
(0.05,0.5) -- (0.05,0.95);
}
\visible
<4->
{
\draw
[
*-*
]
(4.15,0.5) -- (4.15,0.95);
}
\visible
<3->
{
\draw
[
*-*
]
(1.55,-0.95) .. controls +(east:1.0) and +(south:0.4) .. (3.5,-0.6);
}
\end{scope}
% rule 1
\begin{scope}
[scale=0.6, xshift=-22em, yshift=-1
3
em, level distance=20pt]
\begin{scope}
[scale=0.6, xshift=-22em, yshift=-1
2
em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.NN 进口 ]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
...
...
@@ -327,7 +334,7 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
\end{scope}
% rule 2
\begin{scope}
[scale=0.6, xshift=-1
0em, yshift=-13
em, level distance=20pt]
\begin{scope}
[scale=0.6, xshift=-1
1em, yshift=-12
em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.AD 大幅度 ]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
...
...
@@ -336,7 +343,7 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
\end{scope}
% rule 3
\begin{scope}
[scale=0.6, xshift=
3em, yshift=-13
em, level distance=20pt]
\begin{scope}
[scale=0.6, xshift=
2em, yshift=-12
em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-7em]
\Tree
[.VP [.AD ]
[.ADVP [.VV 下降 ] [.AS 了 ]]]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
...
...
@@ -345,7 +352,7 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
\end{scope}
% rule 4
\begin{scope}
[scale=0.6, xshift=1
7em, yshift=-13
em, level distance=20pt]
\begin{scope}
[scale=0.6, xshift=1
6em, yshift=-12
em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.IP [.NN ]
[.VP ]]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
...
...
@@ -354,7 +361,7 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
\end{scope}
% red rule 1
\begin{scope}
[red, scale=0.6, xshift=-22em, yshift=-1
3
em, level distance=20pt]
\begin{scope}
[red, scale=0.6, xshift=-22em, yshift=-1
2
em, level distance=20pt]
\visible
<1>
{
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.NN 进口 ]
\end{scope}
...
...
@@ -366,7 +373,7 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
\visible
<2>
{
% red rule 2
\begin{scope}
[red, scale=0.6, xshift=-1
0em, yshift=-13
em, level distance=20pt]
\begin{scope}
[red, scale=0.6, xshift=-1
1em, yshift=-12
em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.AD 大幅度 ]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
...
...
@@ -377,7 +384,7 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
\visible
<3>
{
% red rule 3
\begin{scope}
[red, scale=0.6, xshift=
3em, yshift=-13
em, level distance=20pt]
\begin{scope}
[red, scale=0.6, xshift=
2em, yshift=-12
em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-7em]
\Tree
[.VP [.AD ]
[.ADVP [.VV 下降 ] [.AS 了 ]]]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
...
...
@@ -388,7 +395,7 @@ $x$表示叶子非终结符(可替换的变量),显然这是调序规则
\visible
<4>
{
% rule 4
\begin{scope}
[red, scale=0.6, xshift=1
7em, yshift=-13
em, level distance=20pt]
\begin{scope}
[red, scale=0.6, xshift=1
6em, yshift=-12
em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.IP [.NN ]
[.VP ]]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
...
...
Section04-Phrasal-and-Syntactic-Models/section04.tex
查看文件 @
5acc4f13
...
...
@@ -1106,15 +1106,16 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
\item
调序模型:描述翻译中的调序现象
\end{enumerate}
\item
<2-> 希望有这样一种模型可以对任意的因素进行方便的建模。经典的判别式模型成为了不二的选择
\end{itemize}
\item
<2-> 希望有这样一种模型可以对任意的因素进行方便的建模。经典的判别式模型成为了不二的选择
\\
\vspace
{
-0.2
em
}
\vspace
{
0.5
em
}
\visible
<2->
{
\textbf
{
Discriminative Training and Maximum Entropy Models for Statistical Machine Translation
}
\\
\textbf
{
Franz Och and Hermann Ney, 2002, In Proc of ACL
}
}
\end{itemize}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
...
...
@@ -2367,6 +2368,272 @@ d = r_1 \circ r_2 \circ r_3 \circ r_4
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%% 规则实例(树到树)
\begin{frame}
{
基于树的翻译规则
}
\begin{itemize}
\item
上述文法定义了一种树结构到树结构的映射,例子:
\end{itemize}
\begin{center}
\begin{tikzpicture}
{
\scriptsize
\begin{scope}
[sibling distance=5pt, level distance = 22pt]
\Tree
[.\node(s1){VP}; [.\node(s2){PP}; ]
[.
\node
(s3)
{
VP
}
; [.
\node
(s4)
{
VV
}
;
\node
[fill=white]
(w1)
{
表示
}
; ] [.
\node
(s5)
{
NN
}
; ] ] ]
\end{scope}
\begin{scope}
[xshift=2in,sibling distance=5pt, level distance = 22pt]
\Tree
[.\node(t1){VP}; [.\node(t2){VBZ}; \node(w2){was}; ]
[.
\node
(t3)
{
VP
}
; [.
\node
(t4)
{
VBN
}
; ] [.
\node
(t5)
{
PP
}
; ] ] ]
\end{scope}
\begin{pgfonlayer}
{
background
}
\node
[anchor=west] (arrow) at ([xshift=3em]s5.east)
{
\Large
{
\textbf
{$
\to
$}}}
;
\visible
<2->
{
\node
[inner sep=0,fill=orange!20] [fit = (s2)] (snode1)
{}
;
\node
[inner sep=0,fill=green!20] [fit = (s5)] (snode2)
{}
;
\node
[inner sep=0,fill=green!20] [fit = (t4)] (tnode1)
{}
;
\node
[inner sep=0,fill=orange!20] [fit = (t5)] (tnode2)
{}
;
\draw
[<->,dotted,thick] (snode2.south) ..controls +(south:2.5em) and +(south:2.5em).. (tnode1.south);
\draw
[<->,dotted,thick] (snode1.south) ..controls +(south:8em) and +(south:4.5em).. (tnode2.south);
}
\end{pgfonlayer}
}
\end{tikzpicture}
\end{center}
\vspace
{
-2.0em
}
\begin{itemize}
\item
由规则定义
$
\langle\ \alpha
_
h,
\beta
_
h
\ \rangle
\to
\langle\ \alpha
_
r,
\beta
_
r,
\sim\ \rangle
$
知道
\vspace
{
-1.3em
}
{
\small
\begin{eqnarray}
\langle\ \alpha
_
h,
\beta
_
h
\ \rangle
&
=
&
\langle\ \textrm
{
VP
}
,
\textrm
{
VP
}
\ \rangle
\nonumber
\\
\alpha
_
r
&
=
&
\textrm
{
VP(PP:
}
x
\ \textrm
{
VP(VV(表示) NN:
}
x))
\nonumber
\\
\beta
_
r
&
=
&
\textrm
{
VP(VBZ(was) VP(VBZ:
}
x
\ \textrm
{
PP:
}
x))
\nonumber
\\
\sim
&
=
&
\{
1-2,2-1
\}
\nonumber
\end{eqnarray}
}
\vspace
{
-1.7em
}
\visible
<2->
{
$
x
$
表示叶子非终结符(可替换的变量),显然这是调序规则
}
\end{itemize}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%% 规则实例(树到树)
\begin{frame}
{
基于树的翻译规则(续)
}
\begin{itemize}
\item
可以省略``
$
\sim
$
'',把规则重新写为易于计算机处理的格式
\\
\vspace
{
-1em
}
\begin{eqnarray}
\langle\ \textrm
{
VP
}
,
\textrm
{
VP
}
\ \rangle
&
\to
&
\langle\ \textrm
{
VP(PP
}_{
\alert
{
1
}}
\ \textrm
{
VP(VV(表示) NN
}_{
\alert
{
2
}}
)),
\nonumber
\\
&
&
\ \ \textrm
{
VP(VBZ(was) VP(VBZ
}_{
\alert
{
2
}}
\ \textrm
{
PP
}_{
\alert
{
1
}}
))
\ \rangle
\nonumber
\end{eqnarray}
其中变量的对应关系用下标数字表示,比如:
$
\textrm
{
PP
}_
1
\leftrightarrow
\textrm
{
PP
}_
1
$
,
$
\textrm
{
NN
}_
2
\leftrightarrow
\textrm
{
VBZ
}_
2
$
\item
<2-> 在这个规则的树结构中,每个叶子非终结符本质上定义了一个变量,这个节点也被称作边缘节点(frontier node)。边缘节点可以被其它树结构替换,组合为更大的树结构,这个操作被称作组合(composition) 或树替换
\end{itemize}
\visible
<2->
{
\begin{center}
\begin{tikzpicture}
{
\scriptsize
\begin{scope}
[sibling distance=5pt, level distance = 22pt]
\Tree
[.\node(s1){VP}; [.\node(s2){PP}; ]
[.
\node
(s3)
{
VP
}
; [.
\node
(s4)
{
VV
}
;
\node
[fill=white]
(w1)
{
表示
}
; ] [.
\node
(s5)
{
NN
}
; ] ] ]
\end{scope}
\begin{scope}
[xshift=1.2in, yshift=-0.2in, sibling distance=5pt, level distance = 22pt]
\Tree
[.\node(ws1){NN}; \node(ws2){满意}; ]
\end{scope}
\node
(anchor=west] (arrow) at ([xshift=0.4in]ws2.east)
{
\large
{$
\Rightarrow
$}}
;
\begin{pgfonlayer}
{
background
}
\node
[inner sep=0,fill=green!20] [fit = (ws1)] (snode1)
{}
;
\node
[inner sep=0,fill=green!20] [fit = (s5)] (snode2)
{}
;
\draw
[<-,thick,dotted] ([xshift=0.1em]s5.east) ..controls +(east:3em) and +(west:3em).. ([xshift=-0.1em]ws1.west);
\end{pgfonlayer}
\begin{scope}
[xshift=2.5in, sibling distance=5pt, level distance = 22pt]
\Tree
[.\node(s1){VP}; [.\node(s2){PP}; ]
[.
\node
(s3)
{
VP
}
; [.
\node
(s4)
{
VV
}
;
\node
[fill=white]
(w1)
{
表示
}
; ] [.
\node
(s5)
{
NN
}
;
\node
(w2)
{
满意
}
; ] ] ]
\end{scope}
}
\end{tikzpicture}
\end{center}
}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%% 规则的组装对应翻译过程
\begin{frame}
{
使用规则定义翻译过程
}
\begin{itemize}
\item
规则的推导描述双语句子同步生成(和分析)的过程
\begin{itemize}
\item
\raisebox
{
0.3em
}{
\tikz
{
\draw
[*-*]
(0,0)--(0.5,0);
}}
表示对边缘阶段(变量)的替换操作
\end{itemize}
\end{itemize}
\begin{tikzpicture}
% target side
\begin{scope}
[xshift=-1em, level distance=25pt]
\node
[scale=0.8]
at (1.5, 2.2)
{
目标语言
}
;
\node
[scale=0.6, inner sep=0.1cm, draw,xshift=1em]
(tfrag1) at
(0,0.05)
{
\Tree
[.NP [.DT the ]
[.NNS imports ]]
}
;
\visible
<4->
{
\node
[scale=0.6, inner sep=0.1cm, draw, sibling distance=100pt]
(tfrag2) at
(1.4,1.4)
{
\Tree
[.S [.NP ]
[.VP ]]
}
;
}
\visible
<3->
{
\node
[scale=0.6, inner sep=0.1cm, draw, sibling distance=30pt]
(tfrag3) at
(3,-0.2)
{
\Tree
[.VP [.VBZ have ]
[.ADVP [.RB ] [.VBN fallen ]]]
}
;
}
\visible
<2->
{
\node
[scale=0.6, inner sep=0.1cm, draw,xshift=-1.5em]
(tfrag4) at
(2.8,-1.8)
{
\Tree
[.RB drastically ]
}
;
}
\visible
<4->
{
\draw
[*-*]
(0.15,0.7) -- (0.15,1.05);
}
\visible
<4->
{
\draw
[*-*]
(2.7,0.7) -- (2.7,1.05);
}
\visible
<3->
{
\draw
[*-*]
(2.4,-1.4) .. controls +(north:0.6) and +(south:0.6) .. (3.0,-0.6);
}
\end{scope}
% source side
\begin{scope}
[scale=0.8, level distance=25pt, xshift=-20em, yshift=1em]
\node
[scale=0.8]
at (2.1, 2.45)
{
源语言
}
;
\visible
<1->
{
\node
[scale=0.6, inner sep=0.1cm, draw]
(sfrag1) at
(0,0)
{
\Tree
[.NN 进口 ]
}
;
}
\visible
<4->
{
\node
[scale=0.6, inner sep=0.1cm, draw, sibling distance=135pt]
(sfrag2) at
(2.0,1.4)
{
\Tree
[.IP [.NN ]
[.VP ]]
}
;
}
\visible
<3->
{
\node
[scale=0.6, inner sep=0.1cm, xshift=1em, draw]
(sfrag3) at
(4,-0.7)
{
\Tree
[.VP [.AD ]
[.ADVP [.VV 下降 ] [.AS 了 ]]]
}
;
}
\visible
<2->
{
\node
[scale=0.6, inner sep=0.1cm, draw]
(sfrag4) at
(1.3,-1.3)
{
\Tree
[.AD 大幅度 ]
}
;
}
\visible
<4->
{
\draw
[*-*]
(0.05,0.5) -- (0.05,0.95);
}
\visible
<4->
{
\draw
[*-*]
(4.15,0.5) -- (4.15,0.95);
}
\visible
<3->
{
\draw
[*-*]
(1.55,-0.95) .. controls +(east:1.0) and +(south:0.4) .. (3.5,-0.6);
}
\end{scope}
% rule 1
\begin{scope}
[scale=0.6, xshift=-22em, yshift=-12em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.NN 进口 ]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
\begin{scope}
[anchor=north west]
\Tree
[.NP [.DT the ]
[.NNS imports ]]
\end{scope}
\end{scope}
% rule 2
\begin{scope}
[scale=0.6, xshift=-11em, yshift=-12em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.AD 大幅度 ]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
\begin{scope}
[anchor=north west]
\Tree
[.RB drastically ]
\end{scope}
\end{scope}
% rule 3
\begin{scope}
[scale=0.6, xshift=2em, yshift=-12em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-7em]
\Tree
[.VP [.AD ]
[.ADVP [.VV 下降 ] [.AS 了 ]]]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
\begin{scope}
[anchor=north west, xshift=1em]
\Tree
[.VP [.VBZ have ]
[.ADVP [.RB ] [.VBN fallen ]]]
\end{scope}
\end{scope}
% rule 4
\begin{scope}
[scale=0.6, xshift=16em, yshift=-12em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.IP [.NN ]
[.VP ]]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
\begin{scope}
[anchor=north west,xshift=-1em]
\Tree
[.S [.NP ]
[.VP ]]
\end{scope}
\end{scope}
% red rule 1
\begin{scope}
[red, scale=0.6, xshift=-22em, yshift=-12em, level distance=20pt]
\visible
<1>
{
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.NN 进口 ]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
\begin{scope}
[anchor=north west]
\Tree
[.NP [.DT the ]
[.NNS imports ]]
\end{scope}
}
\end{scope}
\visible
<2>
{
% red rule 2
\begin{scope}
[red, scale=0.6, xshift=-11em, yshift=-12em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.AD 大幅度 ]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
\begin{scope}
[anchor=north west]
\Tree
[.RB drastically ]
\end{scope}
\end{scope}
}
\visible
<3>
{
% red rule 3
\begin{scope}
[red, scale=0.6, xshift=2em, yshift=-12em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-7em]
\Tree
[.VP [.AD ]
[.ADVP [.VV 下降 ] [.AS 了 ]]]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
\begin{scope}
[anchor=north west, xshift=1em]
\Tree
[.VP [.VBZ have ]
[.ADVP [.RB ] [.VBN fallen ]]]
\end{scope}
\end{scope}
}
\visible
<4>
{
% rule 4
\begin{scope}
[red, scale=0.6, xshift=16em, yshift=-12em, level distance=20pt]
\begin{scope}
[anchor=north east, xshift=-6em]
\Tree
[.IP [.NN ]
[.VP ]]
\end{scope}
\draw
[->]
(-1.7,0.1) -- (-0.9,0.1);
\begin{scope}
[anchor=north west,xshift=-1em]
\Tree
[.S [.NP ]
[.VP ]]
\end{scope}
\end{scope}
}
\end{tikzpicture}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
\subsection
{
翻译规则抽取
}
%%%------------------------------------------------------------------------------------------------------------
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论