Commit 99f5a117 by xiaotong

parsing = string-based decoding

parent c36bc0ad
......@@ -4485,7 +4485,7 @@ NP-BAR(NN$_1$ NP-BAR$_2$) $\to$ NN$_1$ NP-BAR$_2$
%%% 基于树的解码方法 - 超图
\begin{frame}{基于树的解码 - 超图}
\begin{itemize}
\item 如果源语言输入的是句法树,基于树的解码会找到一个推导覆盖整个句法树,之后输出所对应的目标语词串作为译文
\item 如果源语言输入的是句法树,\alert{基于树的解码}会找到一个推导覆盖整个句法树,之后输出所对应的目标语词串作为译文
\item 比如,可以从树的叶子结点开始,找到所有能匹配到这个节点的规则,当所有节点匹配完之后,本质上获得了一个超图
\begin{itemize}
\item<2-> 图的节点对应一个句法树句法节点
......@@ -4808,6 +4808,121 @@ NP-BAR(NN$_1$ NP-BAR$_2$) $\to$ NN$_1$ NP-BAR$_2$
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%% 基于串的解码方法
\begin{frame}{基于串的解码}
\begin{itemize}
\item 不同于基于树的解码,\alert{基于串的解码}方法并不要求输入句法树,它直接对输入词串进行翻译,最终得到译文。
\begin{itemize}
\item 这种方法适用于树到串、串到树、树到树等多种模型
\item 本质上,由于并不受固定输入的句法树约束,基于串的解码可以探索更多潜在的树结构,这也增大了搜索空间(相比基于串的解码),因此该方法更有可能找到高质量翻译结果
\end{itemize}
\item<2-> 在基于串的方法中,句法结构被看做是翻译的隐含变量,而非线性的输入和输出。比如,层次短语翻译解码就是一种典型的基于串的解码方法,所有的翻译推导在翻译过程里动态生成,但是并不要输入或者输出这些推导所对应的层次结构
\end{itemize}
\visible<2->{
\begin{center}
\begin{tikzpicture}
\begin{scope}[scale=0.9,level distance=15pt,sibling distance=0pt]
{\scriptsize
\Tree[.\node(bsn0){IP};
[.\node(bsn1){NP};
[.\node(bsn2){NN}; \node(bsw1){}; ]
]
[.\node(bsn3){VP};
[.\node(bsn4){VV}; \node(bsw2){喜欢}; ]
[.\node(bsn5){VP}; \edge[roof]; \node(bsw3){\ }; ]
]
]
\node [anchor=west] (target) at ([xshift=1em]bsw3.east) {Cats like eating fish};
\node [anchor=north,inner sep=3pt] (cap1) at (target.south west) {(a) 基于树的解码};
\draw [->,thick] (bsw3.east) -- (target.west);
\node [anchor=west] (sourcelabel) at ([xshift=2em]bsn0.east) {显式输入的结构};
\node [anchor=west] (source2) at ([xshift=2em]target.east) {猫 喜欢 吃 鱼};
\node [anchor=west] (target2) at ([xshift=1em]source2.east) {Cats like eating fish};
\node [anchor=north,inner sep=3pt] (cap2) at (target2.south west) {(b) 基于串的解码};
\draw [->,thick] (source2.east) -- (target2.west);
\begin{scope}[xshift=2.45in,sibling distance=3pt]
\Tree[.\node(bsn0){IP};
[.\node(bsn1){NP};
[.\node(bsn2){NN}; ]
]
[.\node(bsn3){VP};
[.\node(bsn4){VV}; ]
[.\node(bsn5){VP}; ]
]
]
\begin{pgfonlayer}{background}
\node [draw,dashed,inner sep=2pt] (box) [fit = (bsn0) (bsn1) (bsn2) (bsn3) (bsn4) (bsn5)] {};
\node [anchor=north west] (boxlabel) at (box.north east) {隐含结构};
\end{pgfonlayer}
\end{scope}
}
\end{scope}
\end{tikzpicture}
\end{center}
}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%% 基于串的解码方法本质上和句法分析一样
\begin{frame}{基于串的解码 $\approx$ 句法分析}
\begin{itemize}
\item 基于串的翻译和传统\alert{句法分析}的任务很像:对于一个输入的词串,找到生成这个词串的最佳推导。唯一不同的地方,在于机器翻译需要考虑译文的生成(语言模型的引入会使问题稍微复杂一些),但是源语言部分的处理和句法分析一模一样
\item<2-> 这个过程仍然可以用基于chart的方法实现,即对于每一个源语言片段,都匹配可能的翻译规则,之后填入相应的表格单元,这也构成了一个超图,最佳推导可以从这个超图得到
\end{itemize}
\visible<2->{
\begin{center}
\begin{tikzpicture}
\begin{scope}
{\scriptsize
\node [anchor=west] (sw1) at (0,0) {阿都拉$_1$};
\node [anchor=west] (sw2) at ([xshift=0.1em]sw1.east) {$_2$};
\node [anchor=west] (sw3) at ([xshift=0.1em]sw2.east) {自己$_3$$_4$\ $_5$\ $_6$\ $_7$\ 以来$_8$\ $_9$\ 施政$_{10}$\ 表现$_{11}$};
\node [anchor=west] (sw4) at ([xshift=0.2em]sw3.east) {感到$_{12}$ 满意$_{13}$};
\begin{pgfonlayer}{background}
\visible<3->{
\node [fill=red!20,inner sep=0pt] (box1) [fit = (sw1)] {};
\node [fill=green!20,inner sep=0pt] (box2) [fit = (sw3)] {};
\node [fill=orange!20,inner sep=0pt] (box3) [fit = (sw4)] {};
\node [anchor=south,align=center] (box1label) at (box1.north) {[{\blue 0},{\blue 1}]\\VP};
\node [anchor=south,align=center] (box2label) at (box2.north) {[{\blue 2},{\blue 11}]\\NP};
\node [anchor=south,align=center] (box3label) at (box3.north) {[{\blue 11},{\blue 13}]\\VP};
}
\end{pgfonlayer}
\draw[decorate,decoration={brace,mirror,,amplitude=3mm}] (sw1.south west) -- (sw4.south east);
\node [anchor=north] (label) at ([yshift=-1em]sw3.south) {在跨度[{\blue 0},{\blue 13}]上进行规则匹配};
\node [anchor=north] (rule) at ([yshift=-0.3em]label.south) {{\footnotesize 比如:IP({\color{red} NP$_1$} VP(PP(P() {\color{ugreen} NP$_2$}) {\color{orange} VP$_3$}))}};
\node [anchor=north west] (rule2) at ([yshift=0.2em]rule.south west) {{\footnotesize \hspace{2.8em} $\to$ NP$_1$ VP$_3$ with NP$_2$}};
}
\end{scope}
\end{tikzpicture}
\end{center}
}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%% 基于串的解码
......
......@@ -3997,12 +3997,13 @@ $\textrm{``you''} = \argmax_{y} \textrm{P}(y|\textbf{s}_1, \alert{\textbf{C}})$
\item 通过自注意机制能够直接获取全局信息,不像RNN需要逐步进行信息提取,也不像CNN只能获取局部信息,可以并行化操作,提高训练效率
\item Transformer不仅仅被用于神经机器翻译任务,还广泛用于其他NLP任务、甚至图像处理任务。目前最火的预训练模型Bert也基于Transformer
\item<2-> Transformer不仅仅被用于神经机器翻译任务,还广泛用于其他NLP任务、甚至图像处理任务。目前最火的预训练模型Bert也基于Transformer
\end{itemize}
\vspace{0em}
\visible<2->{
{
\footnotesize
\begin{center}
......@@ -4027,6 +4028,8 @@ $\textrm{``you''} = \argmax_{y} \textrm{P}(y|\textbf{s}_1, \alert{\textbf{C}})$
\end{tabular}
\end{center}
}
}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论