Commit 1255eac4 by xiaotong

hiero rule application

parent b8e87296
......@@ -125,14 +125,141 @@
%%%------------------------------------------------------------------------------------------------------------
%%% 使用翻译规则
\begin{frame}{使用翻译规则描述翻译过程}
\begin{frame}{使用翻译规则描述双语句子生成过程}
\begin{itemize}
\item 翻译过程可以用上述规则描述
\begin{itemize}
\item 规则的源语和目标语端都对应连续的词串
\item 每个变量在源语和目标语端可以被同步替换
\end{itemize}
\end{itemize}
\begin{center}
\begin{tikzpicture}
\begin{scope}
\visible<3->{
% rule 1 (source)
\node [anchor=west] (rule1s1) at (0,0) {};
\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) {};
\node [anchor=west,inner sep=2pt,fill=black] (rule1s4) at ([xshift=0.5em]rule1s3.east) {\scriptsize{{\color{white} $X_2$}}};
% rule 1 (target)
\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$}}};
}
\visible<1->{
% 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{pgfonlayer}{background}
\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}
\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}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
......
......@@ -1385,7 +1385,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
包含 多个 词 的 短语 大多 & 0
\end{tabular}
\end{center}
\vspace{0.5em}
\item<2-> 简单使用短语和$n$-gram语言模型无法处理长距离的调序
\begin{itemize}
......@@ -1423,7 +1423,7 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
\node [anchor=south east,inner sep=1pt,fill=black] (l2) at ([xshift=6.3em]twords2.south) {\tiny{{\color{white} 2}}};
}
\end{pgfonlayer}
\end{scope}
\end{tikzpicture}
\end{center}
......@@ -1464,6 +1464,145 @@ $d$是一个$(\textbf{s},\textbf{t})$上基于短语的翻译推导,$\textrm{P
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%% 使用翻译规则
\begin{frame}{使用翻译规则描述双语句子生成过程}
\begin{itemize}
\item 翻译过程可以用上述规则描述
\begin{itemize}
\item 每个变量在源语和目标语端可以被同步替换
\end{itemize}
\end{itemize}
\begin{center}
\begin{tikzpicture}
\begin{scope}
\visible<3->{
% rule 1 (source)
\node [anchor=west] (rule1s1) at (0,0) {};
\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) {};
\node [anchor=west,inner sep=2pt,fill=black] (rule1s4) at ([xshift=0.5em]rule1s3.east) {\scriptsize{{\color{white} $X_2$}}};
% rule 1 (target)
\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$}}};
}
\visible<1->{
% 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{pgfonlayer}{background}
\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}
\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}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
\subsection{同步上下文无关文法}
%%%------------------------------------------------------------------------------------------------------------
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论