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
89ecf9be
Commit
89ecf9be
authored
Dec 21, 2019
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new pages of SCFG
parent
a1e891a5
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
90 行增加
和
131 行删除
+90
-131
Section04-Phrasal-and-Syntactic-Models/section04-test.tex
+42
-127
Section04-Phrasal-and-Syntactic-Models/section04.tex
+48
-4
没有找到文件。
Section04-Phrasal-and-Syntactic-Models/section04-test.tex
查看文件 @
89ecf9be
...
@@ -124,142 +124,57 @@
...
@@ -124,142 +124,57 @@
\section
{
基于层次短语的模型
}
\section
{
基于层次短语的模型
}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
%%%
使用翻译规则
%%%
上下文无关文法
\begin{frame}
{
使用翻译规则描述双语句子生成过程
}
\begin{frame}
{
同步上下文无关文法
}
\begin{itemize}
\begin{itemize}
\item
翻译过程可以用上述规则描述
\item
以上这种对翻译的描述方式,可以用同步上下文无关文法来定义,记Synchronous Context-Free Grammar(SCFG)
\begin{itemize}
\item
每个变量在源语和目标语端可以被同步替换
\end{itemize}
\end{itemize}
\end{itemize}
\begin{center}
\begin{beamerboxesrounded}
[upper=uppercolblue,lower=lowercolblue,shadow=true]
{
定义 - 同步上下文无关文法
}
\begin{tikzpicture}
{
\small
\begin{scope}
一个同步上下文无关文法由五部分构成
$
(
N, T
_
s, T
_
t, I, R
)
$
,其中
\\
1.
$
N
$
是非终结符集合
\\
\visible
<3->
{
2.
$
T
_
s
$
和
$
T
_
t
$
分别是源语言和目标语终结符集合
\\
% rule 1 (source)
3.
$
I
\subseteq
N
$
起始非终结符集合
\\
\node
[anchor=west] (rule1s1) at (0,0)
{
与
}
;
4.
$
R
$
是规则集合,每条规则
$
r
\in
R
$
有如下形式
\node
[anchor=west,inner sep=2pt,fill=black] (rule1s2) at ([xshift=0.5em]rule1s1.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
\node
[anchor=west] (rule1s3) at ([xshift=0.5em]rule1s2.east)
{
有
}
;
\begin{displaymath}
\node
[anchor=west,inner sep=2pt,fill=black] (rule1s4) at ([xshift=0.5em]rule1s3.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
\textrm
{
LHS
}
\to
<
\alpha
,
\beta
,
\sim
>
\end{displaymath}
% rule 1 (target)
其中,
$
\textrm
{
LHS
}
\in
N
$
表示规则的左部,它是一个非终结符;规则右部由三部分组成,
$
\alpha
\in
(
N
\bigcup
T
_
s
)
^{
*
}$
表示由源语言终结符和非终结符组成的串;
$
\beta
\in
(
N
\bigcup
T
_
t
)
^{
*
}$
表示由目标语言终结符和非终结符组成的串;
$
\sim
$
表示
$
\alpha
$
和
$
\beta
$
中终结符的1-1对应关系
\node
[anchor=west] (rule1t1) at ([xshift=0.8in]rule1s4.east)
{
have
}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule1t2) at ([xshift=0.5em]rule1t1.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
\node
[anchor=west] (rule1t3) at ([xshift=0.5em]rule1t2.east)
{
with
}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule1t4) at ([xshift=0.5em]rule1t3.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
}
}
\end{beamerboxesrounded}
\visible
<1->
{
\end{frame}
% phrase 1 (source and target)
\node
[anchor=north] (phrase1s1) at ([yshift=-1em]rule1s2.south)
{
北韩
}
;
\node
[anchor=north] (phrase1t1) at ([yshift=-1em]rule1t4.south)
{
North Korea
}
;
}
\visible
<2->
{
% phrase 2 (source and target)
\node
[anchor=north] (phrase2s1) at ([yshift=-3em]rule1s4.south)
{
邦交
}
;
\node
[anchor=north] (phrase2t1) at ([yshift=-3em]rule1t2.south)
{
diplomatic relations
}
;
}
\begin{pgfonlayer}
{
background
}
\visible
<3->
{
\node
[rectangle,draw=red,inner sep=1pt,thick,fill=white,drop shadow] [fit = (rule1s1) (rule1s4)] (rule1s)
{}
;
\node
[rectangle,draw=red,inner sep=2pt,thick,fill=white,drop shadow] [fit = (rule1t1) (rule1t4)] (rule1t)
{}
;
}
\end{pgfonlayer}
\visible
<3->
{
% edges (phrases 1-2 to rule1)
\draw
[->] (phrase1s1.north) -- ([yshift=-0.1em]rule1s2.south);
\draw
[->] (phrase1t1.north) -- ([yshift=-0.1em]rule1t4.south);
\draw
[->] (phrase2s1.north) -- ([yshift=-0.1em]rule1s4.south);
\draw
[->] (phrase2t1.north) -- ([yshift=-0.1em]rule1t2.south);
}
\visible
<4->
{
% rule 2 (source)
\node
[anchor=west,inner sep=2pt,fill=black] (rule2s1) at ([yshift=3.5em,xshift=-0.5em]rule1s1.north west)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
\node
[anchor=west] (rule2s2) at ([xshift=0.5em]rule2s1.east)
{
的
}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule2s3) at ([xshift=0.5em]rule2s2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
% rule 2 (target)
\node
[anchor=west,inner sep=2pt,fill=black] (rule2t1) at ([yshift=3.5em,xshift=4em]rule1t1.north west)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
\node
[anchor=west] (rule2t2) at ([xshift=0.5em]rule2t1.east)
{
that
}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule2t3) at ([xshift=0.5em]rule2t2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
% phrase 3 (source and target)
\node
[anchor=north] (phrase3s1) at ([yshift=-0.8em]rule2s3.south)
{
\footnotesize
{
少数 国家
}}
;
\node
[anchor=north] (phrase3t1) at ([yshift=-0.8em]rule2t1.south)
{
\footnotesize
{
the few countries
}}
;
% edges (phrase 3 to rule 2 and rule1 to rule2)
\draw
[->] (phrase3s1.north) -- ([yshift=-0.1em]rule2s3.south);
\draw
[->] (phrase3t1.north) -- ([yshift=-0.1em]rule2t1.south);
\draw
[->] ([xshift=2em]rule1s.north west) ..controls +(north:1.5em) and +(south:1.5em).. ([yshift=-0.1em]rule2s1.south);
\draw
[->] ([xshift=-2em]rule1t.north east) ..controls +(north:1.5em) and +(south:1.5em).. ([yshift=-0.1em]rule2t3.south);
}
\begin{pgfonlayer}
{
background
}
\visible
<4->
{
\node
[rectangle,draw=blue,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule2s1) (rule2s3)] (rule2s)
{}
;
\node
[rectangle,draw=blue,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule2t1) (rule2t3)] (rule2t)
{}
;
}
\end{pgfonlayer}
\visible
<5->
{
% rule 3 (source)
\node
[anchor=west,inner sep=2pt,fill=black] (rule3s1) at ([yshift=2.5em,xshift=4em]rule2s1.north west)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
\node
[anchor=west] (rule3s2) at ([xshift=0.5em]rule3s1.east)
{
之一
}
;
% rule 3 (target)
\node
[anchor=west] (rule3t1) at ([yshift=2.5em,xshift=-4em]rule2t1.north west)
{
one of
}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule3t2) at ([xshift=0.5em]rule3t1.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
% edges: rule 2 to rule 3
%%%------------------------------------------------------------------------------------------------------------
\draw
[->] ([xshift=-1em]rule2s.north) ..controls +(north:1.2em) and +(south:1.2em).. ([yshift=-0.1em]rule3s1.south);
%%% 上下文无关文法 - 一些实例
\draw
[->] ([xshift=1em]rule2t.north) ..controls +(north:1.2em) and +(south:1.2em).. ([yshift=-0.1em]rule3t2.south);
\begin{frame}
{
同步上下文无关文法 - 实例
}
}
\begin{itemize}
\item
SCFG可以被看做是对CFG的扩展,相当于把单语的CFG扩展到双语,如下是一些SCFG规则,其中每个规则非终结符的对应用非终结符的标号表示
\begin{eqnarray}
\textrm
{
S
}
&
\to
&
<
\textrm
{
NP
}_
1
\ \textrm
{
希望
}
\ \textrm
{
VP
}_
2,
\ \textrm
{
NP
}_
1
\ \textrm
{
wish to
}
\ \textrm
{
VP
}_
2>
\nonumber
\\
\textrm
{
VP
}&
\to
&
<
\textrm
{
对
}
\ \textrm
{
NP
}_
1
\ \textrm
{
感到
}
\ \textrm
{
VP
}_
2,
\ \textrm
{
be
}
\ \textrm
{
VP
}_
2
\ \textrm
{
with
}
\ \textrm
{
NP
}_
1>
\nonumber
\\
\textrm
{
NN
}
&
\to
&
<
\textrm
{
强大
}
,
\ \textrm
{
strong
}
>
\nonumber
\end{eqnarray}
\item
<2-> 这里NP、VP等是有语言学意义的非终结符。当然,在机器翻译中这些并不是必要的,可以使用更简单的文法,只包含一种非终结符
\begin{eqnarray}
\textrm
{
X
}
&
\to
&
<
\textrm
{
X
}_
1
\ \textrm
{
希望
}
\ \textrm
{
X
}_
2,
\ \textrm
{
X
}_
1
\ \textrm
{
wish to
}
\ \textrm
{
X
}_
2>
\nonumber
\\
\textrm
{
X
}&
\to
&
<
\textrm
{
对
}
\ \textrm
{
X
}_
1
\ \textrm
{
感到
}
\ \textrm
{
X
}_
2,
\ \textrm
{
be
}
\ \textrm
{
X
}_
2
\ \textrm
{
with
}
\ \textrm
{
X
}_
1>
\nonumber
\\
\textrm
{
X
}
&
\to
&
<
\textrm
{
强大
}
,
\ \textrm
{
strong
}
>
\nonumber
\end{eqnarray}
\begin{pgfonlayer}
{
background
}
\end{itemize}
\visible
<5->
{
\node
[rectangle,draw=ugreen,inner sep=1pt,thick,fill=white,drop shadow] [fit = (rule3s1) (rule3s2)] (rule3s)
{}
;
\node
[rectangle,draw=ugreen,inner sep=2pt,thick,fill=white,drop shadow] [fit = (rule3t1) (rule3t2)] (rule3t)
{}
;
}
\end{pgfonlayer}
\visible
<6->
{
% rule 4 (source)
\node
[anchor=west,inner sep=2pt,fill=black] (rule4s1) at ([yshift=3.5em,xshift=-3.5em]rule3s1.north west)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
\node
[anchor=west] (rule4s2) at ([xshift=0.5em]rule4s1.east)
{
是
}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule4s3) at ([xshift=0.5em]rule4s2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
% rule 2 (target)
\node
[anchor=west,inner sep=2pt,fill=black] (rule4t1) at ([yshift=3.5em,xshift=2em]rule3t1.north west)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
\node
[anchor=west] (rule4t2) at ([xshift=0.5em]rule4t1.east)
{
is
}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule4t3) at ([xshift=0.5em]rule4t2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
% phrase 4 (source and target)
\node
[anchor=north] (phrase4s1) at ([yshift=-0.8em]rule4s1.south)
{
\footnotesize
{
澳洲
}}
;
\node
[anchor=north] (phrase4t1) at ([yshift=-0.8em]rule4t1.south)
{
\footnotesize
{
Australia
}}
;
% edges (phrase 4 to rule 4 and rule3 to rule4)
\draw
[->] (phrase4s1.north) -- ([yshift=-0.1em]rule4s1.south);
\draw
[->] (phrase4t1.north) -- ([yshift=-0.1em]rule4t1.south);
\draw
[->] ([xshift=1em]rule3s.north) ..controls +(north:1.5em) and +(south:1.5em).. ([yshift=-0.1em]rule4s3.south);
\draw
[->] ([xshift=-1em]rule3t.north east) ..controls +(north:1.5em) and +(south:1.5em).. ([yshift=-0.1em]rule4t3.south);
}
\begin{pgfonlayer}
{
background
}
\end{frame}
\visible
<6->
{
\node
[rectangle,draw=orange,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule4s1) (rule4s3)] (rule4s)
{}
;
\node
[rectangle,draw=orange,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule4t1) (rule4t3)] (rule4t)
{}
;
}
\end{pgfonlayer}
\end{scope}
%%%------------------------------------------------------------------------------------------------------------
\end{tikzpicture}
%%% 上下文无关文法 - 一些实例
\end{center}
\begin{frame}
{
同步上下文无关文法 - 推导
}
\begin{itemize}
\item
可以使用SCFG规则同步生成源语言和目标语言句对,这个过程和CFG的使用非常类似,只是需要同时生成两个语言的句子。每次规则的使用都会同步替换源语言和目标语言串中的一个非终结符,如下是一个例子
\end{itemize}
\end{frame}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
...
...
Section04-Phrasal-and-Syntactic-Models/section04.tex
查看文件 @
89ecf9be
...
@@ -1507,6 +1507,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
...
@@ -1507,6 +1507,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
\visible
<3->
{
\visible
<3->
{
\node
[rectangle,draw=red,inner sep=1pt,thick,fill=white,drop shadow] [fit = (rule1s1) (rule1s4)] (rule1s)
{}
;
\node
[rectangle,draw=red,inner sep=1pt,thick,fill=white,drop shadow] [fit = (rule1s1) (rule1s4)] (rule1s)
{}
;
\node
[rectangle,draw=red,inner sep=2pt,thick,fill=white,drop shadow] [fit = (rule1t1) (rule1t4)] (rule1t)
{}
;
\node
[rectangle,draw=red,inner sep=2pt,thick,fill=white,drop shadow] [fit = (rule1t1) (rule1t4)] (rule1t)
{}
;
\draw
[<->,dotted,thick,red] ([xshift=0.1em]rule1s.east) -- ([xshift=-0.1em]rule1t.west);
}
}
\end{pgfonlayer}
\end{pgfonlayer}
...
@@ -1525,7 +1526,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
...
@@ -1525,7 +1526,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
\node
[anchor=west,inner sep=2pt,fill=black] (rule2s3) at ([xshift=0.5em]rule2s2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule2s3) at ([xshift=0.5em]rule2s2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
% rule 2 (target)
% rule 2 (target)
\node
[anchor=west,inner sep=2pt,fill=black] (rule2t1) at ([
yshift=3.5em,xshift=4em]rule1t1.north we
st)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule2t1) at ([
xshift=1.8in]rule2s3.ea
st)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
\node
[anchor=west] (rule2t2) at ([xshift=0.5em]rule2t1.east)
{
that
}
;
\node
[anchor=west] (rule2t2) at ([xshift=0.5em]rule2t1.east)
{
that
}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule2t3) at ([xshift=0.5em]rule2t2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule2t3) at ([xshift=0.5em]rule2t2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
...
@@ -1544,6 +1545,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
...
@@ -1544,6 +1545,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
\visible
<4->
{
\visible
<4->
{
\node
[rectangle,draw=blue,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule2s1) (rule2s3)] (rule2s)
{}
;
\node
[rectangle,draw=blue,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule2s1) (rule2s3)] (rule2s)
{}
;
\node
[rectangle,draw=blue,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule2t1) (rule2t3)] (rule2t)
{}
;
\node
[rectangle,draw=blue,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule2t1) (rule2t3)] (rule2t)
{}
;
\draw
[<->,dotted,thick,blue] ([xshift=0.1em]rule2s.east) -- ([xshift=-0.1em]rule2t.west);
}
}
\end{pgfonlayer}
\end{pgfonlayer}
...
@@ -1553,7 +1555,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
...
@@ -1553,7 +1555,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
\node
[anchor=west] (rule3s2) at ([xshift=0.5em]rule3s1.east)
{
之一
}
;
\node
[anchor=west] (rule3s2) at ([xshift=0.5em]rule3s1.east)
{
之一
}
;
% rule 3 (target)
% rule 3 (target)
\node
[anchor=west] (rule3t1) at ([
yshift=2.5em,xshift=-4em]rule2t1.north we
st)
{
one of
}
;
\node
[anchor=west] (rule3t1) at ([
xshift=1.0in]rule3s2.ea
st)
{
one of
}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule3t2) at ([xshift=0.5em]rule3t1.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule3t2) at ([xshift=0.5em]rule3t1.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
% edges: rule 2 to rule 3
% edges: rule 2 to rule 3
...
@@ -1565,6 +1567,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
...
@@ -1565,6 +1567,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
\visible
<5->
{
\visible
<5->
{
\node
[rectangle,draw=ugreen,inner sep=1pt,thick,fill=white,drop shadow] [fit = (rule3s1) (rule3s2)] (rule3s)
{}
;
\node
[rectangle,draw=ugreen,inner sep=1pt,thick,fill=white,drop shadow] [fit = (rule3s1) (rule3s2)] (rule3s)
{}
;
\node
[rectangle,draw=ugreen,inner sep=2pt,thick,fill=white,drop shadow] [fit = (rule3t1) (rule3t2)] (rule3t)
{}
;
\node
[rectangle,draw=ugreen,inner sep=2pt,thick,fill=white,drop shadow] [fit = (rule3t1) (rule3t2)] (rule3t)
{}
;
\draw
[<->,dotted,thick,ugreen] ([xshift=0.1em]rule3s.east) -- ([xshift=-0.1em]rule3t.west);
}
}
\end{pgfonlayer}
\end{pgfonlayer}
...
@@ -1575,7 +1578,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
...
@@ -1575,7 +1578,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
\node
[anchor=west,inner sep=2pt,fill=black] (rule4s3) at ([xshift=0.5em]rule4s2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule4s3) at ([xshift=0.5em]rule4s2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
% rule 2 (target)
% rule 2 (target)
\node
[anchor=west,inner sep=2pt,fill=black] (rule4t1) at ([
yshift=3.5em,xshift=2em]rule3t1.north we
st)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule4t1) at ([
xshift=2.0in]rule4s2.ea
st)
{
\scriptsize
{{
\color
{
white
}
$
X
_
1
$}}}
;
\node
[anchor=west] (rule4t2) at ([xshift=0.5em]rule4t1.east)
{
is
}
;
\node
[anchor=west] (rule4t2) at ([xshift=0.5em]rule4t1.east)
{
is
}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule4t3) at ([xshift=0.5em]rule4t2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
\node
[anchor=west,inner sep=2pt,fill=black] (rule4t3) at ([xshift=0.5em]rule4t2.east)
{
\scriptsize
{{
\color
{
white
}
$
X
_
2
$}}}
;
...
@@ -1594,6 +1597,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
...
@@ -1594,6 +1597,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
\visible
<6->
{
\visible
<6->
{
\node
[rectangle,draw=orange,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule4s1) (rule4s3)] (rule4s)
{}
;
\node
[rectangle,draw=orange,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule4s1) (rule4s3)] (rule4s)
{}
;
\node
[rectangle,draw=orange,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule4t1) (rule4t3)] (rule4t)
{}
;
\node
[rectangle,draw=orange,inner sep=4pt,thick,fill=white,drop shadow] [fit = (rule4t1) (rule4t3)] (rule4t)
{}
;
\draw
[<->,dotted,thick,orange] ([xshift=0.1em]rule4s.east) -- ([xshift=-0.1em]rule4t.west);
}
}
\end{pgfonlayer}
\end{pgfonlayer}
...
@@ -1605,10 +1609,50 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
...
@@ -1605,10 +1609,50 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
\subsection
{
同步上下文无关文法
}
\subsection
{
同步上下文无关文法
}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
%%% 上下文无关文法
%%% 上下文无关文法
\begin{frame}
{
同步上下文无关文法
}
\begin{frame}
{
同步上下文无关文法
}
% 形式定义
\begin{itemize}
\item
以上这种对翻译的描述方式,可以用同步上下文无关文法来定义,记Synchronous Context-Free Grammar(SCFG)
\end{itemize}
\begin{beamerboxesrounded}
[upper=uppercolblue,lower=lowercolblue,shadow=true]
{
定义 - 同步上下文无关文法
}
{
\small
一个同步上下文无关文法由五部分构成
$
(
N, T
_
s, T
_
t, I, R
)
$
,其中
\\
1.
$
N
$
是非终结符集合
\\
2.
$
T
_
s
$
和
$
T
_
t
$
分别是源语言和目标语终结符集合
\\
3.
$
I
\subseteq
N
$
起始非终结符集合
\\
4.
$
R
$
是规则集合,每条规则
$
r
\in
R
$
有如下形式
\begin{displaymath}
\textrm
{
LHS
}
\to
<
\alpha
,
\beta
,
\sim
>
\end{displaymath}
其中,
$
\textrm
{
LHS
}
\in
N
$
表示规则的左部,它是一个非终结符;规则右部由三部分组成,
$
\alpha
\in
(
N
\bigcup
T
_
s
)
^{
*
}$
表示由源语言终结符和非终结符组成的串;
$
\beta
\in
(
N
\bigcup
T
_
t
)
^{
*
}$
表示由目标语言终结符和非终结符组成的串;
$
\sim
$
表示
$
\alpha
$
和
$
\beta
$
中终结符的1-1对应关系
}
\end{beamerboxesrounded}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%% 上下文无关文法 - 一些实例
\begin{frame}
{
同步上下文无关文法 - 实例
}
\begin{itemize}
\item
SCFG可以被看做是对CFG的扩展,相当于把单语的CFG扩展到双语,如下是一些SCFG规则,其中每个规则非终结符的对应用非终结符的标号表示
\begin{eqnarray}
\textrm
{
S
}
&
\to
&
<
\textrm
{
NP
}_
1
\ \textrm
{
希望
}
\ \textrm
{
VP
}_
2,
\ \textrm
{
NP
}_
1
\ \textrm
{
wish to
}
\ \textrm
{
VP
}_
2>
\nonumber
\\
\textrm
{
VP
}&
\to
&
<
\textrm
{
对
}
\ \textrm
{
NP
}_
1
\ \textrm
{
感到
}
\ \textrm
{
VP
}_
2,
\ \textrm
{
be
}
\ \textrm
{
VP
}_
2
\ \textrm
{
with
}
\ \textrm
{
NP
}_
1>
\nonumber
\\
\textrm
{
NN
}
&
\to
&
<
\textrm
{
强大
}
,
\ \textrm
{
strong
}
>
\nonumber
\end{eqnarray}
\item
<2-> 这里NP、VP等是有语言学意义的非终结符。当然,在机器翻译中这些并不是必要的,可以使用更简单的文法,只包含一种非终结符
\begin{eqnarray}
\textrm
{
X
}
&
\to
&
<
\textrm
{
X
}_
1
\ \textrm
{
希望
}
\ \textrm
{
X
}_
2,
\ \textrm
{
X
}_
1
\ \textrm
{
wish to
}
\ \textrm
{
X
}_
2>
\nonumber
\\
\textrm
{
X
}&
\to
&
<
\textrm
{
对
}
\ \textrm
{
X
}_
1
\ \textrm
{
感到
}
\ \textrm
{
X
}_
2,
\ \textrm
{
be
}
\ \textrm
{
X
}_
2
\ \textrm
{
with
}
\ \textrm
{
X
}_
1>
\nonumber
\\
\textrm
{
X
}
&
\to
&
<
\textrm
{
强大
}
,
\ \textrm
{
strong
}
>
\nonumber
\end{eqnarray}
\end{itemize}
\end{frame}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论