Commit 3e23c5be by 曹润柘

update Chapter1-3

parent 081437fd
......@@ -3,7 +3,6 @@
\definecolor{ugreen}{rgb}{0,0.5,0}
%%% outline
%-------------------------------------------------------------------------
......@@ -115,3 +114,4 @@
%---------------------------------------------------------------------
......@@ -10,14 +10,14 @@
\begin{scope}
{
{\footnotesize
\node [anchor=north west] (rule1) at (0,0) {\textbf{1: If} 源='我', \textbf{then} 译='I'};
\node [anchor=north west] (rule2) at ([yshift=0.1em]rule1.south west) {\textbf{2: If} 源='你', \textbf{then} 译='you'};
\node [anchor=north west] (rule3) at ([yshift=0.1em]rule2.south west) {\textbf{3: If} 源='感到 满意',};
\node [anchor=north west] (rule3part2) at ([yshift=0.5em]rule3.south west) {\textbf{\hspace{0.95em} then} 译='be satisfied with'};
\node [anchor=north west] (rule4) at ([yshift=0.1em]rule3part2.south west) {\textbf{4: If} 源='对 ... 动词[表态度]'};
\node [anchor=north west] (rule1) at (0,0) {\textbf{1: If} 源=`我', \textbf{then} 译=`I'};
\node [anchor=north west] (rule2) at ([yshift=0.1em]rule1.south west) {\textbf{2: If} 源=`你', \textbf{then} 译=`you'};
\node [anchor=north west] (rule3) at ([yshift=0.1em]rule2.south west) {\textbf{3: If} 源=`感到 满意',};
\node [anchor=north west] (rule3part2) at ([yshift=0.5em]rule3.south west) {\textbf{\hspace{0.95em} then} 译=`be satisfied with'};
\node [anchor=north west] (rule4) at ([yshift=0.1em]rule3part2.south west) {\textbf{4: If} 源=`对 ... 动词[表态度]'};
\node [anchor=north west] (rule4part2) at ([yshift=0.5em]rule4.south west) {\textbf{\hspace{0.95em} then} 调序[动词 + 对象]};
\node [anchor=north west] (rule5) at ([yshift=0.1em]rule4part2.south west) {\textbf{5: If} 译文主语是'I'};
\node [anchor=north west] (rule5part2) at ([yshift=0.5em]rule5.south west) {\textbf{\hspace{0.95em} then} be动词为'am/was'};
\node [anchor=north west] (rule5) at ([yshift=0.1em]rule4part2.south west) {\textbf{5: If} 译文主语是`I'};
\node [anchor=north west] (rule5part2) at ([yshift=0.5em]rule5.south west) {\textbf{\hspace{0.95em} then} be动词为`am/was'};
\node [anchor=north west] (rule6) at ([yshift=0.1em]rule5part2.south west) {\textbf{6: If} 源语是主谓结构};
\node [anchor=north west] (rule6part2) at ([yshift=0.5em]rule6.south west) {\textbf{\hspace{0.95em} then} 译文为主谓结构};
\node [anchor=south west] (rulebaselabel) at (rule1.north west) {{\color{ublue} 资源:规则库}};
......
......@@ -10,19 +10,21 @@
{
\begin{scope}
{\scriptsize
\node [anchor=north west] (example1) at (0,0) {\textbf{1:} 源='他 在 哪 ?'};
\node [anchor=north west] (example1part2) at ([yshift=0.5em]example1.south west) {\hspace{1em} 译='Where is he ?'};
\node [anchor=north west] (example2) at ([yshift=0.1em]example1part2.south west) {\textbf{2:} 源='我 真高兴'};
\node [anchor=north west] (example2part2) at ([yshift=0.5em]example2.south west) {\hspace{1em} 译='I'm so happy'};
\node [anchor=north west] (example3) at ([yshift=0.1em]example2part2.south west) {\textbf{3:} 源='出发 !'};
\node [anchor=north west] (example3part2) at ([yshift=0.5em]example3.south west) {\hspace{1em} 译='Let's go!'};
\node [anchor=north west] (example1) at (0,0) {\textbf{1:} 源=`他 在 哪 ?'};
\node [anchor=north west] (example1part2) at ([yshift=0.2em]example1.south west) {\hspace{1em} 译=`Where is he ?'};
\node [anchor=north west] (example2) at ([yshift=0.1em]example1part2.south west) {\textbf{2:} 源=`我 真高兴'};
\node [anchor=north west] (example2part2) at ([yshift=0.2em]example2.south west) {\hspace{1em} 译=`I'm so happy'};
\node [anchor=north west] (example3) at ([yshift=0.1em]example2part2.south west) {\textbf{3:} 源=`出发 !'};
\node [anchor=north west] (example3part2) at ([yshift=0.2em]example3.south west) {\hspace{1em} 译=`Let's go!'};
\node [anchor=north west] (example4) at ([yshift=0.1em]example3part2.south west) {\hspace{1em} ...};
\node [anchor=south west] (bidatalabel) at (example1.north west) {{\color{ublue} 资源1:双语平行语料}};
\node [anchor=north west] (example5) at ([yshift=0.1em]example4.south west) {\hspace{1em}\quad};
\node [anchor=north west] (example6) at ([yshift=0.1em]example5.south west) {\hspace{1em}\quad};
\node [anchor=south west] (bidatalabel) at (example1.north west) {{\color{ublue}\small{资源1:双语平行语料}}};
}
\begin{pgfonlayer}{background}
{
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (example1) (example1part2) (example2) (example2part2) (example3) (example3part2) (example4) (bidatalabel)] (bidata) {};
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (example1) (example1part2) (example2) (example2part2) (example3) (example3part2) (example4) (bidatalabel)(example6)] (bidata) {};
}
\end{pgfonlayer}
......@@ -32,16 +34,17 @@
{
\begin{scope} [yshift=-1.55in]
{\scriptsize
\node [anchor=north west] (entry1) at (0,0) {\textbf{1:} What is NiuTrans ?};
\node [anchor=north west] (entry2) at ([yshift=0.1em]entry1.south west) {\textbf{2:} Are you fulfilled ?};
\node [anchor=north west] (entry3) at ([yshift=0.1em]entry2.south west) {\textbf{3:} Yes, you are right .};
\node [anchor=north west] (entry4) at ([yshift=0.1em]entry3.south west) {\hspace{1em} ...};
\node [anchor=south west] (monodatalabel) at (entry1.north west) {{\color{ublue} 资源2:单语语料}};
\node [anchor=north west] (entry1) at (0,0) {\textbf{1:} What is NiuTrans ?\qquad \qquad };
\node [anchor=north west] (entry2) at ([yshift=0.0em]entry1.south west) {\textbf{2:} Are you fulfilled ?};
\node [anchor=north west] (entry3) at ([yshift=0.0em]entry2.south west) {\textbf{3:} Yes, you are right .};
\node [anchor=north west] (entry4) at ([yshift=0.0em]entry3.south west) {\hspace{1em} ...};
\node [anchor=north west] (entry5) at ([yshift=0.1em]entry4.south west) {\hspace{1em}{\quad}};
\node [anchor=south west] (monodatalabel) at (entry1.north west) {{\color{ublue}\small{资源2:单语语料}}};
}
\begin{pgfonlayer}{background}
{
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (entry1) (entry2) (entry3) (entry4) (monodatalabel)] (monodata) {};
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (entry1) (entry2) (entry3) (entry4) (entry5)(monodatalabel)] (monodata) {};
}
\end{pgfonlayer}
......@@ -91,11 +94,11 @@
}
{
\draw[->,thick,ublue] (bidata.east)--([xshift=1.7em]bidata.east) node[pos=0.5,above] (simexample) {\color{red}{\scriptsize{\textbf{学习}}}};
\draw[->,thick,ublue] (bidata.east)--([xshift=2.7em]bidata.east) node[pos=0.5,above] (simexample) {\color{red}{\scriptsize{\textbf{学习}}}};
}
{
\draw[->,thick,ublue] (monodata.east)--([xshift=1.7em]monodata.east) node[pos=0.5,above] (simexample) {\color{red}{\scriptsize{\textbf{学习}}}};
\draw[->,thick,ublue] (monodata.east)--([xshift=2.7em]monodata.east) node[pos=0.5,above] (simexample) {\color{red}{\scriptsize{\textbf{学习}}}};
}
\begin{scope}[xshift=3.6in]
......@@ -123,22 +126,22 @@ You and me & {0.02}\\
}
{
\node[anchor=west,double,draw=ublue,thick] (decoder) at ([xshift=1em,yshift=-12em]srcsentence.south west) {翻译引擎};
\node[anchor=west,double,draw=ublue,thick] (decoder) at ([xshift=1em,yshift=-13em]srcsentence.south west) {翻译引擎};
\draw[->,thick,ublue] ([yshift=1em]phrasetable.south east) .. controls +(east:1.0em) and +(west:2.5em) .. (decoder.west);
\draw[->,thick,ublue] ([yshift=-2em]langaugemodel.east) .. controls +(east:1.0em) and +(west:1.5em) .. (decoder.west);
}
{
\draw[->,thick,double,ublue] (decoder.north) -- ([yshift=2em]decoder.north) node[pos=0.5,right] (decodinglabel) {\color{red}{\tiny{\textbf{枚举所有可能}}}};
\draw[->,thick,double,ublue] (decoder.north) -- ([yshift=2.2em]decoder.north) node[pos=0.5,right] (decodinglabel) {\color{red}{\tiny{\textbf{枚举所有可能}}}};
}
{
\draw[->,thick,double,ublue] (decoder.east) .. controls +(east:3.5em) .. ([xshift=3.5em,yshift=2.8em]decoder.east) node[pos=0.3,below] (decodinglabel) {\color{red}{\tiny{\textbf{计算翻译可能性}}}};
\draw[->,thick,double,ublue] (decoder.east) .. controls +(east:3.5em) .. ([xshift=3.5em,yshift=3.0em]decoder.east) node[xshift=0.5em,pos=0.3,below] (decodinglabel) {\color{red}{\tiny{\textbf{计算翻译可能性}}}};
}
{
\node[anchor=west,draw,thick,red,minimum width=11.5em,minimum height=1em] (outputlabel) at ([xshift=-0.3em,yshift=-5.6em]srcsentence.south west){};
\node[anchor=west,draw,thick,red,minimum width=11.5em,minimum height=1em] (outputlabel) at ([xshift=-0.3em,yshift=-6.1em]srcsentence.south west){};
\node[anchor=west] (outputlabel2) at ([xshift=-0.3em]outputlabel.east) {\color{red}{\tiny{\textbf{输出}}}};
}
......
......@@ -30,50 +30,50 @@
\node [anchor=north west] (ht1-4) at ([yshift=0.4em]ht1-3.south west) {\scriptsize{and LOVE had to {\color{red}\underline{seek for help.}}}};
%第二段--------------------------------
%原文-------------
\node[anchor=north west] (original4) at ([xshift=-3.5em,yshift=-0.3em]ht1-4.south west) {\scriptsize{\qquad文:这时,富裕乘着一艘大船经过。爱说:“富裕,你能带我走吗?”富裕 答道:“不,我的船中}};
\node[anchor=north west] (original4-1) at ([xshift=3.5em,yshift=0.3em]original4.south west) {\scriptsize{有许多金银财宝,没有你的位置。”爱看见虚荣在一艘华丽的小船上,说:“虚荣,帮帮我吧}};
\node[anchor=north west] (original4-2) at ([yshift=0.3em]original4-1.south west) {\scriptsize{”“我帮不了你。你全身都湿透了,会弄坏我这漂亮的小船的。”悲哀来了,爱向他求助:“}};
\node[anchor=north west] (original4-3) at ([yshift=0.3em]original4-2.south west) {\scriptsize{悲哀,让我跟你去吧!”“哦,……爱,我实在太悲哀了,想自己一个人呆一会儿!”悲哀答}};
\node[anchor=north west] (original4) at ([xshift=-3.5em,yshift=-0.3em]ht1-4.south west) {\scriptsize{\qquad文:这时,富裕乘着一艘大船经过。爱说:``富裕,你能带我走吗?''富裕 答道:``不,我的船中}};
\node[anchor=north west] (original4-1) at ([xshift=3.5em,yshift=0.3em]original4.south west) {\scriptsize{有许多金银财宝,没有你的位置。''爱看见虚荣在一艘华丽的小船上,说:``虚荣,帮帮我吧}};
\node[anchor=north west] (original4-2) at ([yshift=0.3em]original4-1.south west) {\scriptsize{''``我帮不了你。你全身都湿透了,会弄坏我这漂亮的小船的。''悲哀来了,爱向他求助:``}};
\node[anchor=north west] (original4-3) at ([yshift=0.3em]original4-2.south west) {\scriptsize{悲哀,让我跟你去吧!''``哦,……爱,我实在太悲哀了,想自己一个人呆一会儿!''悲哀答}};
\node[anchor=north west] (original4-4) at ([yshift=0.3em]original4-3.south west) {\scriptsize{道。快乐走近爱的身边,但是她太快乐了,竟然没有听见爱在叫她!}};
%机器翻译--------------
\node [anchor=north west] (mt4) at ([xshift=-3.5em,yshift=0.3em]original4-4.south west) {\scriptsize{机器翻译:At this time, Richness {\color{red}\underline{passed by}} in a big ship. Love said, "Rich, can you take me away?" Richness}};
\node [anchor=north west] (mt4) at ([xshift=-3.5em,yshift=0.3em]original4-4.south west) {\scriptsize{机器翻译:At this time, Richness {\color{red}\underline{passed by}} in a big ship. Love said, ``Rich, can you take me away?'' Richness}};
\node [anchor=north west] (mt4-1) at ([xshift=3.5em,yshift=0.4em]mt4.south west) {\scriptsize{replied, "No, {\color{red}\underline{there are many treasures}} of gold and silver in my ship,and there is no place for you."}};
\node [anchor=north west] (mt4-1) at ([xshift=3.5em,yshift=0.4em]mt4.south west) {\scriptsize{replied, ``No, {\color{red}\underline{there are many treasures}} of gold and silver in my ship,and there is no place for you.''}};
\node [anchor=north west] (mt4-2) at ([yshift=0.4em]mt4-1.south west) {\scriptsize{ Love saw vanity in a magnificent boat and said, "Vanity, help me!" "I can't help you. You are {\color{red}\underline{soak}}}};
\node [anchor=north west] (mt4-3) at ([yshift=0.4em]mt4-2.south west) {\scriptsize{{\color{red}\underline{-ed to the skin}} and will damage my beautiful boat." When sorrow came, love asked him for help: "}};
\node [anchor=north west] (mt4-2) at ([yshift=0.4em]mt4-1.south west) {\scriptsize{ Love saw vanity in a magnificent boat and said, ``Vanity, help me!'' ``I can't help you. You are {\color{red}\underline{soak}}}};
\node [anchor=north west] (mt4-3) at ([yshift=0.4em]mt4-2.south west) {\scriptsize{{\color{red}\underline{-ed to the skin}} and will damage my beautiful boat.'' When sorrow came, love asked him for help: ``}};
\node [anchor=north west] (mt4-4) at ([yshift=0.4em]mt4-3.south west) {\scriptsize{sorrow, let me go with you!" "Oh,...love, I am so sad that I want to be alone for a while!" Sadly rep}};
\node [anchor=north west] (mt4-4) at ([yshift=0.4em]mt4-3.south west) {\scriptsize{sorrow, let me go with you!'' ``Oh,...love, I am so sad that I want to be alone for a while!'' Sadly rep}};
\node [anchor=north west] (mt4-5) at ([yshift=0.4em]mt4-4.south west) {\scriptsize{-lied. Happiness {\color{red}\underline{approached}} love, but she was too happy to hear love calling her!}};
%人工翻译---------------
\node [anchor=north west] (ht4) at ([xshift=-3.5em,yshift=0.3em]mt4-5.south west) {\scriptsize{人工翻译:At that moment, WEALTH {\color{red}\underline{was passing by}} in a big boat. Love said,"WEALTH, can you take me}};
\node [anchor=north west] (ht4) at ([xshift=-3.5em,yshift=0.3em]mt4-5.south west) {\scriptsize{人工翻译:At that moment, WEALTH {\color{red}\underline{was passing by}} in a big boat. Love said,``WEALTH, can you take me}};
\node [anchor=north west] (ht4-1) at ([xshift=3.5em,yshift=0.4em]ht4.south west) {\scriptsize{with you?" WEALTH answered, "no, {\color{red}\underline{there is a lot}} of gold and silver in my boat. There is no place}};
\node [anchor=north west] (ht4-1) at ([xshift=3.5em,yshift=0.4em]ht4.south west) {\scriptsize{with you?'' WEALTH answered, ``no, {\color{red}\underline{there is a lot}} of gold and silver in my boat. There is no place}};
\node [anchor=north west] (ht4-2) at ([yshift=0.4em]ht4-1.south west) {\scriptsize{for you." Love saw VANITY in a beautiful boat and said, "VANITY, help me!" "I can't help you.}};
\node [anchor=north west] (ht4-3) at ([yshift=0.4em]ht4-2.south west) {\scriptsize{You are {\color{red}\underline{all wet,}} and will break my pretty boat." Then SADNESS came. Love asked for help,"SAD}};
\node [anchor=north west] (ht4-2) at ([yshift=0.4em]ht4-1.south west) {\scriptsize{for you.'' Love saw VANITY in a beautiful boat and said, ``VANITY, help me!'' ``I can't help you.}};
\node [anchor=north west] (ht4-3) at ([yshift=0.4em]ht4-2.south west) {\scriptsize{You are {\color{red}\underline{all wet,}} and will break my pretty boat.'' Then SADNESS came. Love asked for help,``SAD}};
\node [anchor=north west] (ht4-4) at ([yshift=0.4em]ht4-3.south west) {\scriptsize{-NESS, let me go with you!" "Oh,...LOVE, I am so sad that I want to be alone for a while!" "Repli}};
\node [anchor=north west] (ht4-4) at ([yshift=0.4em]ht4-3.south west) {\scriptsize{-NESS, let me go with you!'' ``Oh,...LOVE, I am so sad that I want to be alone for a while!'' ``Repli}};
\node [anchor=north west] (ht4-5) at ([yshift=0.4em]ht4-4.south west) {\scriptsize{-ed SADNESS. JOY {\color{red}\underline{came close to }} love, but she was so happy that she did not hear him call her!}};
%第三段--------------------------------
\node[anchor=north west] (original8) at ([xshift=-3.5em,yshift=-0.3em]ht4-5.south west) {\scriptsize{\qquad文:突然,一个声音传来:“过来,爱,我带你走。”这是位长者。爱大喜过望,竟忘了问他他}};
\node[anchor=north west] (original8-1) at ([xshift=3.5em,yshift=0.3em]original8.south west) {\scriptsize{的名字。登上陆地后,长者独自走开了。爱对长者感激不尽,问另一位长者知识:帮我的}};
\node[anchor=north west] (original8-2) at ([yshift=0.3em]original8-1.south west) {\scriptsize{那个人是谁?”“他是时间。”知识老人回答。“时间?”爱问道,“他为什么要帮我?”知识老}};
\node[anchor=north west] (original8-3) at ([yshift=0.3em]original8-2.south west) {\scriptsize{人笑道:“因为只有时间才能理解爱有多么伟大。”}};
\node[anchor=north west] (original8) at ([xshift=-3.5em,yshift=-0.3em]ht4-5.south west) {\scriptsize{\qquad文:突然,一个声音传来:``过来,爱,我带你走。''这是位长者。爱大喜过望,竟忘了问他他}};
\node[anchor=north west] (original8-1) at ([xshift=3.5em,yshift=0.3em]original8.south west) {\scriptsize{的名字。登上陆地后,长者独自走开了。爱对长者感激不尽,问另一位长者知识:``帮我的}};
\node[anchor=north west] (original8-2) at ([yshift=0.3em]original8-1.south west) {\scriptsize{那个人是谁?''``他是时间。''知识老人回答。``时间?''爱问道,``他为什么要帮我?''知识老}};
\node[anchor=north west] (original8-3) at ([yshift=0.3em]original8-2.south west) {\scriptsize{人笑道:``因为只有时间才能理解爱有多么伟大。''}};
%机器翻译--------------
\node [anchor=north west] (mt8) at ([xshift=-3.5em,yshift=0.4em]original8-3.south west) {\scriptsize{机器翻译:Suddenly, a voice {\color{red}\underline{came:}} "Come here, love, I'll take you away." This is an elder. Love was {\color{red}\underline{overjoy}}}};
\node [anchor=north west] (mt8) at ([xshift=-3.5em,yshift=0.4em]original8-3.south west) {\scriptsize{机器翻译:Suddenly, a voice {\color{red}\underline{came:}} ``Come here, love, I'll take you away.'' This is an elder. Love was {\color{red}\underline{overjoy}}}};
\node [anchor=north west] (mt8-1) at ([xshift=3.5em,yshift=0.4em]mt8.south west) {\scriptsize{{\color{red}\underline{-ed and}} forgot to ask his name. After landing on land, the elder walked away alone.Love was very}};
\node [anchor=north west] (mt8-2) at ([yshift=0.4em]mt8-1.south west) {\scriptsize{grateful to the elder and asked another elder knowledge, {\color{red}\underline{"Who is the person who helped me?"}} "He}};
\node [anchor=north west] (mt8-3) at ([yshift=0.4em]mt8-2.south west) {\scriptsize{is time." The {\color{red}\underline{old intellectual}} replied. "Time?" Love asked,"Why did he help me?" The old intellec}};
\node [anchor=north west] (mt8-4) at ([yshift=0.4em]mt8-3.south west) {\scriptsize{-tual laughed, "Because only time canunderstand how great love is."}};
\node [anchor=north west] (mt8-2) at ([yshift=0.4em]mt8-1.south west) {\scriptsize{grateful to the elder and asked another elder knowledge, {\color{red}\underline{``Who is the person who helped me?''}} ``He}};
\node [anchor=north west] (mt8-3) at ([yshift=0.4em]mt8-2.south west) {\scriptsize{is time.'' The {\color{red}\underline{old intellectual}} replied. ``Time?'' Love asked,``Why did he help me?'' The old intellec}};
\node [anchor=north west] (mt8-4) at ([yshift=0.4em]mt8-3.south west) {\scriptsize{-tual laughed, ``Because only time canunderstand how great love is.''}};
%人工翻译---------------
\node [anchor=north west] (ht8) at ([xshift=-3.5em,yshift=0.4em]mt8-4.south west) {\scriptsize{人工翻译:Suddenly, a voice {\color{red}\underline{said,}} "come, LOVE, I'll take you." This is an elder. LOVE was {\color{red}\underline{so over that}} she}};
\node [anchor=north west] (ht8) at ([xshift=-3.5em,yshift=0.4em]mt8-4.south west) {\scriptsize{人工翻译:Suddenly, a voice {\color{red}\underline{said,}} ``come, LOVE, I'll take you.'' This is an elder. LOVE was {\color{red}\underline{so over that}} she}};
\node [anchor=north west] (ht8-1) at ([xshift=3.5em,yshift=0.4em]ht8.south west) {\scriptsize{forgot to ask his name. After landing on land, the elder walked away}};
\node [anchor=north west] (ht8-2) at ([yshift=0.4em]ht8-1.south west) {\scriptsize{alone.LOVE was so grateful to the elder that she asked KNOWLEDGE, another elder, {\color{red}\underline{"who help}}}};
\node [anchor=north west] (ht8-3) at ([yshift=0.4em]ht8-2.south west) {\scriptsize{{\color{red}\underline{-ed me?"}} "He is TIME." The {\color{red}\underline{old man}} replied. "TIME?" LOVE asked. "why did he help me?" The}};
\node [anchor=north west] (ht8-4) at ([yshift=0.4em]ht8-3.south west) {\scriptsize{old man smiled and said, "Because only time can understand how great love is."}};
\node [anchor=north west] (ht8-2) at ([yshift=0.4em]ht8-1.south west) {\scriptsize{alone.LOVE was so grateful to the elder that she asked KNOWLEDGE, another elder, {\color{red}\underline{``who help}}}};
\node [anchor=north west] (ht8-3) at ([yshift=0.4em]ht8-2.south west) {\scriptsize{{\color{red}\underline{-ed me?''}} ``He is TIME.'' The {\color{red}\underline{old man}} replied. ``TIME?'' LOVE asked. ``why did he help me?'' The}};
\node [anchor=north west] (ht8-4) at ([yshift=0.4em]ht8-3.south west) {\scriptsize{old man smiled and said, ``Because only time can understand how great love is.''}};
%{
%\draw[dotted,thick,ublue] ([xshift=10.3em,yshift=0.3em]mt8.south west)--%([xshift=-5.2em,yshift=-0.3em]ht8.north);
......
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
%%% outline
%-------------------------------------------------------------------------
\begin{minipage}[t]{0.40\textwidth}
\begin{center}
{
\begin{center}
\begin{tikzpicture}
\node [anchor=south west, fill=blue!50, minimum width=1.1cm, minimum height=2.3cm] (mt) at (1,0) {{\color{white} \textbf{机器}}};
\node [anchor=south west, fill=red!50, minimum width=1.1cm, minimum height=2.7cm] (human) at ([xshift=0.5cm]mt.south east) {{\color{white} \textbf{}}};
\node [anchor=south] (mtscore) at (mt.north) {3.9};
\node [anchor=south] (humanscore) at (human.north) {4.7};
\draw [->,thick] ([xshift=-0.5cm]mt.south west) -- ([xshift=0.5cm]human.south east);
\draw [->,thick] ([xshift=-0.5cm]mt.south west) -- ([xshift=-0.5cm,yshift=3.2cm]mt.south west);
\end{tikzpicture}
\end{center}
\footnotesize{人工评价(5分满)}
}
\end{center}
\end{minipage}
\begin{minipage}[t]{0.40\textwidth}
\begin{center}
{
\begin{center}
\begin{tikzpicture}
\node [anchor=south west, fill=blue!50, minimum width=1.1cm, minimum height=1.5cm] (mt) at (1,0) {{\color{white} \textbf{机器}}};
\node [anchor=south west, fill=red!50, minimum width=1.1cm, minimum height=2.7cm] (human) at ([xshift=0.5cm]mt.south east) {{\color{white} \textbf{}}};
\node [anchor=south] (mtscore) at (mt.north) {47\%};
\node [anchor=south] (humanscore) at (human.north) {100\%};
\draw [->,thick] ([xshift=-0.5cm]mt.south west) -- ([xshift=0.5cm]human.south east);
\draw [->,thick] ([xshift=-0.5cm]mt.south west) -- ([xshift=-0.5cm,yshift=3.2cm]mt.south west);
\end{tikzpicture}
\end{center}
\footnotesize{自动评价}
}
\end{center}
\end{minipage}
%---------------------------------------------------------------------
......@@ -10,10 +10,10 @@
\begin{scope}
{
{\footnotesize
\node [anchor=north west] (example1) at (0,0) {\textbf{1:} 源='什么 时候 开始 ?'};
\node [anchor=north west] (example1part2) at ([yshift=0.5em]example1.south west) {\hspace{1em} 译='When will it start ?'};
\node [anchor=north west] (example2) at ([yshift=0.1em]example1part2.south west) {\textbf{2:} 源='我 对 他 感到 高兴'};
\node [anchor=north west] (example2part2) at ([yshift=0.5em]example2.south west) {\hspace{1em} 译='I am happy with him'};
\node [anchor=north west] (example1) at (0,0) {\textbf{1:} 源=`什么 时候 开始 ?'};
\node [anchor=north west] (example1part2) at ([yshift=0.5em]example1.south west) {\hspace{1em} 译=`When will it start ?'};
\node [anchor=north west] (example2) at ([yshift=0.1em]example1part2.south west) {\textbf{2:} 源=`我 对 他 感到 高兴'};
\node [anchor=north west] (example2part2) at ([yshift=0.5em]example2.south west) {\hspace{1em} 译=`I am happy with him'};
\node [anchor=north west] (example3) at ([yshift=0.1em]example2part2.south west) {\hspace{1em} ...};
\node [anchor=south west] (examplebaselabel) at (example1.north west) {{\color{ublue} 资源1:翻译实例库}};
}
......@@ -92,7 +92,7 @@
}
{
\draw[double,->,thick,ublue] (e3.south)--([yshift=-1.2em]e3.south) node[pos=0.5,right,xshift=0.2em,yshift=0.2em] (step1) {\color{red}{\tiny{\textbf{'你'替换'他'}}}};
\draw[double,->,thick,ublue] (e3.south)--([yshift=-1.2em]e3.south) node[pos=0.5,right,xshift=0.2em,yshift=0.2em] (step1) {\color{red}{\tiny{\textbf{`你'替换`他'}}}};
\draw[->,dotted,thick,red] ([xshift=-0.1em]entry2.east)..controls +(east:4) and +(west:4)..([yshift=-0.6em,xshift=-0.5em]e3.south) ;
}
......@@ -122,7 +122,7 @@
}
{
\draw[double,->,thick,ublue] (e3.south)--([yshift=-1.2em]e3.south) node[pos=0.5,right,xshift=0.2em,yshift=0.2em] (step1) {\color{red}{\tiny{\textbf{'满意'替换'高兴'}}}};
\draw[double,->,thick,ublue] (e3.south)--([yshift=-1.2em]e3.south) node[pos=0.5,right,xshift=0.2em,yshift=0.2em] (step1) {\color{red}{\tiny{\textbf{`满意'替换`高兴'}}}};
\draw[->,dotted,thick,red] ([xshift=-1.2em,yshift=-0.6em]entry3.north east)..controls +(east:2) and +(west:3)..([yshift=-0.6em,xshift=-0.5em]e3.south) ;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
{
{\small
\node [anchor=north west] (entry1) at (0,0) {\textbf{1:}};
\node [anchor=north west] (entry2) at ([yshift=0.1em]entry1.south west) {\textbf{2:}};
\node [anchor=north west] (entry3) at ([yshift=0.1em]entry2.south west) {\textbf{3:} 现在};
\node [anchor=north west] (entry4) at ([yshift=0.1em]entry3.south west) {\textbf{4:} 物价};
\node [anchor=north west] (entry5) at ([yshift=0.1em]entry4.south west) {\textbf{5:} 确实};
\node [anchor=north west] (entry6) at ([yshift=0.1em]entry5.south west) {\textbf{6:} 实现};
\node [anchor=south west] (dictionarylabel) at (entry1.north west) {{\color{ublue} 分词词典}};
}
}
\begin{pgfonlayer}{background}
{
\node[rectangle,draw=ublue, inner sep=0.2em] [fit = (entry1) (entry2) (entry3) (entry4) (entry5) (entry6) (dictionarylabel)] {};
}
\end{pgfonlayer}
\end{scope}
{
\begin{scope}[xshift=1.2in,yshift=1em]
\node [anchor=west] (c1) at (0,0) {};
\node [anchor=west] (c2) at ([xshift=0em]c1.east) {};
\node [anchor=west] (c3) at ([xshift=0em]c2.east) {};
\node [anchor=west] (c4) at ([xshift=0em]c3.east) {};
\node [anchor=west] (c5) at ([xshift=0em]c4.east) {};
\node [anchor=west] (c6) at ([xshift=0em]c5.east) {};
\node [anchor=west] (c7) at ([xshift=0em]c6.east) {};
\node [anchor=west] (c8) at ([xshift=0em]c7.east) {};
\end{scope}
}
\begin{scope}[xshift=1.2in,yshift=-4em]
{
\node [anchor=west] (bc1) at (0,0) {};
\node [anchor=west] (bc2) at ([xshift=0em]bc1.east) {};
}
{
\node [anchor=west] (bc3) at ([xshift=0em]bc2.east) {};
\node [anchor=west] (bc4) at ([xshift=0em]bc3.east) {};
}
{
\node [anchor=west] (bc5) at ([xshift=0em]bc4.east) {};
\node [anchor=west] (bc6) at ([xshift=0em]bc5.east) {};
}
{
\node [anchor=west] (bc7) at ([xshift=0em]bc6.east) {};
}
{
\node [anchor=west] (bc8) at ([xshift=0em]bc7.east) {};
}
{
\draw [-,very thick] ([xshift=-0.3em,yshift=0.1em]bc2.south east) -- ([xshift=0.3em,yshift=-0.1em]bc3.north west);
}
{
\draw [-,very thick] ([xshift=-0.3em,yshift=0.1em]bc4.south east) -- ([xshift=0.3em,yshift=-0.1em]bc5.north west);
}
{
\draw [-,very thick] ([xshift=-0.3em,yshift=0.1em]bc6.south east) -- ([xshift=0.3em,yshift=-0.1em]bc7.north west);
}
{
\draw [-,very thick] ([xshift=-0.3em,yshift=0.1em]bc7.south east) -- ([xshift=0.3em,yshift=-0.1em]bc8.north west);
}
\end{scope}
{
\draw [<-,thick] ([yshift=-0.2em]c1.north west) -- ([yshift=0.2em]c1.north west);
\node [anchor=south] (b1) at ([yshift=0.0em]c1.north west) {\scriptsize{起始}};
}
{
\draw [<-,thick] ([yshift=-0.2em]c3.north west) -- ([yshift=0.2em]c3.north west);
\node [anchor=south] (b2) at ([yshift=0.0em]c3.north west) {\scriptsize{起始}};
}
{
\draw [<-,thick] ([yshift=-0.2em]c5.north west) -- ([yshift=0.2em]c5.north west);
\node [anchor=south] (b3) at ([yshift=0.0em]c5.north west) {\scriptsize{起始}};
}
{
\draw [<-,thick] ([yshift=-0.2em]c7.north west) -- ([yshift=0.2em]c7.north west);
\node [anchor=south] (b4) at ([yshift=0.0em]c7.north west) {\scriptsize{起始}};
}
{
\draw [<-,thick] ([yshift=-0.2em]c8.north west) -- ([yshift=0.2em]c8.north west);
\node [anchor=south] (b5) at ([yshift=0.0em]c8.north west) {\scriptsize{起始}};
}
{
\node [anchor=west,thick,draw,red,minimum width=1.6em,minimum height=1.3em] (w18) at ([xshift=0.1em]c8.west){};
\node [anchor=north] (l18) at ([yshift=0.2em]w18.south) {{\color{red} \footnotesize{命中:2}}};
}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\vspace{0.3em}
\begin{tikzpicture}
\begin{scope}
\node [] (input) at (0,0) {{\scriptsize 猫喜欢吃鱼}};
{
\begin{scope}[scale=0.8,xshift=0.9in,yshift=-0.87in,level distance=20pt,sibling distance=-1pt,grow'=up]
{\scriptsize
\Tree[.\node(sn0){IP};
[.\node(sn1){NP};
[.\node(sn2){NN}; \node(sw1){}; ]
]
[.\node(sn3){VP};
[.\node(sn4){VV}; \node(sw2){喜欢}; ]
[.\node(sn5){VP}; \edge[roof]; \node(sw3){\ }; ]
]
]
}
\end{scope}
\node [anchor=west,draw,thick,inner sep=3pt,ublue] (mtengine) at ([xshift=1.05in]input.east) {{\scriptsize MT系统}};
\begin{scope}[scale=0.8,xshift=3.0in,yshift=-0.87in,level distance=20pt,sibling distance=-3pt,grow'=up]
{\scriptsize
\Tree[.\node(tn0){S};
[.\node(tn1){NP};
[.\node(tn2){NNS}; \node(tw1){cats}; ]
]
[.\node(tn3){VP};
[.\node(tn4){VB}; \node(tw2){like}; ]
[.\node(tn5){VP}; \edge[roof]; \node(tw3){eating fish}; ]
]
]
}
\end{scope}
}
\node [] (output) at ([xshift=3.35in]input.east) {{\scriptsize Cats like eating fish}};
\draw[->,thick] ([xshift=-1pt]input.east) -- ([xshift=8pt]input.east);
\draw[->,thick] ([xshift=-10pt]output.west) -- ([xshift=-0pt]output.west);
{
\draw[->,thick] ([xshift=-12pt]mtengine.west) -- ([xshift=-2pt]mtengine.west);
\draw[->,thick] ([xshift=2pt]mtengine.east) -- ([xshift=12pt]mtengine.east);
}
{
\node[minimum height=4em,minimum width=4.5em,fill=white] (inputmarking) at (0.85in,-0.39in) {};
\node[minimum height=4em,minimum width=5.2em,fill=white] (outputmarking) at (2.55in,-0.39in) {};
}
\node [anchor=south] (inputlabel) at ([yshift=-0.5em]input.north) {{\scriptsize \color{red}{\textbf{输入}}}};
\node [anchor=south] (outputlabel) at ([yshift=-0.5em]output.north) {{\scriptsize \color{red}{\textbf{输出}}}};
{
\node [anchor=west] (mtinputlabel) at ([xshift=0.29in]inputlabel.east) {{\scriptsize \color{red}{\textbf{实际的输入}}}};
\node [anchor=west] (mtoutputlabel) at ([xshift=0.86in]mtinputlabel.east) {{\scriptsize \color{red}{\textbf{实际的输出}}}};
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (mtinputlabel) (mtoutputlabel) (inputmarking) (outputmarking)] {};
}
{
\node[rectangle,fill=ublue,inner sep=0mm] [fit = (mtinputlabel) (mtoutputlabel) (inputmarking) (outputmarking)] {{\color{white} \textbf{\Large{MT 系统}}}};
}
\begin{scope}[scale=0.9,xshift=1.2in,yshift=-1.2in,level distance=20pt,sibling distance=0pt]
\end{scope}
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\vspace{0.3em}
\begin{tikzpicture}
\begin{scope}
\node [] (input) at (0,0) {{\scriptsize 猫喜欢吃鱼}};
{
\begin{scope}[scale=0.8,xshift=0.9in,yshift=-0.87in,level distance=20pt,sibling distance=-1pt,grow'=up]
{\scriptsize
\Tree[.\node(sn0){IP};
[.\node(sn1){NP};
[.\node(sn2){NN}; \node(sw1){}; ]
]
[.\node(sn3){VP};
[.\node(sn4){VV}; \node(sw2){喜欢}; ]
[.\node(sn5){VP}; \edge[roof]; \node(sw3){\ }; ]
]
]
}
\end{scope}
\node [anchor=west,draw,thick,inner sep=3pt,ublue] (mtengine) at ([xshift=1.05in]input.east) {{\scriptsize MT系统}};
\begin{scope}[scale=0.8,xshift=3.0in,yshift=-0.87in,level distance=20pt,sibling distance=-3pt,grow'=up]
{\scriptsize
\Tree[.\node(tn0){S};
[.\node(tn1){NP};
[.\node(tn2){NNS}; \node(tw1){cats}; ]
]
[.\node(tn3){VP};
[.\node(tn4){VB}; \node(tw2){like}; ]
[.\node(tn5){VP}; \edge[roof]; \node(tw3){eating fish}; ]
]
]
}
\end{scope}
}
\node [] (output) at ([xshift=3.35in]input.east) {{\scriptsize Cats like eating fish}};
\draw[->,thick] ([xshift=-1pt]input.east) -- ([xshift=8pt]input.east);
\draw[->,thick] ([xshift=-10pt]output.west) -- ([xshift=-0pt]output.west);
{
\draw[->,thick] ([xshift=-12pt]mtengine.west) -- ([xshift=-2pt]mtengine.west);
\draw[->,thick] ([xshift=2pt]mtengine.east) -- ([xshift=12pt]mtengine.east);
}
{
\node[minimum height=4em,minimum width=4.5em] (inputmarking) at (0.85in,-0.39in) {};
\node[minimum height=4em,minimum width=5.2em] (outputmarking) at (2.55in,-0.39in) {};
}
\node [anchor=south] (inputlabel) at ([yshift=-0.5em]input.north) {{\scriptsize \color{red}{\textbf{输入}}}};
\node [anchor=south] (outputlabel) at ([yshift=-0.5em]output.north) {{\scriptsize \color{red}{\textbf{输出}}}};
{
\node [anchor=west] (mtinputlabel) at ([xshift=0.29in]inputlabel.east) {{\scriptsize \color{red}{\textbf{实际的输入}}}};
\node [anchor=west] (mtoutputlabel) at ([xshift=0.86in]mtinputlabel.east) {{\scriptsize \color{red}{\textbf{实际的输出}}}};
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (mtinputlabel) (mtoutputlabel) (inputmarking) (outputmarking)] {};
}
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\vspace{0.5em}
\begin{tikzpicture}
{\footnotesize
\node [ugreen] (input) at (0,0) {猫喜欢吃鱼};
\node [draw,thick,anchor=west,ublue] (preprocessing) at ([xshift=1em]input.east) {分词系统};
\node [ugreen,anchor=west] (mtinput) at ([xshift=1em]preprocessing.east) {猫/喜欢/吃/鱼};
\node [draw,thick,anchor=west,ublue] (smt) at ([xshift=1em]mtinput.east) {SMT系统};
\node [anchor=west] (mtoutput) at ([xshift=1em]smt.east) {...};
\draw [->,thick,ublue] ([xshift=0.1em]input.east) -- ([xshift=-0.2em]preprocessing.west);
\draw [->,thick,ublue] ([xshift=0.2em]preprocessing.east) -- ([xshift=-0.1em]mtinput.west);
\draw [->,thick,ublue] ([xshift=0.1em]mtinput.east) -- ([xshift=-0.2em]smt.west);
\draw [->,thick,ublue] ([xshift=0.2em]smt.east) -- ([xshift=-0.1em]mtoutput.west);
}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\vspace{0.3em}
\begin{tikzpicture}
\begin{scope}[scale=0.8,xshift=0.9in,yshift=-0.87in,level distance=20pt,sibling distance=-1pt,grow'=up]
{\scriptsize
\Tree[.\node(sn0){IP};
[.\node(sn1){NP};
[.\node(sn2){NN}; \node(sw1){}; ]
]
[.\node(sn3){VP};
[.\node(sn4){VV}; \node(sw2){喜欢}; ]
[.\node(sn5){VP}; \edge[roof]; \node(sw3){\ }; ]
]
]
}
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
{
{\small
\node [anchor=north west] (entry1) at (0,0) {\textbf{1:}};
\node [anchor=north west] (entry2) at ([yshift=0.1em]entry1.south west) {\textbf{2:}};
\node [anchor=north west] (entry3) at ([yshift=0.1em]entry2.south west) {\textbf{3:} 现在};
\node [anchor=north west] (entry4) at ([yshift=0.1em]entry3.south west) {\textbf{4:} 物价};
\node [anchor=north west] (entry5) at ([yshift=0.1em]entry4.south west) {\textbf{5:} 确实};
\node [anchor=north west] (entry6) at ([yshift=0.1em]entry5.south west) {\textbf{6:} 实现};
\node [anchor=south west] (dictionarylabel) at (entry1.north west) {{\color{ublue} 分词词典}};
}
}
\begin{pgfonlayer}{background}
{
\node[rectangle,draw=ublue, inner sep=0.2em] [fit = (entry1) (entry2) (entry3) (entry4) (entry5) (entry6) (dictionarylabel)] {};
}
\end{pgfonlayer}
\end{scope}
{
\begin{scope}[xshift=1.2in,yshift=1em]
\node [anchor=west] (c1) at (0,0) {};
\node [anchor=west] (c2) at ([xshift=0em]c1.east) {};
\node [anchor=west] (c3) at ([xshift=0em]c2.east) {};
\node [anchor=west] (c4) at ([xshift=0em]c3.east) {};
\node [anchor=west] (c5) at ([xshift=0em]c4.east) {};
\node [anchor=west] (c6) at ([xshift=0em]c5.east) {};
\node [anchor=west] (c7) at ([xshift=0em]c6.east) {};
\node [anchor=west] (c8) at ([xshift=0em]c7.east) {};
\end{scope}
}
{
\node [anchor=west,thick,draw,minimum width=3.4em,minimum height=1.5em] (w1) at (c3.west){};
\draw [->,thick] (entry3.30) ..controls +(70:1) and +(south:1.5).. ([xshift=0.3em]w1.south) node [pos=0.5, above] {\color{red}{\footnotesize{命中}}};
}
{
\node [anchor=west,very thick,draw,dotted,minimum width=3.4em,minimum height=1.9em,red] (w3) at (c2.west){};
\draw [->,very thick,dotted,red] ([yshift=-0.2em]entry6.30) ..controls +(60:2) and +(south:3).. ([xshift=-0.6em]w3.south) node [pos=0.5, below] {\color{red}{\footnotesize{命中}}};
}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
{\scriptsize
\node [anchor=north west] (entry1) at (0,0) {\textbf{1:} 这 / 是 / 数据};
\node [anchor=north west] (entry2) at ([yshift=0.1em]entry1.south west) {\textbf{2:} 现在 / 已经 / 实现};
\node [anchor=north west] (entry3) at ([yshift=0.1em]entry2.south west) {\textbf{3:} 确实 / 有 / 很 / 多};
\node [anchor=north west] (entry4) at ([yshift=0.1em]entry3.south west) {...};
\node [anchor=south west] (corpuslabel) at (entry1.north west) {{\color{ublue} \textbf{学习用数据}}};
\begin{pgfonlayer}{background}
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow] [fit = (entry1) (entry2) (entry3) (entry4) (corpuslabel)] (corpus) {};
\end{pgfonlayer}
}
\node [anchor=west,ugreen] (P) at ([xshift=4em,yshift=-0.8em]corpus.east){\large{P($\cdot$)}};
\node [anchor=south] (modellabel) at (P.north) {{\color{ublue} {\scriptsize \textbf{统计模型}}}};
\begin{pgfonlayer}{background}
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow] [fit = (P) (modellabel)] (model) {};
\end{pgfonlayer}
\draw [->,very thick,ublue] ([xshift=0.2em]corpus.east) -- ([xshift=3.2em]corpus.east) node [pos=0.5, above] {\color{red}{\scriptsize{统计学习}}};
\draw [->,very thick,ublue] ([xshift=0.2em]model.east) -- ([xshift=3.2em]model.east) node [pos=0.5, above] {\color{red}{\scriptsize{穷举\&计算}}};
{\scriptsize
\node [anchor=north west] (sentlabel) at ([xshift=5.5em,yshift=-1em]model.north east) {\color{red}{自动分词系统}};
\node [anchor=north west] (sent) at (sentlabel.south west) {\textbf{对任意句子进行分词}};
}
\begin{pgfonlayer}{background}
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow] [fit = (sentlabel) (sent)] (segsystem) {};
\end{pgfonlayer}
{\footnotesize
{
\node [anchor=west] (label1) at (0,6em) {实际上,通过学习我们得到了一个分词模型P($\cdot$),给定任意的};
\node [anchor=north west] (label1part2) at ([yshift=0.5em]label1.south west) {分词结果$W=w_1 w_2...w_n$,都能通过P($W$)=$\textrm{P}(w_1) \cdot \textrm{P}(w_2) \cdot ... \cdot \textrm{P}(w_n)$};
\node [anchor=north west] (label1part3) at ([yshift=0.5em]label1part2.south west) {计算这种分词的概率值};
}
\begin{pgfonlayer}{background}
{
\node[rectangle,fill=blue!10,thick,dotted,inner sep=0.2em] [fit = (label1) (label1part2) (label1part3)] (label1content) {};
}
\end{pgfonlayer}
{
\draw [-,thick,red,dotted] ([yshift=0.3em]modellabel.north) ..controls +(north:0.5) and +(south:0.5).. ([xshift=-3em]label1content.south);
}
}
{\footnotesize
{
\node [anchor=west] (label1) at (0,-6.8em) {\textbf{自动分词系统}:对任意的数据句子$S$,找到最佳的分词结果$W^{*}$输出};
}
{
\node [anchor=north west] (label2) at (label1.south west) {假设输入$S$='确实现在数据很多'};
}
{
\node [anchor=north west,draw,thick,inner sep=2pt] (data11) at (label2.south west) {枚举所有可能的切分};
}
{
\node [anchor=west,draw,thick,inner sep=2pt] (data12) at ([xshift=2em]data11.east) {计算每种切分的概率};
}
{
\node [anchor=west,draw,thick,inner sep=2pt] (data13) at ([xshift=3.5em]data12.east) {选择最佳结果};
}
{
\draw [->,thick] ([xshift=0.1em]data11.east) -- ([xshift=-0.1em]data12.west);
}
{
\draw [->,thick] ([xshift=0.1em]data12.east) -- ([xshift=-0.1em]data13.west);
}
{\scriptsize
{
\node [anchor=north west] (data21) at (data11.south west) {确/实现/在/数/据很/多};
}
{
\node [anchor=north west] (data22) at (data12.south west) {$\textrm{P}(\textrm{'确'}) \cdot \textrm{P}(\textrm{'实现'}) \cdot \textrm{P}(\textrm{'在'}) \cdot \textrm{P}(\textrm{'数'}) \cdot $};
}
\node [anchor=north west,minimum height=1.6em] (data23) at (data13.south west) {};
\node [anchor=north west,minimum height=1.6em] (data31) at ([yshift=0.3em]data21.south west) {};
{
\node [anchor=north west] (data32) at ([yshift=0.3em]data22.south west) {$\textrm{P}(\textrm{'据很'}) \cdot \textrm{P}(\textrm{'多'}) = 2.13 \times 10^{-45}$};
}
\node [anchor=north west,minimum height=1.6em] (data33) at ([yshift=0.3em]data23.south west) {};
{
\node [anchor=north west] (data41) at (data31.south west) {确实/现在/数据/很多};
}
{
\node [anchor=north west] (data42) at (data32.south west) {$\textrm{P}(\textrm{'确实'}) \cdot \textrm{P}(\textrm{'现在'}) \cdot \textrm{P}(\textrm{'数据'}) \cdot $};
}
{
\node [anchor=north west] (data43) at ([yshift=-0.2em]data33.south west) {\color{red}{\textbf{输出}}};
\draw [->,red,thick] (data43.west)--([xshift=-1em]data43.west);
}
{
\node [anchor=north west] (data51) at (data41.south west) {...};
}
{
\node [anchor=north west] (data52) at ([yshift=0.3em]data42.south west) {$\textrm{P}(\textrm{'很'}) \cdot \textrm{P}(\textrm{'多'}) = 1.54 \times 10^{-25}$};
}
\node [anchor=north west] (data53) at ([yshift=0.3em]data43.south west) {};
}
}
\begin{pgfonlayer}{background}
{
\node[rectangle,fill=blue!10,thick,dotted,inner sep=0.1em] [fit = (label1) (data11) (data13) (data51) (data52) (data53)] (segcontent) {};
}
\end{pgfonlayer}
{
\draw [-,thick,red,dotted] (segcontent.north) ..controls +(north:0.7) and +(south:0.7).. (segsystem.south);
}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
{
\begin{scope}
\node[anchor=west,draw,very thick,minimum size=25pt] (s1) at (0,0) {{88}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s2) at ([xshift=0.2cm]s1.east) {{87}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s3) at ([xshift=0.2cm]s2.east) {{45}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s4) at ([xshift=0.2cm]s3.east) {{47}};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s5) at ([xshift=0.2cm]s4.east) {{100}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s6) at ([xshift=0.2cm]s5.east) {{15}};
\end{scope}
\begin{scope}[yshift=-1cm]
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s1) at (0,0) {{5}};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s2) at ([xshift=0.2cm]s1.east) {{230}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s3) at ([xshift=0.2cm]s2.east) {{7}};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s4) at ([xshift=0.2cm]s3.east) {{234}};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s5) at ([xshift=0.2cm]s4.east) {{500}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s6) at ([xshift=0.2cm]s5.east) {{39}};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s7) at ([xshift=0.2cm]s6.east) {{100}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s8) at ([xshift=0.2cm]s7.east) {{15}};
\end{scope}
\begin{scope}[yshift=-2cm]
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s1) at (0,0) {{975}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s2) at ([xshift=0.2cm]s1.east) {{7}};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s3) at ([xshift=0.2cm]s2.east) {{234}};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s4) at ([xshift=0.2cm]s3.east) {{294}};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s5) at ([xshift=0.2cm]s4.east) {{15}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s6) at ([xshift=0.2cm]s5.east) {{15}};
\end{scope}
}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
\node[anchor=west,draw,very thick,minimum size=25pt] (s1) at (0,0) {};
\node[anchor=west,draw,very thick,minimum size=25pt] (s2) at ([xshift=0.2cm]s1.east) {};
\node[anchor=west,draw,very thick,minimum size=25pt] (s3) at ([xshift=0.2cm]s2.east) {};
\node[anchor=west,draw,very thick,minimum size=25pt] (s4) at ([xshift=0.2cm]s3.east) {};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s5) at ([xshift=0.2cm]s4.east) {\small{数据}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s6) at ([xshift=0.2cm]s5.east) {};
\node[anchor=west] (s7) at ([xshift=0.2cm]s6.east) {...};
\end{scope}
\begin{scope}[yshift=-1cm]
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s1) at (0,0) {现在};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s2) at ([xshift=0.2cm]s1.east) {已经};
\node[anchor=west,draw,very thick,minimum size=25pt] (s3) at ([xshift=0.2cm]s2.east) {};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s4) at ([xshift=0.2cm]s3.east) {不少};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s5) at ([xshift=0.2cm]s4.east) {\small{}};
\node[anchor=west,draw,very thick,minimum size=25pt] (s6) at ([xshift=0.2cm]s5.east) {};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s7) at ([xshift=0.2cm]s6.east) {数据};
\node[anchor=west,draw,very thick,minimum size=25pt] (s8) at ([xshift=0.2cm]s7.east) {};
\node[anchor=west] (s9) at ([xshift=0.2cm]s8.east) {...};
\end{scope}
\begin{scope}[yshift=-2cm]
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s1) at (0,0) {确实};
\node[anchor=west,draw,very thick,minimum size=25pt] (s2) at ([xshift=0.2cm]s1.east) {};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s3) at ([xshift=0.2cm]s2.east) {};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s4) at ([xshift=0.2cm]s3.east) {};
\node[anchor=west,draw,very thick,minimum size=25pt, inner sep=0] (s5) at ([xshift=0.2cm]s4.east) {疑问};
\node[anchor=west,draw,very thick,minimum size=25pt] (s6) at ([xshift=0.2cm]s5.east) {};
\node[anchor=west] (s7) at ([xshift=0.2cm]s6.east) {...};
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}[yshift=-2.8cm,xshift=-0.5em]
\node [anchor=west] (label1) at (0,0) {总词数:$6 + 8 + 5 = 20$};
\node [anchor=north west] (p1) at (label1.south west) {$\textrm{P}('\textrm{}')=1/20=0.05$};
\node [anchor=north west] (p2) at (p1.south west) {$\textrm{P}('\textrm{}')=3/20=0.15$};
\node [anchor=north west] (p3) at (p2.south west) {$\textrm{P}('\textrm{确实}')=1/20=0.05$};
\end{scope}
\begin{scope}[yshift=-2.8cm,xshift=6cm]
\node [anchor=west] (label1) at (0,0) {更多数据-总词数:100K $\sim$ 1M};
\node [anchor=north west] (p1) at (label1.south west) {$\textrm{P}('\textrm{}')=0.000010$};
\node [anchor=north west] (p2) at (p1.south west) {$\textrm{P}('\textrm{}')=0.001812$};
\node [anchor=north west] (p3) at (p2.south west) {$\textrm{P}('\textrm{确实}')=0.000001$};
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}[scale=0.6]
\begin{scope}
{\footnotesize
\foreach \i in {1,...,5}{
\node [draw,thick,minimum size=10pt] at (\i,0) {1};
}
}
\node [anchor=west] at (31em,0) {$\textrm{P}("1") = 5/30$};
\end{scope}
\begin{scope}[yshift=-2.5em]
{\footnotesize
\foreach \i in {1,...,4}{
\node [draw,thick,minimum size=10pt] at (\i,0) {{\color{red} 2}};
}
}
\node [anchor=west] at (31em,0) {$\textrm{P}("2") = 4/30$};
\end{scope}
\begin{scope}[yshift=-5.0em]
{\footnotesize
\foreach \i in {1,...,6}{
\node [draw,thick,minimum size=10pt] at (\i,0) {{\color{ublue} 3}};
}
}
\node [anchor=west] at (31em,0) {$\textrm{P}("3") = 6/30$};
\end{scope}
\begin{scope}[yshift=-7.5em]
{\footnotesize
\foreach \i in {1,...,12}{
\node [draw,thick,minimum size=10pt] at (\i,0) {{\color{ugreen} 4}};
}
}
\node [anchor=west] at (31em,0) {$\textrm{P}("4") = 12/30$};
\end{scope}
\begin{scope}[yshift=-10.0em]
{\footnotesize
\foreach \i in {1,...,2}{
\node [draw,thick,minimum size=10pt] at (\i,0) {{\color{purple} 5}};
}
}
\node [anchor=west] at (31em,0) {$\textrm{P}("5") = 2/30$};
\end{scope}
\begin{scope}[yshift=-12.5em]
{\footnotesize
\foreach \i in {1,...,1}{
\node [draw,thick,minimum size=10pt] at (\i,0) {{\color{orange} 6}};
}
}
\node [anchor=west] at (31em,0) {$\textrm{P}("6") = 1/30$};
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
{
\begin{scope}
\node[anchor=west,draw,very thick,minimum size=20pt] (s1) at (0,0) {\Large{\textbf{2}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s2) at ([xshift=0.2cm]s1.east) {\Large{\textbf{3}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s3) at ([xshift=0.2cm]s2.east) {\Large{{\color{red}{1}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s4) at ([xshift=0.2cm]s3.east) {\Large{\textbf{4}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s5) at ([xshift=0.2cm]s4.east) {\Large{\textbf{4}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s6) at ([xshift=0.2cm]s5.east) {\Large{{\color{red}{1}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s7) at ([xshift=0.2cm]s6.east) {\Large{\textbf{5}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s8) at ([xshift=0.2cm]s7.east) {\Large{{\color{red}{1}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s9) at ([xshift=0.2cm]s8.east) {\Large{\textbf{4}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s10) at ([xshift=0.2cm]s9.east) {\Large{\textbf{4}}};
\end{scope}
\begin{scope}[yshift=-1cm]
\node[anchor=west,draw,very thick,minimum size=20pt] (s1) at (0,0) {\Large{\textbf{5}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s2) at ([xshift=0.2cm]s1.east) {\Large{\textbf{6}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s3) at ([xshift=0.2cm]s2.east) {\Large{\textbf{4}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s4) at ([xshift=0.2cm]s3.east) {\Large{\textbf{4}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s5) at ([xshift=0.2cm]s4.east) {\Large{\textbf{3}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s6) at ([xshift=0.2cm]s5.east) {\Large{\textbf{2}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s7) at ([xshift=0.2cm]s6.east) {\Large{{\color{red}{1}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s8) at ([xshift=0.2cm]s7.east) {\Large{\textbf{4}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s9) at ([xshift=0.2cm]s8.east) {\Large{\textbf{5}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s10) at ([xshift=0.2cm]s9.east) {\Large{{\color{red}{1}}}};
\end{scope}
\begin{scope}[yshift=-2cm]
\node[anchor=west,draw,very thick,minimum size=20pt] (s1) at (0,0) {\Large{\textbf{4}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s2) at ([xshift=0.2cm]s1.east) {\Large{\textbf{2}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s3) at ([xshift=0.2cm]s2.east) {\Large{\textbf{2}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s4) at ([xshift=0.2cm]s3.east) {\Large{\textbf{3}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s5) at ([xshift=0.2cm]s4.east) {\Large{\textbf{4}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s6) at ([xshift=0.2cm]s5.east) {\Large{{\color{red}{1}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s7) at ([xshift=0.2cm]s6.east) {\Large{\textbf{5}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s8) at ([xshift=0.2cm]s7.east) {\Large{{\color{red}{1}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s9) at ([xshift=0.2cm]s8.east) {\Large{\textbf{3}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s10) at ([xshift=0.2cm]s9.east) {\Large{\textbf{4}}};
\end{scope}
}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\vspace{0.3em}
\begin{tikzpicture}
\begin{scope}
\node[anchor=west,draw,very thick,minimum size=20pt] (s1) at (0,0) {\Large{\textbf{{\color{ublue} 3}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s2) at ([xshift=0.2cm]s1.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s3) at ([xshift=0.2cm]s2.east) {\Large{\textbf{{\color{red} 2}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s4) at ([xshift=0.2cm]s3.east) {\Large{\textbf{{\color{ublue} 3}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s5) at ([xshift=0.2cm]s4.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s6) at ([xshift=0.2cm]s5.east) {\Large{\textbf{{\color{purple} 5}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s7) at ([xshift=0.2cm]s6.east) {\Large{\textbf{1}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s8) at ([xshift=0.2cm]s7.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s9) at ([xshift=0.2cm]s8.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s10) at ([xshift=0.2cm]s9.east) {\Large{\textbf{{\color{ublue} 3}}}};
\end{scope}
\begin{scope}[yshift=-1cm]
\node[anchor=west,draw,very thick,minimum size=20pt] (s1) at (0,0) {\Large{\textbf{{\color{red} 2}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s2) at ([xshift=0.2cm]s1.east) {\Large{\textbf{1}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s3) at ([xshift=0.2cm]s2.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s4) at ([xshift=0.2cm]s3.east) {\Large{\textbf{{\color{purple} 5}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s5) at ([xshift=0.2cm]s4.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s6) at ([xshift=0.2cm]s5.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s7) at ([xshift=0.2cm]s6.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s8) at ([xshift=0.2cm]s7.east) {\Large{\textbf{{\color{ublue} 3}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s9) at ([xshift=0.2cm]s8.east) {\Large{\textbf{1}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s10) at ([xshift=0.2cm]s9.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\end{scope}
\begin{scope}[yshift=-2cm]
\node[anchor=west,draw,very thick,minimum size=20pt] (s1) at (0,0) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s2) at ([xshift=0.2cm]s1.east) {\Large{\textbf{{\color{ublue} 3}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s3) at ([xshift=0.2cm]s2.east) {\Large{\textbf{{\color{red} 2}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s4) at ([xshift=0.2cm]s3.east) {\Large{\textbf{{\color{orange} 6}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s5) at ([xshift=0.2cm]s4.east) {\Large{\textbf{1}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s6) at ([xshift=0.2cm]s5.east) {\Large{\textbf{{\color{red} 2}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s7) at ([xshift=0.2cm]s6.east) {\Large{\textbf{{\color{ublue} 3}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s8) at ([xshift=0.2cm]s7.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s9) at ([xshift=0.2cm]s8.east) {\Large{\textbf{{\color{ugreen} 4}}}};
\node[anchor=west,draw,very thick,minimum size=20pt] (s10) at ([xshift=0.2cm]s9.east) {\Large{\textbf{1}}};
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
\def\CTeXPreproc{Created by ctex v0.2.13, don't edit!}
\documentclass[cjk,t,compress,12pt]{standalone}
%\documentclass{article}
%\usepackage{beamerarticle}
\usepackage{pstricks}
\usepackage{etex}
\usepackage{eso-pic,graphicx}
\usepackage{fancybox}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{CJK}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{hyperref}
\usetikzlibrary{arrows,decorations.pathreplacing}
\usetikzlibrary{shadows} % LATEX and plain TEX when using Tik Z
\usepgflibrary{arrows} % LATEX and plain TEX and pure pgf
\usetikzlibrary{arrows} % LATEX and plain TEX when using Tik Z
\usetikzlibrary{decorations}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning,fit,calc}
\usetikzlibrary{mindmap,backgrounds} % mind map
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\begin{document}
\begin{CJK}{UTF8}{you}
%%% outline
%-------------------------------------------------------------------------
\vspace{-0.5em}
\begin{tikzpicture}
{\scriptsize
{
\node [anchor=north west] (entry1) at (0,0) {\textbf{1:} 这 / 是 / 数据};
\node [anchor=north west] (entry2) at ([yshift=0.1em]entry1.south west) {\textbf{2:} 现在 / 已经 / 实现};
\node [anchor=north west] (entry3) at ([yshift=0.1em]entry2.south west) {\textbf{3:} 确实 / 有 / 很 / 多};
\node [anchor=north west] (entry4) at ([yshift=0.1em]entry3.south west) {...};
\node [anchor=south west] (corpuslabel) at (entry1.north west) {{\color{ublue} \textbf{学习用数据}}};
}
\begin{pgfonlayer}{background}
{
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow] [fit = (entry1) (entry2) (entry3) (entry4) (corpuslabel)] (corpus) {};
}
\end{pgfonlayer}
}
{
\node [anchor=west,ugreen] (P) at ([xshift=4em,yshift=-0.8em]corpus.east){\large{P($\cdot$)}};
\node [anchor=south] (modellabel) at (P.north) {{\color{ublue} {\scriptsize \textbf{统计模型}}}};
}
\begin{pgfonlayer}{background}
{
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow] [fit = (P) (modellabel)] (model) {};
}
\end{pgfonlayer}
{
\draw [->,very thick,ublue] ([xshift=0.2em]corpus.east) -- ([xshift=3.2em]corpus.east) node [pos=0.5, above] {\color{red}{\scriptsize{统计学习}}};
}
{
\draw [->,very thick,ublue] ([xshift=0.2em]model.east) -- ([xshift=3.2em]model.east) node [pos=0.5, above] {\color{red}{\scriptsize{穷举\&计算}}};
}
{\scriptsize
{
\node [anchor=north west] (sentlabel) at ([xshift=5.5em,yshift=2em]model.north east) {\color{red}{新的句子}};
\node [anchor=north west] (sent) at (sentlabel.south west) {\textbf{确实现在数据很多}};
}
{
\node [anchor=north west] (seg1) at ([xshift=0em]sent.south west) {确/实现/在/数/据很/多};
\node [anchor=north west] (seg2) at (seg1.south west) {确实/现在/数据/很/多};
\node [anchor=north west] (seg3) at (seg2.south west) {确实/现在/数/据/很/多};
}
{
\node [anchor=north west] (seg4) at ([yshift=0.5em]seg3.south west) {...};
\node [anchor=east,ugreen] (p1seg1) at ([xshift=0.5em]seg1.west) {P(};
\node [anchor=west,ugreen] (p2seg1) at ([xshift=-0.5em]seg1.east) {)=.1};
\node [anchor=east,ugreen] (p1seg2) at ([xshift=0.5em]seg2.west) {P(};
\node [anchor=west,ugreen] (p2seg2) at ([xshift=-0.5em]seg2.east) {)=.6};
\node [anchor=east,ugreen] (p1seg3) at ([xshift=0.5em]seg3.west) {P(};
\node [anchor=west,ugreen] (p2seg3) at ([xshift=-0.5em]seg3.east) {)=.2};
}
{
\node [anchor=east,draw,dashed,red,thick,minimum width=13em,minimum height=1.5em] (final) at (p2seg2.east) {};
\node [anchor=west,red] (finallabel) at ([xshift=2em]sentlabel.east) {输出概率最大};
\node [anchor=north east,red] (finallabel2) at ([yshift=0.5em]finallabel.south east) {的结果};
\draw [->,thick,red] ([xshift=-1.5em]final.north east) ..controls +(north:0.5) and +(south:0.5).. (finallabel2.south);
}
}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{CJK}
\end{document}
%----------------------------------------------------------------------------------------
% CHAPTER 2
%----------------------------------------------------------------------------------------
\renewcommand\figurename{}%将figure改为图
\renewcommand\tablename{}%将figure改为图
\chapterimage{chapter_head_1.pdf} % Chapter heading image
\chapter{词法、语法及统计思想基础}
\parinterval 机器翻译并非是一个孤立的系统,它依赖于很多模块,并且需要很多学科知识的融合。现在的机器翻译系统大多使用统计模型对翻译问题进行建模,同时也会用到一些的自然语言处理工具对不同语言的文字进行分析。因此,在正式开始机器翻译内容的介绍之前,本章将会对相关的基础知识进行概述,包括:概率论与统计建模基础、语言分析、语言建模等。
\parinterval 概率论与统计建模是当代机器翻译模型的基础,这里并不会深入介绍相关数学知识,但是会对基本的数学概念进行简要描述,确保后续使用到数学工具是完备的。我们会把重点放在如何利用统计建模的方式对自然语言处理问题进行描述的方法上,这种手段在统计机器翻译和神经机器翻译中会被使用。
\parinterval 语言分析部分将以汉语为例介绍词法和句法分析。它们都是自然语言处理中的基本问题,而且在机器翻译中也会经常被使用。同样,我们会介绍这两个任务的定义和解决问题的思路。
\parinterval 语言建模是机器翻译中最常用的一种技术,它主要用于句子的生成和流畅度评价。我们会以传统的$n$-gram语言模型为例,对语言建模的相关概念进行介绍。但是,这里并不深入探讨语言模型技术,在后面的章节中还有会单独的内容对神经网络语言模型等前沿技术进行讨论。
%--问题概述-----------------------------------------
\section{问题概述 }\index{Chapter2.1}
\parinterval 很多时候机器翻译系统被看作是孤立的“黑盒”系统(图 \ref {figureC2.1} (a))。我们将一段文本作为输入送入机器翻译系统得到翻译好的译文输出。但是真实的机器翻译系统要复杂的多。因为系统看到的输入和输出的实际上只是一些符号串,这些符号并没有任何其它意义,因此需要进一步对这些符号串进行处理才能使机器翻译系统更好的使用它们,比如,需要定义翻译中最基本的单元是什么?符号串是否还有结构信息?如何用数学工具刻画这些基本单元和结构?
%----------------------------------------------
% 图2.1
\begin{figure}[htp]
\centering
\subfigure[机器翻译系统被看作一个黑盒] {\includegraphics[scale=1]{./Chapter2/Figures/figure-MT-system-as-a-black-box.pdf} }
\subfigure[机器翻系统 = 语言分析 + 翻译引擎] {\includegraphics[scale=1]{./Chapter2/Figures/figure-MT=language-analysis+translation-engine.pdf}}
\caption{机器翻译系统的结构对比}
\label{figureC2.1}
\end{figure}
%-------------------------------------------
\parinterval\ref{figureC2.1} (b)展示了一个机器翻译系统处理输入输出的例子。可以看到,输入的中文字串“猫喜欢吃鱼”被加工成一个新的结构
%----------------------------------------------
% 图2.2
\begin{figure}[htp]
\centering
\includegraphics[scale=1,width=3cm]{./Chapter2/Figures/figure-analysis-of-sentence-participle&syntactic.pdf}
\caption{中文句子“猫喜欢吃鱼”的分析结果(分词和句法分析)}
\label{figureC2.2}
\end{figure}
%-------------------------------------------
\parinterval 直觉上,这个结构有些奇怪,因为上面多了很多新的符号,而且还有一些线将不同符号进行连接。实际上这就是语言分析中对句子常用的结构表示 – 短语结构树。从原始的词串转化为图\ref {figureC2.2} 的样子,有两个步骤:
\vspace{0.5em}
\begin{itemize}
\item 分词。这个过程会把词串进行切分,切割成最小的单元。因为只有知道了什么是待处理字符串的最小单元,机器翻译系统才能对其进行表示、分析和生成。
\vspace{0.5em}
\item 句法分析。这个过程会对经过切分的句子进行进一步分析,得到句子的句法结构,这种结构是对句子的进一步抽象。比如,NP VP就可以表示名词短语(NP)和动词短语(VP)这种主谓结构。利用这些信息,机器翻译可以更加准确的对语言的结构进行分析和生成。
\end{itemize}
\vspace{0.5em}
\parinterval 类似的,机器翻译输出的结果也可以包含同样的信息。甚至系统输出英文译文之后,还有一个额外的步骤来把部分英文单词的大小写恢复出来,比如,上例中句首单词Cats的首字母要大写。
\parinterval 一般来说,在送入机器翻译系统前需要对文字序列进行处理和加工的过程被称为预处理。同理,在机器翻译模型输出译文后的处理作被称作后处理。这两个过程对机器翻译性能影响很大,比如,在神经机器翻译里,预处理使用不同策略的切分可能会造成翻译性能的天差地别。
\parinterval 值得注意的是,不论是分词还是句法分析,对于机器翻译来说并不是必须要求符合人的认知和语言学约束。换句话说,机器翻译所使用的“单词”和“结构”本身并不是为了符合人类的解释,它直接目的是更好的进行翻译。从系统的角度,有时候即使一些处理和我们的语言习惯有差别的“单词”和“结构”,仍然会带来性能的提升,比如在神经机器翻译中,在传统分词的基础上进一步使用双字节编码(Byte Pair Encoding,BPE)子词切分会使得机器翻译性能大幅提高。当然,自然语言处理中语言学信息的使用一直是学界关注的焦点。甚至关于语言学结构对机器翻译是否有作用这个问题也有争论。但是不能否认的是,无论是语言学的知识,还是计算机自己学习到的知识,对机器翻译都是有价值的。在后续章节会看到,这两种类型的知识对机器翻译帮助很大 \footnote[1]{笔者并不认同语言学结构对机器翻译的帮助有限,相反机器翻译需要更多的人类先验知识的指导。当然,这个问题不是这里讨论的重点。}
\parinterval 剩下的问题是如何进行句子的切分和结构的分析。思路有很多,一种常用的方法是对问题进行概率化,用统计模型来描述问题并求解。比如,一个句子切分的好坏,并不是非零即一的判断,而是要估计出这种切分的可能性大小,最终选择可能性最大的结果进行输出。这也是一种典型的用统计建模的方式来描述自然语言处理问题。
\parinterval 本章将会对上述问题及方法进行介绍。首先,会用一个例子给出统计建模的基本思路,之后会应用这种方法进行中文分词、语言建模和句法分析。这种统计建模的思想也会在后续章节中使用。
%--数学符号-----------------------------------------
\section{数学符号}\index{Chapter2.2}
\parinterval 为了便于后续内容的介绍,首先对本书中使用的概率和统计学概念和符号与定理进行说明。
%--随机变量和概率---------------------
\subsection{随机变量和概率}\index{Chapter2.2.1}
\parinterval 在自然界中,有这样一类具有偶然性的事件,它在一定条件下是否会发生是不确定的。例如,明天会下雨、掷一枚硬币是正面朝上、扔一个骰子的点数是5……这类可能会发生也可能不会发生,通过大量的重复试验,能发现其发生具有某种规律性的事件叫做随机事件。
\parinterval 随机变量是对随机事件发生可能状态的描述,是随机事件的数量表征。设$\Omega= \{ \omega \}$为一个随机试验的样本空间,X=X$(\omega)$就是定义在样本空间$\omega$上的、取值为实数的单值函数,即X=X$(\omega)$为随机变量,记为X。随机变量是一种能随机选取数值的变量,常用大写的英文字母或希腊字母表示,其取值通常用小写字母来表示。例如,用$A$表示一个随机变量,用$a$表示变量$A$的一个取值。根据随机变量可以选取的值,可以将其划分为离散变量和连续变量。
\parinterval 离散变量是指在其取值区间内可以被一一列举,总数有限并且可计算的数值变量。例如,用随机变量$X$代表某次投骰子出现的点数,点数只可能取1$\sim$6这6个整数,$X$是一个离散变量。
\parinterval 连续变量是在其取值区间内连续取值,无法被一一列举,具有无限个取值的变量。例如,图书馆的开馆时间是8:30-22:00,用$X$代表某人进入图书馆的时间,时间的取值范围是[8:30,22:00]这个时间区间,$X$是一个连续变量。
\parinterval 概率是度量随机事件呈现其每个可能状态的可能性的数值,概率的大小表征了随机事件在一次试验中发生的可能性大小。用$\textrm{P}(\cdot )$表示一个随机事件的可能性,即事件发生的概率。比如$\textrm{P}(\textrm{太阳从东方升起})$表示“太阳从东方升起的可能性”,同理,$\textrm{P}(A=B)$表示的就是“$A=B$”这件事的可能性。
\parinterval 在概率学中,一个很简单的获取概率的方式是利用相对频度作为概率的估计值。如果$\{x_1,x_2,\dots,x_n \}$是一个试验的样本空间,在相同情况下重复试验N次,观察到样本$x_i (1\leq{i}\leq{n})$的次数为$n_N (x_i )$,那么$x_i$在这N次试验中的相对频率是$\frac{n_N (x_i )}{N}$。当N越来越大时,相对概率也就越来越接近真实概率$\textrm{P}(x_i)$,即$\lim_{N \to \infty}\frac{n_N (x_i )}{N}=\textrm{P}(x_i)$
\parinterval 概率函数是用函数形式给出离散变量每个取值发生的概率,其实就是将变量的概率分布转化为数学表达形式。如果我们把$A$看做一个离散变量,$a$看做变量$A$的一个取值,那么$\textrm{P}(A)$被称作变量$A$的概率函数,$\textrm{P}(A=a)$被称作$A = a$的概率值,简记为$\textrm{P}(a)$。下表为离散变量$A$的概率分布,给出了$A$的所有取值及其概率。
%表1--------------------------------------------------------------------
\begin{table}[htp]
\centering
\caption{离散变量A的概率分布}
\begin{tabular}{c|c c c c c}
\hline
A & $a_1$ & $a_2$ & ... & $a_n$ & ...\\
\hline
$P_i$ & $P_1$ & $P_2$ & ... & $P_n$ & ... \\
\hline
\end{tabular}
\label{tab1}
\end{table}
%表1--------------------------------------------------------------------
\parinterval 除此之外,概率函数$\textrm{P(·)}$还具有非负性、归一性等特点,非负性是指,所有的概率函数$\textrm{P(·)}$都必须是大于等于0的数值,概率函数中不可能出现负数:$\forall{x},\textrm{P}{(x)}\geq{0}$。归一性,又称规范性,简单的说就是所有可能发生的事件的概率总和为一,$\sum_{x}\textrm{P}{(x)}={1}$
\parinterval 对于离散变量$A$$\textrm{P}(A=a)$是个确定的值,可以表示事件$A=a$的可能性大小;而对于连续变量,求在某个定点处的概率是无意义的,只能求其落在某个取值区间内的概率。因此,用概率分布函数$\textrm{F}(x)$和概率密度函数$\textrm{f}(x)$来统一描述随机变量的取值分布情况。概率分布函数$\textrm{F}(x)$取值小于某个值的概率,是概率的累加形式。假设$A$是一个随机变量,$a$是任意实数,将函数$\textrm{F}(a)=\textrm{P}\{A\leq a\}$$-\infty<a<\infty $定义为$A$的分布函数。通过分布函数,我们可以清晰地表示任何随机变量的概率。
\parinterval 对于连续变量,我们不能像离散变量一样列出所有的概率取值,而是用概率密度函数来描述分布情况。概率密度函数反映了变量在某个区间内的概率变化快慢,概率密度函数的值是概率的变化率,该连续变量的概率也就是对概率密度函数求积分得到的结果。设$\textrm{f}(x) \geq 0$是连续变量$X$的概率密度函数,$X$的分布函数就可以用$\textrm{F}(X)=\int_{-\infty}^x \textrm{f}(x)dx \ (x\in R)$来表示。
%----------------------------------------------
% 图2.3
\begin{figure}[htp]
\centering
\subfigure { \includegraphics[scale=1,height=4.5cm]{ ./Chapter2/Figures/figure-Probability-density-function.jpg} }
\subfigure {\includegraphics[scale=1,height=4.5cm]{./Chapter2/Figures/figure-Distribution-function.jpg}}
\caption{一个概率密度函数(左)与其对应的分布函数(右)}
\label{figureC2.3}
\end{figure}
%-------------------------------------------
\subsection{联合概率、条件概率和边缘概率}\index{Chapter2.2.2}
\parinterval 联合概率是指多个事件同时发生,每个随机变量满足各自条件的概率,表示为$\textrm{P}(AB)$
\parinterval 条件概率是指$A$$B$为任意的两个事件,在事件$A$已出现的前提下,事件$B$出现的概率,使用$\textrm{P}(B \mid A)$表示。通常来说,$\textrm{P}(B \mid A) \neq \textrm{P}(B)$
\parinterval 贝叶斯法则是条件概率计算时的重要依据,条件概率可以表示为
%----------------------------------------------
\begin{equation}
\textrm{P}{(B|A)} = \frac{\textrm{P}(A\cap{B})}{\textrm{P}(A)} = \frac{\textrm{P}(A)\textrm{P}(B|A)}{\textrm{P}(A)} = \frac{\textrm{P}(B)\textrm{P}(A|B)}{\textrm{P}(A)}
\label{eqC2.1}
\end{equation}
%----------------------------------------------
\parinterval 边缘概率是和联合概率对应的,它指的是$\textrm{P}(X=a)$$\textrm{P}(Y=b)$,即仅与单个随机变量有关的概率称为边缘概率。
\parinterval 对于离散随机变量$X$$Y$,我们知道$\textrm{P}(X,Y)$,则边缘概率$\textrm{P}(X)$可以通过求和的方式得到,如下式所示
%----------------------------------------------
\begin{equation}
\forall x \in X ,\textrm{P}(X=x)=\sum_{y} \textrm{P}(X=x,Y=y)
\label{eqC2.2}
\end{equation}
%----------------------------------------------
\parinterval 对于连续变量,边缘概率$\textrm{P}(X)$需要通过积分得到,如下式所示
%----------------------------------------------
\begin{equation}
\textrm{P}(X)=\int \textrm{P}(x,y)dy
\label{eqC2.3}
\end{equation}
%----------------------------------------------
\parinterval 为了更好的区分条件概率、边缘概率和联合概率,我们将通过图\ref{figureC2.4}所示的面积来举例说明。
%----------------------------------------------
% 图2.4
\begin{figure}[htp]
\centering
\includegraphics[scale=1,height=2cm]{ ./Chapter2/Figures/figure-schematic-edge-probability&joint-probability.png}
\caption{一个概率密度函数与其对应的分布函数}
\label{figureC2.4}
\end{figure}
%-------------------------------------------
\parinterval 如图\ref{figureC2.4}所示,矩形A代表事件X发生所对应的所有可能状态,矩形B代表事件Y发生所对应的所有可能状态,矩形C代表A和B的交集,则
\parinterval 边缘概率:矩形A或者矩形B的面积;
\parinterval 联合概率:矩形C的面积;
\parinterval 条件概率:联合概率/对应的边缘概率,如:$\textrm{P}(A \mid B)$=矩形C的面积/矩形B的面积。
\subsection{链式法则}\index{Chapter2.2.3}
\parinterval 由条件概率公式$\textrm{P}(a \mid b)=\textrm{P}(ab)/\textrm{P}(b)$,我们知道条件概率的定义$\textrm{P}(a \mid b)$,其描述的是两个事件$a$$b$,在$b$事件发生的条件下,$a$发生的概率。如果我们将其推广到三个事件$a$$b$$c$,为了计算$\textrm{P}(a,b,c)$我们可以运用两次$\textrm{P}(a \mid b)=\textrm{P}(ab)/\textrm{P}(b)$,计算过程如下:
%----------------------------------------------
\begin{equation}
\textrm{P}(a,b,c)=\textrm{P}(a \mid b ,c)\textrm{P}(b,c)
\label{eqC2.4}
\end{equation}
\begin{equation}
\textrm{P}(b,c)=\textrm{P}(b \mid c)\textrm{P}(c)
\label{eqC2.5}
\end{equation}
\begin{equation}
\textrm{P}(a,b,c)=\textrm{P}(a \mid b,c)\textrm{P}(b \mid c)\textrm{P}(c)
\label{eqC2.6}
\end{equation}
%----------------------------------------------
\parinterval 推广到$n$个事件,我们得到了链式法则的公式
%----------------------------------------------
\begin{equation}
\textrm{P}(x_1,x_2,...,x_n)=\textrm{P}(x_1) \prod_{i=2}^n \textrm{P}(x_i \mid x_1,x_2,...,x_{(i-1)})
\label{eqC2.7}
\end{equation}
%----------------------------------------------
\parinterval 我们可以通过下面这个例子更好的理解链式法则,如图所示,$A$$B$$C$$D$$E$分别代表五个事件,其中,$A$只和$B$有关,$C$只和$B$$D$有关,$E$只和$C$有关,$B$$D$不依赖其他任何事件。则$\textrm{P}(A,B,C,D,E)$的表达式如下式:
%----------------------------------------------
% 图2.5
\begin{figure}[htp]
\centering
\includegraphics[scale=1,height=2.5cm]{ ./Chapter2/Figures/figure-schematic-chain-rule.png}
\setlength{\belowcaptionskip}{-1cm}
\caption{A,B,C,D,E关系图}
\label{figureC2.5}
\end{figure}
%-------------------------------------------
\begin{equation}
\begin{split}
\textrm{P}(A,B,C,D,E)&=\textrm{P}(E \mid A,B,C,D) \cdot \textrm{P}(A,B,C,D) \\
&=\textrm{P}(E \mid A,B,C,D) \cdot \textrm{P}(D \mid A,B,C) \cdot \textrm{P}(A,B,C) \\
&=\textrm{P}(E \mid A,B,C,D) \cdot \textrm{P}(D \mid A,B,C) \cdot \textrm{P}(C \mid A,B) \cdot \textrm{P}(A,B) \\
&=\textrm{P}(E \mid A,B,C,D) \cdot \textrm{P}(D \mid A,B,C) \cdot \textrm{P}(C \mid A,B) \cdot \textrm{P}(B \mid A) \cdot \textrm{P}(A)
\label{eqC2.8}
\end{split}
\end{equation}
\parinterval 根据图\ref {figureC2.5} 易知$E$只和$C$有关,所以$\textrm{P}(E \mid A,B,C,D)=\textrm{P}(E \mid C)$$D$不依赖于其他事件,所以$\textrm{P}(D \mid A,B,C)=\textrm{P}(D)$$C$只和$BD$有关,所以$\textrm{P}(C \mid A,B)=\textrm{P}(C \mid B)$$B$不依赖于其他事件,所以$\textrm{P}(B \mid A)=\textrm{P}(B)$。最终化简可得:
\begin{equation}
\textrm{P}(A,B,C,D,E)=\textrm{P}(E \mid C) \cdot \textrm{P}(D) \cdot \textrm{P}(C \mid B) \cdot \textrm{P}(B)
\label{eqC2.9}
\end{equation}
\parinterval 此可以看出使用链式法则可以大大减小求解概率表达式时的计算量。
\subsection{贝叶斯法则(Bayes’Rule)}\index{Chapter2.2.4}
\parinterval 首先介绍一下全概率公式:全概率公式(Law of total probability)是概率论中重要的公式,它可以将一个复杂事件发生的概率分解成不同情况的小事件发生概率的和。这里我们先介绍一个概念——划分。
\parinterval 若集合S的一个划分事件为$B_1,…,B_n$是指它们满足
\begin{equation}
\bigcup_{i=1}^n B_i=S \textrm{}B_iB_j=\varnothing , i,j=1,...,n,i\neq j
\label{eqC2.9}
\end{equation}
\parinterval$B_1,…,B_n$是S的一个划分,A为事件,则
\begin{equation}
\textrm{P}(A)=\sum_{k=1}^n \textrm{P}(A \mid B_k)\textrm{P}(B_k)
\label{eqC2.9}
\end{equation}
\parinterval 这就是全概率公式。
\parinterval 贝叶斯法则(Bayes’ rule)是概率论中的一个定理,通常用于知$\textrm{P}(A \mid B)$$\textrm{P}(B \mid A)$。其内容如下:
\parinterval$B_1,…,B_n$是S的一个划分,A为事件,则对于$i=1,…,n$,有如下公式
\begin{equation}
\textrm{P}(B_i \mid A)=\frac {\textrm{P}(A \mid B_i)\textrm{P}(B_i) } { \sum_{k=1}^n\textrm{P}(A \mid B_k)\textrm{P}(B_k) }
\label{eqC2.9}
\end{equation}
\parinterval 下面我们来看看贝叶斯公式的推导。由前面的知识,我们知道条件概率的公式为
\begin{equation}
\textrm{P}(B \mid A)= \frac {\textrm{P}(AB)} {\textrm{P}(A)}
\label{eqC2.9}
\end{equation}
\parinterval 由乘法定理我们可以得到
\begin{equation}
\textrm{P}(AB)=\textrm{P}(B)\textrm{P}(A \mid B)
\label{eqC2.9}
\end{equation}
\parinterval$B_1,…,B_n$是S的一个划分,A为事件,由全概率公式我们可以得到
\begin{equation}
\textrm{P}(A)=\textrm{P}(A \mid B_1)\textrm{P}(B_1)+\textrm{P}(A \mid B_2)\textrm{P}(B_2)+\ldots +\textrm{P}(A \mid B_n)\textrm{P}(B_n)
\label{eqC2.9}
\end{equation}
\parinterval 将乘法定理带入条件概率的分子,将全概率公式带入条件概率的分母,我们就可以得到贝叶斯定理
\begin{equation}
\textrm{P}(B_i \mid A)=\frac {\textrm{P}(A \mid B_i)\textrm{P}(B_i) } {\sum_{k=1}^n \textrm{P}(A\mid B_k)\textrm{P}(B_k)}
\label{eqC2.9}
\end{equation}
\parinterval 由上式,我们也可以得到贝叶斯公式的另外两种写法
\begin{equation}
\textrm{P}(A \mid B)=\frac { \textrm{P}(A \mid B)\textrm{P}(B) } {\textrm{P}(A)}
\label{eqC2.9}
\end{equation}
\begin{equation}
\textrm{P}(A \mid B)=\frac { \textrm{P}(A \mid B)\textrm{P}(B) } {\textrm{P}(A \mid B)\textrm{P}(B)+\textrm{P}(A \mid \bar{B}) \textrm{P}(\bar{B})}
\label{eqC2.9}
\end{equation}
\parinterval 贝叶斯公式常用于根据已知的结果来推断使之发生的各因素的可能性。
\subsection{KL距离和熵}\index{Chapter2.2.5}
\subsubsection{信息熵}\index{Chapter2.2.5.1}
\parinterval 熵是热力学中的一个概念,同时也是对系统无序性的一种度量标准,在机器翻译领域,最常用到的是信息熵这一概念。一条信息的信息量大小与它的不确定性有着直接的关系,如果我们需要确认一件非常不确定甚至于一无所知的事情,那么需要理解大量的相关信息才能确认清楚;同样的,如果我们对某件事已经非常确定,那么就不需要太多的信息就可以把它搞清楚。
\begin{example}
确定性的事件
\qquad\qquad\quad“太阳从东方升起”
\qquad\qquad\quad“明天天气多云”
\label{example3-1}
\end{example}
\parinterval 在这两句话中,“太阳从东方升起”是一件确定性事件,几乎不需要查阅更多信息就可以确认,因此这件事的信息熵相对较低;而“明天天气多云”这件事,我们需要询问气象局的相关研究人员,或者关注天气预报,才能大概率确定的一件事,它的不确定性很高,因而它的信息熵也就相对较高。因此,信息熵也是对事件不确定性的度量。
\parinterval 一个事件X的自信息(self-information)的表达式为:
\begin{equation}
\textrm{I}(x)=-log\textrm{P}(x)
\label{eqC2.9}
\end{equation}
\parinterval 其中,$\textrm{P}(x)$表示概率,自信息用来衡量单一事件发生时所包含的信息多少,当底数为e时,单位为$nats$,其中1$nats$是通过观察概率为$\frac{1}{e}$的事件而获得的信息量;当底数为2时,单位为$bits$$shannons$,我们通常使用前者。$\textrm{I}(x)$$\textrm{P}(x)$的函数关系如图\ref{figureC2.6} 所示:
%----------------------------------------------
% 图2.5
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{ ./Chapter2/Figures/figure-Self-information-function.jpg}
\caption{自信息函数图像}
\label{figureC2.6}
\end{figure}
%-------------------------------------------
\parinterval 自信息只处理单一的结果。若量化整个概率分布中的不确定性或者说信息量,我们可以用信息熵,其公式如下:
\begin{equation}
\textrm{H}(x)=\sum_{x \in \textrm{X}}[ \textrm{P}(x) \textrm{I}(x)] =- \sum_{x \in \textrm{X} } [\textrm{P}(x)log(\textrm{P}(x)) ]
\label{eqC2.9}
\end{equation}
\parinterval 一个分布的信息熵也就是从该分布中得到的一个事件的期望信息量。比如,$a$$b$$c$$d$三支球队,三支队伍夺冠的概率分别是$P1$$P2$$P3$$P4$,某个人对比赛不感兴趣但是又想知道哪只球队夺冠,通过使用二分法2次就确定哪支球队夺冠了。但其实,我们知道这四只球队中c的实力比较强劲,那么猜1次就可以确定。所以对于前者,哪只球队夺冠的信息量较高,信息熵也相对较高,对于后者信息量和信息熵也就相对较低。因此我们可以得知:较为尖锐的分布具有较低的熵;分布越接近均匀熵越大。
\subsubsection{KL距离}\index{Chapter2.2.5.2}
\parinterval 如果在相同的随机变量$X$上有两个独立的概率分布P$(x)$和Q$(x)$,那么我们可以使用KL距离("Kullback-Leibler" 散度)来衡量这两个分布的不同,也就是大家所说的相对熵,其公式如下:
\begin{equation}
\textrm{D}_{KL}(P\parallel Q)=\sum_{x \in \textrm{X}} [ \textrm{P}(x)log \frac{\textrm{P}(x) }{ \textrm{Q}(x) } ] =\sum_{x \in \textrm{X} }[ \textrm{P}(x)(log\textrm{P}(x)-log \textrm{Q}(x))]
\label{eqC2.9}
\end{equation}
\parinterval 这一概念的意义在于:在相同事件空间里,概率分布$\textrm{P}(x)$对应的每个事件,若用概率分布Q$(x)$编码时,平均每个基本事件的信息量增加了多少。它衡量的是相同事件空间里的两个概率分布的差异情况。KL距离有两条重要的性质:
\vspace{0.5em}
\begin{itemize}
\item 非负性,即$\textrm{D}_{KL} (P \parallel Q) \geqslant 0$,等号成立条件是$P$$Q$在离散情况下具有相同的概率分布,在连续条件下处处相等。可简单理解为$P$$Q$等价。
\vspace{0.5em}
\item 不对称性,即$\textrm{D}_{KL} (P \parallel Q) \neq \textrm{D}_{KL} (Q \parallel P)$,所以$KL$距离并不代表我们日常生活中的那个距离。这种不对称性意味着在选择使用$\textrm{D}_{KL} (P \parallel Q)$或者$\textrm{D}_{KL} (Q \parallel P)$,将会产生重要的影响。
\end{itemize}
\vspace{0.5em}
\subsubsection{交叉熵}\index{Chapter2.2.5.3}
\parinterval 交叉熵是一个与KL距离密切相关的概念,它的公式是:
\begin{equation}
\textrm{H}(P,Q)=-\sum_{x \in \textrm{X}} [\textrm{P}(x) log \textrm{Q}(x) ]
\label{eqC2.9}
\end{equation}
\parinterval 结合相对熵公式可知,交叉熵是KL距离公式中的右半部分。因此,求关于Q的交叉熵的最小值等价于求KL距离的最小值。交叉熵与KL距离的意义相同:都是用来描述两个分布的差异,由于交叉熵计算上更加直观方便,因此在机器翻译中被广泛应用。
\section{中文分词}\index{Chapter2.3}
\parinterval 对于机器翻译系统而言,输入的是已经切分好的单词序列,而不是原始的字符串。比如,对于一个中文句子,单词之间是没有间隔的,因此我们需要把一个个的单词切分出来,这样机器翻译系统可以区分不同单元。甚至,我们可以对语言学上的单词进行进一步切分,得到词片段序列(比如:中国人=>中国 人)。我们可以把上述过程看作是一种分词过程,即:将一个输入的自然语言字符串切割成单元序列(token序列),每个单元都对应可以处理的最小单位。
%----------------------------------------------
% 图2.6
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{./Chapter2/Figures/figure-a-simple-pre-processing-process.pdf}
\caption{一个简单的预处理流程}
\label{figureC2.7}
\end{figure}
%-------------------------------------------
\parinterval 分词得到的单元序列可以是语言学上的词序列,也可以是根据其它定义的单元。在本章中,我们把分词得到的一个个单元称为单词,尽管这些单元可以不是语言学上的完整单词。而这个过程也被称作词法分析。除了汉语,词法分析在日语、泰语等单词之间无明确分割符的语言中有着广泛的应用,芬兰语、维吾尔语等一些形态学十分丰富的语言,也需要使用词法分析来解决复杂的词尾、词缀变化等形态学变化。
\parinterval 在机器翻译中,分词系统的好坏往往会决定机器翻译的质量。分词的目的是定义系统处理的基本单元,那么什么叫做“词”呢?关于词的定义有很多,比如:\\
%-------------------------------------------
\begin{definition}[词]
新华字典
语言里最小的可以独立运用的单位:词汇。
\end{definition}
%-------------------------------------------
%-------------------------------------------
\begin{definition}[词]
维基百科
单词(word),含有语义内容或语用内容,且能被单独念出来的的最小单位。
\end{definition}
%-------------------------------------------
%-------------------------------------------
\begin{definition}[词]
国语辞典
語句中具有完整概念,能獨立自由運用的基本單位。
\end{definition}
%-------------------------------------------
%-------------------------------------------
\begin{definition}[词]
现代汉语词典
说话或诗歌、文章、戏剧中的语句
\end{definition}
%-------------------------------------------
\parinterval 从语言学的角度,普遍认为词是可以单独运用的、包含意义的基本单位。我们使用有限的词可以组合出无限的句子,这也正体现出自然语言的奇妙之处。
\parinterval 不过,机器翻译并不仅仅局限在语言学定义的单词,因此机器翻译系统所使用的分词也不仅仅把句子按照词切开,比如,神经机器翻译中广泛使用的BPE子词切分方法,可以被理解为将词的一部分也进行切开,也就是得到词片段送给机器翻译系统使用。比如,对如下英文字符串,可以得到如下切分结果\\
\parinterval Interesting -> Interest/ing selection -> se/lect/ion procession -> pro/cess/ion
\parinterval Interested -> Interest/ed selecting -> se/lect/ing processing -> pro/cess/ing
\parinterval Interests -> Interest/s selected -> se/lect/ed processed -> pro/cess/ed \\
\parinterval 词法分析的重要性在自然语言处理领域已经有共识。句子基本单元切分的颗粒度直接关系到后续系统的性能。如果切分的颗粒度很大,获得的单词的歧义也很小,比如“中华人民共和国”整体作为一个单词不存在歧义,而如果单独的一个单词“国”,可能会代表“中国”、“美国”等不同的国家,存在歧义。但是随着切分颗粒度的增大,特定单词出现的频度也随之降低,低频词容易和噪音混淆,系统很难进行学习。因此,处理这些问题并开发适合翻译任务的分词系统是机器翻译的第一步。
\subsection{基于词典的分词方法}\index{Chapter2.3.1}
\parinterval 然而,计算机并不能像人类一样在概念上理解“词”,因此需要使用其他的方式让计算机可以进行分词。一个最简单的方法就是给定一个词典,在这个词典中出现的汉字组合就是我们定义的“词”。也就是,我们通过一个词典定义一个标准,符合这个标准定义的字符串都是合法的“词”。
\parinterval 在使用基于词典的分词方法时,只需预先加载词典到计算机中,扫描输入句子,查询每个词串是否出现在词典中。如图\ref{figureC2.8} 所示,比如,我们有一个包含六个词的词典,给定输入句子“确实现在物价很高”后,我们自左至右遍历输入句子的每个字,发现词串“确实”在词典中出现,说明“确实”是一个“词”,进行分词操作并在切分该“词”之后重复这个过程。
%----------------------------------------------
% 图2.7
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{./Chapter2/Figures/figure-Example-of-word-segmentation-based-on-dictionary.pdf}
\setlength{\belowcaptionskip}{-0.2cm}
\caption{基于词典进行分词实例}
\label{figureC2.8}
\end{figure}
%-------------------------------------------
\parinterval 但是,基于词典的分词方法很“硬”。这是因为自然语言非常灵活,经常出现歧义,用词典定义的合法单词之间有重叠的交叉型歧义就很难解决。图\ref{figureC2.9} 就给出了上面例子中的交叉型歧义,从词典中查看,“实现”和“现在”都是合法的单词,但是在句子中二者有重叠,因此词典无法告诉我们哪个结果是正确的。
%----------------------------------------------
% 图2.8
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{./Chapter2/Figures/figure-cross-type-word-segmentation-ambiguity.pdf}
\setlength{\belowcaptionskip}{-0.2cm}
\caption{交叉型分词歧义}
\label{figureC2.9}
\end{figure}
%-------------------------------------------
\parinterval 类似的例子在生活中也很常见。再比如“答辩结束的和尚未答辩的同学都请留在教室”一句中,正常的分词结果是“答辩 结束 的 和 尚未 答辩 的 同学 都 请 留在 教室”,但是由于“尚未”、“和尚”都是常见词汇,使用基于词典的分词方法在这时很容易出现切分错误。
\parinterval 基于词典的分词方法是典型的基于规则的方法,完全依赖于人工给定的词典。在遇到歧义时,需要人工定义消除歧义的规则,比如,可以自左向右扫描每次匹配最长的单词,这是一种简单的启发式的消歧策略。图2.4中的例子实际上就是这种使用这种策略得到的分词结果。但是,启发式的消岐方法对人工的依赖程度很高,而且启发式规则也不能处理所有的情况。所以说简单的基于词典的方法还不能很好的解决分词问题。
\subsection{基于统计的分词方法}\index{Chapter2.3.2}
\parinterval 既然基于词典的方法有很多问题,我们就需要一种更为有效的方法。在上文中提到,想要搭建一个分词系统,需要让计算机知道什么是“词”,那么我们可不可以给定已经切分好的分词数据,让计算机在这些数据中学习到规律呢?答案是肯定的 - 利用“数据”来让计算机明白“词”的定义,让计算机直接在数据中学到知识,这就是我们常说的数据驱动的方法。这个过程也是一个典型的基于统计建模的学习。
\subsubsection{统计模型的学习与推断}\index{Chapter2.3.2.1}
\parinterval 在分词任务中,数据驱动主要指用已经分词切分好的数据“喂”给系统,这个数据也被称作标注数据。在获得标注训练数据后,自动学习一个统计模型来描述分词的过程,而这个模型会把分词的“知识”作为参数保存在模型中。当送入一个新的需要分词的句子时,可以利用学习到的模型对所有可能的分词结果进行预测,并进行概率化的描述,最终选择概率最大的结果作为输出。这个方法就是基于统计的分词方法。具体来说,可以分为两个步骤:
\vspace{0.5em}
\begin{itemize}
\item 学习。利用标注数据,对统计模型的参数进行学习。
\vspace{0.5em}
\item 推断。利用学习到的模型和参数,对新的句子进行切分。
\end{itemize}
\vspace{0.5em}
%----------------------------------------------
% 图2.9
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{./Chapter2/Figures/figure-word-segmentation-based-on-statistics.pdf}
\caption{基于统计的分词流程}
\label{figureC2.10}
\end{figure}
%-------------------------------------------
\parinterval\ref{figureC2.10} 给出了一个基于统计建模的汉语分词实例。左侧是标注数据,其中的每个句子已经经过人工标注分词结果(单词用斜杠分开)。之后,建立一个统计模型,记为P(·)。模型通过在标注数据上的学习达到能够很好描述问题的状态。最后,对于新的未分词的句子,使用模型P(·)对每个可能的分切进行概率估计,之后选择概率最高的切分结果输出。
\subsubsection{掷骰子游戏}\index{Chapter2.3.2.2}
\parinterval 上述过程的核心在于从数据中学习一种对分词现象的统计描述,即学习函数P(·)。如何让计算机利用分词好的数据学习到分词结果呢?可以先看一个有趣的实例,用我们生活中比较常见的掷骰子来说,掷一个骰子,玩家猜一个数字,猜中就算赢,按照一般的常识,随便选一个数字,获胜的概率是一样的,即我们所有选择的获胜概率仅是1/6。因此这个游戏玩家很难获胜,除非运气很好。假如,我们进行一次游戏,玩家随便选了一个数字,比如是1,投掷30骰子,得到命中7/30 > 1/6,还不错。
%----------------------------------------------
% 图2.11
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{./Chapter2/Figures/figure-the-dice-game.pdf}
\setlength{\belowcaptionskip}{-0.2cm}
\caption{骰子结果}
\label{figureC2.11}
\end{figure}
%-------------------------------------------
\parinterval 似乎玩家的胜利只能来源于运气。不过,请注意,这里的假设“随便选一个数字”这本身就是一个概率模型,它对骰子的六个面的出现做了均匀分布假设。
\begin{equation}
\textrm{P}("1")=\textrm{P}("2")=...=\textrm{P}("5")=\textrm{P}("6")=1/6
\label{eqC2.9}
\end{equation}
\parinterval 但是这个游戏没有人规定骰子是均匀的(有些被坑了的感觉 :) )。但是如果骰子的六个面不均匀呢?我们可以用一种更加“聪明”的方式定义一个新模型,即定义骰子的每一个面都以一定的概率出现,而不是相同的概率。这里,为了保证概率的归一性,我们只需定义$\theta_1 \sim \theta_5$,最后一个面的概率用1减去前几个面的概率之和进行表示,即
\begin{equation}
\begin{split}
\textrm{P}("1") &=\theta_1 \\
\textrm{P}("2") &=\theta_2 \\
\textrm{P}("3") &=\theta_3 \\
\textrm{P}("4") &=\theta_4 \\
\textrm{P}("5") &=\theta_5 \\
\textrm{P}("6") &=1-\sum_{1 \leq i \leq 5}\theta_i \qquad \lhd \textrm {归一性}
\label{eqC2.9}
\end{split}
\end{equation}
\parinterval 这里$\theta_1 \sim \theta_5$可以被看作是模型的参数。对于这样的模型,参数确定了,模型也就确定了。但是,新的问题来了,在定义骰子每个面的概率后,如何求出具体的值呢?一种常用的方法是,从大量实例中学习模型参数,这个方法也是常说的参数估计。我们可以将这个不均匀的骰子先实验性的掷很多次,这可以被看作是独立同分布的若干次采样,比如X次,发现“1”出现X1次,“2”出现X2次,以此类推,得到了各个面出现的次数。假设掷骰子中每个面出现的概率符合多项式分布,通过简单的概率论知识可以知道每个面出现概率的极大似然估计为:
\begin{equation}
\textrm{P}("i")=\frac {X_i}{X}
\label{eqC2.9}
\end{equation}
\parinterval 当X足够大的话,$\frac{X_i}{X}$可以无限逼近P(“i”)的真实值,因此可以通过大量的实验推算出掷骰子各个面的概率的准确估计值。回归到我们的问题中,如果我们在正式开始游戏前,预先掷骰子30次,得到如图\ref{figureC2.12}的结果。
%----------------------------------------------
% 图2.12
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{./Chapter2/Figures/figure-the-dice-game2.pdf}
\caption{预投骰子结果}
\label{figureC2.12}
\end{figure}
%-------------------------------------------
\parinterval 于是,我们看到了一个有倾向性的模型(图 \ref{figureC2.13}):
%----------------------------------------------
% 图2.13
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{./Chapter2/Figures/figure-the-dice-game-model.pdf}
\caption{预设的骰子模型}
\label{figureC2.13}
\end{figure}
%-------------------------------------------
在这样的预先实验基础上,我们知道如果再次玩掷骰子游戏的话,选则数字“4”获胜的可能性是最大的。
\parinterval 通过上面这个掷骰子的游戏,可以得到一个道理:上帝是不公平的。因为在“公平”的世界中,没有任何一个模型可以学到有价值的事情。从机器学习的角度来看,所谓的“不公平”实际上这是客观事物中蕴含的一种偏置(bias),也就是很多事情天然就有对某些情况有倾向。而图像处理、自然语言处理等问题绝大多数都存在着偏置。比如,我们翻译一个英文单词的时候,它最可能的翻译结果往往就是那几个词。我们设计统计模型的目的正是要学习这种偏置,之后利用这种偏置对新的问题做出足够好的决策。
\subsubsection{全概率分词方法}\index{Chapter2.3.2.3}
\parinterval 回到分词的问题上。与掷骰子游戏类似,分词系统的统计学原理也可以这么理解:假设有已经人工分词好的句子,其中每个单词的出现就好比掷一个巨大的骰子,与前面的例子中有所不同的是:
\vspace{0.5em}
\begin{itemize}
\item 骰子有很多个面,每个面代表一个单词。
\vspace{0.5em}
\item 骰子是不均匀的,有些面会出现比较多次。
\end{itemize}
\vspace{0.5em}
\parinterval 如果把投掷这个新的骰子,可能会得到这样的结果,
%----------------------------------------------
% 图2.14
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{./Chapter2/Figures/figure-full-probability-word-segmentation-1.pdf}
\caption{新投骰子结果}
\label{figureC2.14}
\end{figure}
%-------------------------------------------
\parinterval 如果,我们把这些数字换成汉语中的词,比如
\parinterval 88 – 这
\parinterval 87 – 是
\parinterval 45 – 一
\parinterval
\parinterval 之后可以得到
%----------------------------------------------
% 图2.15
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{./Chapter2/Figures/figure-full-probability-word-segmentation-2.pdf}
\setlength{\belowcaptionskip}{-0.2cm}
\caption{换成汉字后结果}
\label{figureC2.15}
\end{figure}
%-------------------------------------------
\parinterval 这样,在中文分词问题中,可以假设我们拥有一个不均匀的多面骰子,每个面都是一个词,我们获取人工分词标注数据后,可以统计每个单词出现的次数,进而利用极大似然估计推算出每个单词出现的概率的估计值。
%----------------------------------------------
% 图2.16
\begin{figure}[htp]
\centering
\includegraphics[scale=1,height=2.5cm]{./Chapter2/Figures/figure-full-probability-word-segmentation-3.pdf}
\caption{每个单词概率估计值}
\label{figureC2.16}
\end{figure}
%-------------------------------------------
\parinterval 通过这个学习过程,我们得到了每个词出现的概率,即模型的参数。而我们原始的问题是如何计算这个整句分词结果的概率,比如
\begin{equation}
\textrm{P}\textrm{(‘确实/现在/数据/很/多’)}=?
\label{eqC2.9}
\end{equation}
\parinterval 这里可以使用“大题小做”的技巧:原始的问题很复杂,我们将其切分为小问题。这样,将复杂的分词问题简单化,基于独立性假设解决分词问题:假定所有词出现都是相互独立的。设$w_1 w_2 w_3…w_m$表示一个由单词$w_1,w_2,w_3,…,w_m$组成的切分结果,于是有:
%-------------------------------------------
\begin{equation}
\textrm{P}(w_1 w_2 w_3…w_m)=\textrm{P}(w_1) \cdot \textrm{P}(w_2) \cdot ... \cdot \textrm{P}(w_m)
\label{eqC2.9}
\end{equation}
\begin{equation}
\begin{split}
\textrm{P}\textrm{(‘确实/现在/数据/很/多’)} \\
& = \textrm{P}\textrm{'确实'} \cdot \textrm{P}\textrm{'现在'} \cdot \textrm{P}\textrm{'数据'} \cdot \textrm{P}\textrm{'很'} \cdot \textrm{P}\textrm{'多'} \\
& = 0.000001 \times 0.000022 \times 0.000009 \times 0.000010 \times 0.000078 \\
& = 1.5444 \times 10^{-25}
\label{eqC2.9}
\end{split}
\end{equation}
\parinterval 以“确实现在数据很多”这个实例来说,如果把这句话按照“确实/现在/数据/很/多”这样的方式进行切分,这句切分的概率P(“确实/现在/数据/很/多”)可以通过每个词出现概率相乘的方式进行计算。这个假设也是自然语言处理中1-gram语言模型假设,即当前词的生成与任何历史都无关。当然,独立性假设并不能完美描述客观世界的问题,但是它大大化简了问题的复杂度。
%----------------------------------------------
% 图2.17
\begin{figure}[htp]
\centering
\includegraphics[scale=1]{./Chapter2/Figures/figure-examples-of-Chinese-word-segmentation-based-on-1-gram-model.pdf}
\caption{基于1-gram语言模型的中文分词实例}
\label{figureC2.17}
\end{figure}
%-------------------------------------------
\parinterval 最后让我们再整体看一下分词系统的学习和使用过程。如图\ref {figureC2.17}所示,我们利用大量人工标注好的分词数据,通过统计学习方法获得一个统计模型P(·),给定任意分词结果$W=w_1 w_2…w_m$,都能通过$\textrm{P}(W)=\textrm{P}(w_1) \times \textrm{P}(w_2 ) \times\textrm{P}(w_m)$计算这种切分的概率值。
\parinterval 经过充分训练的统计模型P(·)就是我们得到分词模型。对于任意输入的新句子S,通过这个模型找到最佳的分词结果$W^*$输出。假设输入句子S是“确实现在数据很多”,可以通过列举获得不同切分方式的概率,其中概率最高的切分方式,就是我们的目标输出。
\parinterval 这种分词方法也被称作基于1-gram语言模型的分词,或全概率分词,使用标注好的分词数据进行学习,获得分词模型。这种方法最大的优点是整个学习过程(模型训练过程)和推导过程(处理新句子进行切分的过程)都是全自动进行的。虽然这种方法十分简单,但是其效率很高,因此被广泛使用在工业界系统里。
\parinterval 当然,真正的分词系统还需要解决很多其它问题,比如使用动态规划等方法高效搜索最优解以及如何处理未见过的词等等,由于本节的重点是介绍中文分词的基础方法和统计建模思想,因此无法覆盖所有中文分词的技术内容,有兴趣的读者可以参考2.6节的相关文献做进一步深入研究。
......@@ -7,257 +7,322 @@
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\definecolor{ugreen}{rgb}{0,0.5,0}
\chapterimage{chapter_head_1} % Chapter heading image
%公式1.7之后往后串一个
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{基于词的翻译模型}
\hspace{2em}统计机器翻译和神经机器翻译在当前具有统治性意义。这两种方法各有优缺点,并没有哪种方法具有绝对的优势。但从研究的角度来看,神经机器翻译整体上更具有前沿性。本章主要介绍了统计机器翻译的开山之作—IBM模型,它主要讲了怎么使用词汇对机器翻译进行建模。IBM模型由Peter E. Brown等人在1993年提出,并详细阐述于论文—《The Mathematics of Statistical Machine Translation: Parameter Estimation》。这篇文章的视野和对问题的定义远超当时人所能看到的东西,其衍生出来的一系列方法和新的问题还被后人花费将近10年的时间来进行研究与讨论。
\section{什么是基于词的翻译模型}\index{Chapter3.1}%Index的作用,目前不清晰
\hspace{2em}在机器翻译中,我们希望得到一个源语句到目标语译文的翻译。但机器并不知道如何翻译。因此在做机器翻译的过程中,最初面临的一个问题是:如何对翻译进行建模?从计算机的角度看,建模的目的就是把抽象的问题转换为可计算的问题。所以机器翻译的一个核心问题是:如何将翻译转换为一个可计算的模型或过程。
\noindent\hspace{2em}基于单词的统计机器翻译模型又是如何描述翻译的呢?IBM模型提出了一个观点:在翻译源语句时,通常是把每个源语句的单词翻译成对应的目标语单词,然后调整这些单词的顺序,最后得到翻译结果。尽管在人看来基于单词的对应进行翻译是很自然的事,但是机器并不一定。
\hspace{2em}使用统计方法对翻译进行建模是机器翻译发展中的重要里程碑。这种思想也影响了随后的统计机器翻译和神经机器翻译。虽然技术不断发展,传统的统计模型已经不再``新鲜'',但是对于今天机器翻译的研究仍然有启示作用。想要了解前沿、展望未来,我们更要冷静的思考前任给我们带来了什么。基于此,本章将主要介绍统计机器翻译的开山之作\ \ \ \ IBM模型,它主要提出了使用统计模型进行翻译的思想,并使用基于单词对齐的方式完成了机器翻译的统计建模。IBM模型由Peter E. Brown等人在1993年提出({\red 参考文献!!!})\ \ \ \ 《The Mathematics of Statistical Machine Translation: Parameter Estimation》。客观的说,这篇文章的视野和对问题的理解,已经超过当时绝大多数人所能看到的东西,其衍生出来的一系列方法和新的问题还被后人花费将近10年的时间来进行研究与讨论。时至今日,IBM模型中的一些思想仍然影响着很多研究工作。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{什么是基于词的翻译模型}\index{Chapter3.1}
\parinterval 在机器翻译中,我们希望得到一个源语言到目标语言的翻译。虽然对于人类来说这个问题很简单。但是,让计算机做这样的工作却困难很多,因为我们需要把翻译``描述''成计算机可以计算的形式。因此这里面临的第一个问题是:如何对翻译进行建模?从这个角度计算机的角度来说,需要把抽象的翻译问题转换为可计算的问题,这样问题又可以被重新描述为:如何将翻译转换为一个可计算的模型或过程?
\noindent\hspace{2em}举个例子说明如何基于单词的对应进行翻译。如图 \ref{figureC3.1}所示,表示的是汉译英的例子。其中源语句是“我 对 你 感到 满意”。首先我们把源语句的单词“我”、“对”、\\“你”、“感到”和“满意”分别翻译为“I”、“with”、“you”、“am”和“satisfied”,然后调整单词的顺序,比如“am”放在译文的第2个位置,“you”应该放在最后的位置等,最后得到译文“I am satisfied with you”。
\parinterval 那么,基于单词的统计机器翻译模型又是如何描述翻译问题的呢?Peter E. Brown等人提出了一个观点({\red 参考文献!!!}):在翻译源语句时,通常是把每个源语句的单词翻译成对应的目标语单词,然后调整这些单词的顺序,最后得到翻译结果,而这个过程可以用统计模型描述。尽管在人看来使用两个语言单词之间的对应进行翻译是很自然的事,但是对于计算机来说是迈出了一大步。
\parinterval 先来看一个例子。图 \ref{fig:figure-zh-en-translation-example}展示了一个汉语翻译到英语的例子。首先我们把源语句的单词``我''、``对''、``你''、``感到''和``满意''分别翻译为``I''、``with''、``you''、``am''\ 和``satisfied'',然后调整单词的顺序,比如``am''放在译文的第2个位置,``you''应该放在最后的位置等,最后得到译文``I am satisfied with you''。
%空一行用来段落换行,noindent取消首行缩进,hspace{}指定缩进距离,1em等于两个英文字符|一个汉字
%----------------------------------------------
% 图3.1
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure31}
\caption{此处为图片的描述...例:基于词对应进行翻译.}
\label{figureC3.1}
\input{./Chapter3/Figures/figure-zh-en-translation-example}
\caption{汉语到英语翻译实例及单词之间的对应关系}
\label{fig:figure-zh-en-translation-example}
\end{figure}
%-------------------------------------------
\noindent\hspace{2em}传统观点认为基于词的翻译过程包含如下三个步骤。如图 \ref{figureC3.2}所示。
\noindent\hspace{2em}第一、分析。将源语句或目标语句切分或者表示为能够处理的最小单元的过程。在基于词的翻译模型的最小处理单元就是单词。在这里也可以简单地将分析理解为分词。
\parinterval 上面的例子反映了翻译中的一些要求:首先,两种语言直接单词的顺序可能不一致,译文需要符合目标语的习惯,这也是我们常说翻译的\textbf{流畅度}问题(fluency);其次,源语言单词需要准确的翻译出来\footnote{当然,对于一些意译的情况或者虚词并不需要翻译。},也是我们常说的翻译的\textbf{准确性}\textbf{充分性}问题(adequacy)。为了达到以上目标,传统观点认为翻译过程包含三个步骤(图 \ref{fig:translation-pipeline}
\noindent\hspace{2em}第二、转换。把源语句中的每个单词都翻译成目标语单词。
\begin{itemize}
\item 分析。将源语句切分或者表示为能够处理的最小单元的过程。在基于词的翻译模型的最小处理单元就是单词,因此在这里也可以简单地将分析理解为分词。
\noindent\hspace{2em}第三、生成。基于转换的结果,将目标语译文变成通顺且合乎语法的句子
\item 转换。把源语句中的每个单词都翻译成目标语单词
\item 生成。基于转换的结果,将目标语译文变成通顺且合乎语法的句子。
\end{itemize}
%----------------------------------------------
% 图3.2
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure32}
\caption{此处为图片的描述...例:基于词的翻译过程.}
\label{figureC3.2}
\input{./Chapter3/Figures/figure-translation-pipeline}
\caption{翻译过程中的分析、转换和生成}
\label{fig:translation-pipeline}
\end{figure}
%---------------------------
\noindent\hspace{2em}从现在的角度看,分析、转换和生成依然是非常深刻的一个观点。该过程蕴含于很多的任务,比如句法分析。即使对于神经机器翻译,从大的框架来说,依然在做分析、转换和生成,只不过有些过程隐含在神经网络的设计中
\section{构建一个简易机器翻译系统}\index{Chapter3.2}%Index的作用,目前不清晰
\parinterval 即使从现在来看,``分析、转换和生成''依然是一个非常深刻的观点。包括机器翻译在内的很多自然语言处理任务都可以用这个过程来解释。比如,对于现在比较前沿的神经机器翻译,从大的框架来说,依然在做分析(编码器)、转换(编码-解码注意力)和生成(解码器),只不这些过程隐含在神经网络的设计中。当然,这里并不会展开过多的讨论,随着后面技术内容的深入,这个观念会有进一步体现
\noindent\hspace{2em}本节首先对比人工翻译流程和机器翻译流程的异同点,从中我们可以归纳出构建机器翻译系统的两个主要流程:训练和解码。其次从单词翻译概率、句子级翻译模型和解码三个方面描述如何构建一个简易机器翻译系统。其中单词翻译概率和句子级翻译模型属于训练流程。
\subsection{机器翻译的思路}\index{Chapter3.2.1}
\textbf{人工翻译流程}\index{Chapter3.2.1.1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{构建一个简易机器翻译系统}\index{Chapter3.2}
\label{sec:simple-mt-example}
\parinterval 本节首先对比人工翻译流程和机器翻译流程的异同点,从中我们归纳出构建机器翻译系统的两个主要流程:训练和解码。其次从单词翻译模型学习、句子级翻译模型学习和解码三个方面描述如何构建一个简单的机器翻译系统。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{如何进行翻译?}\index{Chapter3.2.1}
\subsubsection{(一)人工翻译流程}\index{Chapter3.2.1.1}
\parinterval 当我们翻译一个句子时,首先会快速地分析出句子的构成,然后根据以往的知识,得到每个词的候选翻译,最后利用对目标语的理解拼出来一个译文。尽管这个过程并不是严格来自心理学或者脑科学相关结论,但至少可以帮助我们理解人在翻译时的思考方式。
\noindent\hspace{2em}当我们翻译一个句子时,首先会快速地分析出句子中词的构成,然后基于以往的知识,得到每个词的候选翻译,最后利用对单词的理解拼出来一个译文。这描述了人在翻译时的基本过程。尽管并不是严格的从心理学或者脑科学得出来的观点,但至少可以帮助我们理解人的翻译。
%----------------------------------------------
% 图3.3
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure33}
\caption{此处为图片的描述...例:人工翻译的过程}
\label{figureC3.3}
\input{./Chapter3/Figures/figure-human-translation}
\caption{人工翻译的过程}
\label{fig:human-translation}
\end{figure}
%---------------------------
\noindent\hspace{2em}如图\ref{figureC3.3}所示,表示的是人工翻译的过程。其中待翻译的句子是“我 对 你表示 满意”,它的一个可能译文是“I’m satisfied with you”。我们可以把上述过程总结为如下两个过程
\parinterval\ref{fig:human-translation}展示了翻译“我 对 你表示 满意”时我们思考的内容。具体来说,有如下两方面内容
\noindent\hspace{2em}第一、学习单词的翻译。即获取待翻译句子的每个单词的候选翻译。比如“对”的可能译文有“to”、“with”和“for”等。对于人来说,可以通过阅读、背诵、做题或者老师教等途径获得,并在大脑中形成知识。这些知识就包含了源语词与目标语词对应关系。我们也把这个过程称之为学习过程。
\begin{itemize}
\item 翻译知识的学习。对于输入的源语言句子,我们首先需要知道每个单词可能的翻译,称为候选翻译。比如``对''可能的译文有``to''、``with''和``for''等。对于人来说,可以通过阅读、背诵、做题或者老师教等途径获得翻译知识,这些知识就包含了源语与目标语单词之间的对应关系。我们也把这个过程称之为学习过程。
\noindent\hspace{2em}第二、运用知识生成译文。当翻译一个课本上没有见过的句子时,我们可能会想到词之间的翻译关系、一些常见的单词搭配、主谓宾等语法知识等,比如“satisfied”后面常使用介词“with”来表示对人的满意等,并基于这些知识快速地对译文进行生成。
\item 运用知识生成译文。当翻译一个从未见过的句子时,我们可以运用学习到的翻译知识,得到新的句子中每个单词的译文,并处理常见的单词搭配、主谓一致等问题,比如,我们知道``satisfied''后面常使用介词``with''构成搭配,基于这些知识可以快速生成译文。
\end{itemize}
\noindent\textbf{机器翻译流程}\index{Chapter3.2.1.2}
当然,每个人进行翻译时所使用的方法和技巧都不相同,所谓人工翻译也没有固定的流程。但是,可以确定的是,人进行翻译也需要通过``学习''和``运用''翻译知识。对翻译知识``学习''和``运用''的好与坏,直接决定了人工翻译结果的质量。
\noindent\hspace{2em}那么机器是如何完成翻译的呢?机器翻译可能没有人那么智能。因为一方面没有老师教给它一些非常好用的规则,使它能够快速得到译文。另一方面机器很笨,尽管它能知道每个单词的译文,但是不知道这些译文怎么拼装成句,甚至不知道哪些译文是对的。为了更加直观地理解机器在翻译时的困境,我们将其中需要解决的问题归纳如下。
\subsubsection{(二)机器翻译流程}\index{Chapter3.2.1.2}
\noindent\hspace{2em}问题一、如何将单词的译文拼装成句?
\parinterval 人进行翻译的过程比较容易理解,那计算机是如何完成翻译的呢?虽然``人工智能''这个感念显得很神奇,但是计算机远没有人那么智能,甚至说还很笨。一方面,他没有能力像人一样,在教室里和老师一起学习语言知识;另一方面,即使能列举出每个单词的候选译文,但是还是不知道这些译文怎么拼装成句,甚至不知道哪些译文是对的。为了更加直观地理解机器在翻译时要解决的挑战,我们将其中需要解决的问题归纳如下。
\noindent\hspace{2em}问题二、如果可以将译文成句,那如何判断结果的好坏?
\vspace{0.5em}
\begin{itemize}
\item 如何让计算机得到单词的译文并将它们拼装成句?
\vspace{0.5em}
\item 如果可以形成译文,如何让计算机知道不同译文的好坏?
\end{itemize}
\vspace{0.5em}
\noindent\hspace{2em}对于问题一。机器最擅长的就是计算,它可以类似于走一条路径,尝试把译文拼装成句。如图\ref{figureC3.4}中蓝色和红色的线,表示的就是两条译文选择路径,区别在于“满意”和“对”的翻译候选是不一样的,蓝色线选择的是“satisfy”和“to”,而红色线是“satisfied”和“with”。换句话说,翻译就是一条译文选择路径,不同的译文对应不同的路径,并且词序也可以不同。机器可以利用它的计算能力找到很多这样的路径。
\parinterval 对于第一个问题,我们可以给计算机一个翻译词典,这样计算机可以发挥计算方面的优势,简单粗暴的把尽可能多的翻译结果拼装出来。比如,可以把每个翻译结果看作是对单词翻译的拼装,表示成贯穿多个单词的一条路径,计算机所做的就是尽可能多的生成这样的路径。图\ref{fig:process-of-machine-translation}中蓝色和红色的线就分别表示了两条不同的译文选择路径,区别在于“满意”和“对”的翻译候选是不一样的,蓝色线选择的是``satisfy''和``to'',而红色线是``satisfied''和``with''。换句话说,不同的译文对应不同的路径,即使词序不同也会对应不同的路径。
%----------------------------------------------
% 图3.4
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure34}
\caption{此处为图片的描述...例:机器翻译的流程(1)}
\label{figureC3.4}
\input{./Chapter3/Figures/figure-process-of-machine-translation}
\caption{机器翻译的过程 - 把单词的译文进行拼装,并找到最优的拼装路径}
\label{fig:process-of-machine-translation}
\end{figure}
%---------------------------
\noindent\hspace{2em}对于问题二。尽管机器能够找到很多这样的译文选择路径,但它并不知道那些路径是好的。因此机器还需要运用它的知识判断哪个结果是好的。机器没有人脑这样复杂的神经元结构,那它知识又该怎么表示呢?如图\ref{figureC3.4}所示,其中的数字表示的是概率,它们就是机器对每个局部翻译或翻译路径的描述。换句话说,机器用概率化的模型描述了每个翻译候选的可能性。基于每个候选翻译的可能性,机器可以对所有的译文选择路径进行打分,图\ref{figureC3.4}中第一条翻译路径的分数为0.042,第二条是0.006,...,以此类推。最后机器可以选择分数最高的路径作为源语句的最终译文。
\textbf{人工 vs. 机器}\index{Chapter3.2.1.3}
\parinterval 对于第二个问题,尽管机器能够找到很多这样的译文选择路径,但它并不知道那些路径是好的。说的再直白一些,简单的枚举路径实际上就是一个体力活,没有什么智能。因此计算机还需要再聪明一些,运用它的能够``掌握''的知识判断哪个结果是好的。这一步是最具挑战的,当然也有很多思路。在统计机器翻译中,这个问题被定义为:设计一种统计模型,它可以给每个译文一个概率值,这个概率值越高表示译文质量越好。如图\ref{fig:process-of-machine-translation}所示,每个单词翻译候选的右侧黑色框里的数字就是单词的翻译概率。使用这些单词的翻译概率,我们可以得到整句译文的概率(符号P表示)。这样,我们用概率化的模型描述了每个翻译候选的可能性。基于每个翻译候选的可能性,机器翻译系统可以对所有的译文选择路径进行打分,图\ref{figureC3.4}中第一条翻译路径的分数为0.042,第二条是0.006,以此类推。最后,系统可以选择分数最高的路径作为源语句的最终译文。
\subsubsection{(三)人工 vs. 机器}\index{Chapter3.2.1.3}
\parinterval 人在翻译时的决策和推断是非常确定并且快速的,但机器翻译处理这个问题却充满了不确定性和概率化的思想。当然它们也有类似的地方。首先,计算机使用统计模型目的是建立处理翻译问题的基本模式,并储存相关的模型参数,这个和我们大脑的作用是类似的\footnote{这里,并不是要把统计模型等同于生物学或者认知科学上的人脑,我们指的是他们处理问题时发挥的作用类似。};其次,计算机对统计模型进行训练的过程相当于人学习知识的过程,或者二者都可以称为学习;再有,计算机使用学习到的模型对新的句子进行翻译的过程相当于人运用知识进行翻译的过程。在统计机器翻译中,模型学习的过程称为\textbf{训练},目的是从双语平行数据中自动学习翻译知识;我们把应用模型的过程称为\textbf{解码}\textbf{推断},目的是使用学习的知识对新的句子进行翻译。这就是当前机器实现翻译的两个核心步骤:训练和解码。图\ref{figureC3.4}右侧标注了在机器翻译过程中这两个部分的体现。这样,统计机器翻译的核心由三部分构成 - 建模、训练和解码。本章后续内容会围绕这三个问题展开讨论。
\noindent\hspace{2em}人在翻译时的决策和推断是非常确定并且快速的,但机器却充满了不确定性和概率化的思想。当然它们也有类似的地方。机器学习概率的过程相当于人学习知识的过程,而寻找路径以及给它们打分相当于人应用知识的过程。在统计机器翻译中,我们称前者是训练,目的是从双语平行数据中自动学习翻译知识。后者是解码或推断,目的是使用学习的知识对未知的句子进行翻译。这就是当前机器实现翻译的两个角度:训练和解码。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{基本框架}\index{Chapter3.2.2}
\parinterval 为了可以对统计机器翻译有一个简单且直观的认识,下面我们将介绍如何构建一个非常简单的基于词的统计机器翻译系统,其中用到的很多方法的思想来自IBM模型。这里,我们仍然使用数据驱动的统计建模方法。图\ref{fig:processes-SMT}展示了系统的主要流程,包括两个主要步骤。
\vspace{0.5em}
\begin{itemize}
\item 训练。从双语平行数据中学习翻译模型,这个模型称为$\textrm{P}(t|s)$。其中$s$表示源语言,$t$表示目标语,它表示给定源语句的条件下,翻译为目标语句子的概率。简言之,这一步需要从大量的双语平行数据中学习到$\textrm{P}(t|s)$的计算方法。
\vspace{0.5em}
\item 解码。当面对一个新的待翻译句子时,我们需要使用学习得到的模型进行推断。推断可以被视为一个搜索和计算的过程,换句话说,我们尽可能的搜索更多的翻译结果,然后对每个翻译结果进行打分,最后选择得分最高的翻译结果。
\end{itemize}
\vspace{0.5em}
\noindent\hspace{2em}实际上,上述机器翻译的过程可以总结为三个方面。第一、建模,基于词的思想去构建翻译模型。第二、训练,有了这个思想如何学习这个模型。第三、解码,应用训练好的模型对新的句子进行翻译。
%----------------------------------------------
% 图3.5
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure35}
\caption{此处为图片的描述...例:机器翻译的流程(2)}
\label{figureC3.5}
\input{./Chapter3/Figures/figure-processes-SMT}
\caption{简单的统计机器翻译流程}
\label{fig:processes-SMT}
\end{figure}
%---------------------------
\subsection{简单的建模}\index{Chapter3.2.2}
\noindent\hspace{2em}下面我们将介绍如何构建一个简易的基于词的机器翻译系统。本小节首先进行简单的建模。如图\ref{figureC3.6}所示,表示的是基于数据驱动的方法的框架,它主要包括两个步骤。
\parinterval 接下来,我们将介绍模型训练和解码的方法。在模型学习中,我们分两小节进行描述 - 单词翻译概率和句子级翻译模型。实现单词级的翻译是实现句子级翻译的基础。换言之,句子级翻译统计模型是建立在单词翻译统计之上。在解码中,我们将介绍一个高效的搜索算法,其中也使用到了剪枝、启发式搜索的思想。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{单词翻译概率}\index{Chapter3.2.3}\label{chapter3.2.3}
\subsubsection{(一)什么是单词翻译概率?}\index{Chapter3.2.3.1}
\parinterval 单词翻译概率描述的是一个源语言单词与目标语言译文构成正确翻译的可能性,这个概率越高表明单词翻译的越可靠。使用单词翻译概率,可以帮助我们解决翻译时的“择词”问题,即选择什么样的目标语译文是合适的。当人在翻译某个单词时,可以利用积累的知识,快速得到它的高质量候选译文。以汉译英为例,当翻译``我''这个单词时,我们直接会想到用``I''、``me''或``I’m''作为它的译文,而几乎不会选择``you''、``satisfied''等含义相差太远的译文。这是为什么呢?如果从单词翻译概率的角度来看,无论是何种语料,包括教材、新闻、小说等,绝大部分情况下“我”都翻译成了``I''、``me''等,几乎不会看到我被翻译成``you''或``satisfied''的情况。从数据上分析,``我''翻译成``I''、``me''等属于高频事件,而翻译成``you''、``satisfied''等属于低频或小概率事件,它们在整个语料中出现的概率是不一样的。因此人在翻译时也是选择在统计意义上概率更大的译文,这也间接反映出统计模型可以在一定程度上描述人的翻译习惯和模式。
\noindent\hspace{2em}第一、模型学习。从双语平行数据中学习模型,这个模型称为$\textrm{P}(t|s)$。其中$s$表示源语言,$t$表示目标语,它表示给定源语句的条件下,翻译为目标语句子的概率。总而言之,这一步我们需要从大量的双语平行数据中求解$\textrm{P}(t|s)$
\parinterval\ref{tab:word-translation-examples}展示了汉语到英语的单词翻译实例及翻译概率。可以看到,``我''的常见翻译的概率较高,比如,翻译成``I''的概率是0.5,这样系统可以更好的使用这些译文。而且概率化的模型避免了非0即1的判断,所有的译文都是可能的,只是概率不同。这也使得统计模型可以覆盖更多的翻译现象,甚至捕捉到一些人所忽略的现象
\noindent\hspace{2em}第二、解码。当面对一个新的句子时,我们需要使用学习得到的模型进行推断。推断的方式可描述为穷举和计算,换句话说,我们尽可能的枚举更多的翻译结果,然后对每个翻译结果进行打分,最后选择得分最高的翻译结果。
%----------------------------------------------
% 图3.6
\begin{figure}[htp]
%
\begin{table}[htp]
\centering
\input{./Chapter3/Figures/figure36}
\caption{此处为图片的描述...例:基于数据驱动的方法的框架}
\label{figureC3.6}
\end{figure}
\begin{tabular}{l | l | l}
源语言 & 目标语言 & 翻译概率 \\ \hline
& I & 0.50 \\
& me & 0.20 \\
& I'm & 0.10 \\
& we & 0.05 \\
& am & 0.10 \\
... & ... & ... \\
\end{tabular}
\caption{汉译英单词翻译概率}
\label{tab:word-translation-examples}
\end{table}
%---------------------------
\noindent\hspace{2em}接下来,我们将介绍这个简易机器翻译系统的模型学习和解码的过程。在模型学习中,我们分两小节进行描述,即单词翻译概率和句子级翻译模型,它们属于递进的关系。换言之,句子级翻译概率模型是建立在单词翻译概率之上。
\subsection{单词翻译概率}\index{Chapter3.2.3}\label{chapter3.2.3}
\textbf{什么是单词翻译概率?}\index{Chapter3.2.3.1}
\noindent\hspace{2em}单词翻译概率主要解决的是翻译时的“择词”问题,即选择什么样的目标语单词作为候选译文。当人在翻译某个单词时,可以利用积累的知识,快速地得到它的候选译文。举个汉译英的例子,当翻译“我”这个单词时,可能会想到用“I”、“me”或“I’m”作为它的译文,而几乎不会选择“you”、“satisfied”等含义相差太远的目标语单词。这是为什么呢?如果从概率的角度来分析这个问题,无论是我们的课本还是其他学习材料,绝大部分情况下“我”都翻译成了“I”、“me”等,几乎没有看到翻译成“you”或“satisfied”等的情况。换句话说,“我”翻译成“I”、“me”等属于高频事件,而翻译成“you”、“satisfied”等属于低频或小概率事件,它们在整个语料中出现的概率是不一样的。因此人在翻译时也是选择概率更大的目标语单词作为候选译文。
\subsubsection{(二)如何从一个双语平行数据中学习?}\index{Chapter3.2.3.2}
\noindent\hspace{2em}如何用概率化模型描述上述思想呢?下面我们先介绍如何从一个双语平行数据中估计或者学习单词翻译概率,再介绍如何从大量的双语平行数据中学习更准确的单词翻译概率
\parinterval 下面要解决的问题是如何学习单词翻译的概率。假设我们拥有一定数量的双语对照的平行数据,是否可以从中自动获得单词之间的翻译概率呢?回忆一下第二章中的掷骰子游戏,我们使用了相对频率估计来自动获得骰子不同面出现概率的估计值。其中,重复投掷骰子很多次,然后统计“1”到“6”各面出现的次数,再除以投掷的总次数,最后得到它们出现的概率的估计值。这里,我们使用类似的方式计算单词翻译概率。但是,我们现在拥有的是句子一级对齐的数据,但是并不知道两种语言之间单词的对应关系。因此,我们要从句子以及对齐的平行数据中学习单词之间对齐的概率。我们使用一种稍微``复杂''一些的模型来描述这个问题
\noindent\textbf{如何从一个双语平行数据中学习?}\index{Chapter3.2.3.2}
\noindent\hspace{2em}在上一节的骰子游戏中,我们重复地掷骰子很多次,然后计算“1”到“6”各出现的次数,再除以掷的总次数,最后得到它们出现的近似概率。我们同样用类似的方式估计单词翻译概率。假设$x$表示任意源语单词,所有的目标语单词$y \in Y$都可能是它的译文。当给定一个互译的句对$(s,t)$,我们定义$\textrm{P}(x \leftrightarrow y; s, t)$表示在$(s,t)$$x$$y$互译的可能性或概率。其中$x$属于句子$s$中的词,而$y$属于$t$中的词,具体计算如公式\ref{eqC3.1}所示。
\begin{equation}
\textrm{P}(x \leftrightarrow y; s,t) \equiv \textrm{P}(x,y;s,t) = \frac{c(x,y;s,t)}{\sum_{x',y'} c(x',y';s,t)}
假设$x$表示任意源语单词,所有的目标语单词$y \in Y$都可能是它的译文,这里$Y$表示目标语言的词表。给定一个互译的句对$(s,t)$,我们定义$\textrm{P}(x \leftrightarrow y; s, t)$表示在观测到$(s,t)$的前提下$x$$y$互译的概率。其中$x$是属于句子$s$中的词,而$y$是属于$t$中的词。计算公式描述如下:
\begin{eqnarray}
\textrm{P}(x \leftrightarrow y; s,t) & \equiv & \textrm{P}(x,y;s,t) \nonumber \\
& = & \frac{c(x,y;s,t)}{\sum_{x',y'} c(x',y';s,t)}
\label{eqC3.1}
\end{equation}
\end{eqnarray}
\noindent\hspace{2em}上式中分子$c(x,y;s,t)$表示$x$$y$在句对$(s,t)$中共现的总次数,分母$\sum_{x',y'} c(x',y';$ $s,t)$表示任意的$x'$和任意的$y'$$(s,t)$共现的总次数。为了更加清晰的理解如何计算$c(x,y;s,t)$,我们用图\ref{figureC3.7}描述的算法进行了说明。由图可得,计算$c(x,y;s,t)$的过程主要是两层\textbf{for}循环,外层的\textbf{for}循环用于遍历$s$中的词,内层的\textbf{for}循环用于遍历$t$中的词,当$s$中的词等于$x$$t$中的词等于$y$时,count加1,最后count的值就是$x$$y$的总共现次数。
\noindent其中,$\equiv$表示定义式。分子$c(x,y;s,t)$表示$x$$y$在句对$(s,t)$中共现的总次数,分母 $\sum_{x',y'} c(x',y';$ $s,t)$表示任意的源语言单词$x'$和任意的目标语言单词$y'$$(s,t)$共现的总次数。为了更加清晰的理解如何计算$c(x,y;s,t)$,可以参看图\ref{fig:simple-statistical-algorithms}描述的算法。可以看到,计算$c(x,y;s,t)$的过程主要是两层循环,外层的循环用于遍历$s$中的词,内层的循环用于遍历$t$中的词。当$s$中的词等于$x$$t$中的词等于$y$时,计数器$count$加1,最后$count$的值就是$x$$y$的总共现次数。
%----------------------------------------------
% 图3.7
% 图3.6
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure37}
\caption{此处为图片的描述...单词x和y在句对(s, t)中的共现总次数的算法}
\label{figureC3.7}
\input{./Chapter3/Figures/figure-simple-statistical-algorithms}
\caption{统计源语言单词$x$和目标语言单词$y$在句对$(s, t)$中的共现总次数的算法}
\label{fig:simple-statistical-algorithms}
\end{figure}
%---------------------------
\noindent\hspace{2em}举个例子,如果互译的句对$(s,t)$分别如图\ref{figureC3.8}所示,$x$$y$分别是“翻译”和“transl-\\ation”,那么它们的单词翻译概率是多少呢?
%----------------------------------------------
% 图3.8
% 图3.7
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure38}
\caption{此处为图片的描述...一个互译的句对}
\label{figureC3.8}
\input{./Chapter3/Figures/figure-zh-en-sentence}
\caption{一个汉英互译的句对}
\label{fig:zh-en-sentence}
\end{figure}
%---------------------------
\noindent\hspace{2em}在上述例子中,”翻译”和”translation”分别在$s$$t$中出现了2次,因此$c('\text{翻译}',$\\$'\text{translation}';s,t)$等于4。而对于$\sum_{x',y'} c(x',y';s,t)$,因为$x'$$y'$分别是$s$$t$的任意的词,所以等于$s$的词数乘以$t$的词数。最后“翻译”和“translation”的单词翻译概率如式\ref{eqC3.2}所示。
\begin{equation}
\textrm{P}('\text{翻译}','translation'; s,t) = \frac{c(x,y;s,t)}{\sum_{x',y'} c(x',y';s,t)} = \frac{4}{|s|\times |t|} = \frac{4}{63}
\parinterval 看一个具体的例子,有一个汉英互译的句对$(s,t)$如图\ref{fig:zh-en-sentence}所示。假设,$x=\textrm{``翻译''}$$y=\textrm{``transaltion''}$,现在要计算$x$$y$共现的总次数。``翻译''和``translation''分别在$s$$t$中出现了2次,因此$c(\textrm{``翻译''},\textrm{``translation''};s,t)$ 等于4。而对于$\sum_{x',y'} c(x',y';s,t)$,因为$x'$$y'$分别表示的是$s$$t$中的任意词,所以$\sum_{x',y'} c(x',y';s,t)$表示所有单词对的数量 - 即$s$的词数乘以$t$的词数。最后,“翻译”和“translation”的单词翻译概率可以如下计算:
\begin{eqnarray}
\textrm{P}(\text{``翻译''},\text{``translation''}; s,t) & = & \frac{c(\textrm{``翻译''},\textrm{``translation''};s,t)}{\sum_{x',y'} c(x',y';s,t)} \nonumber \\
& = & \frac{4}{|s|\times |t|} \nonumber \\
& = & \frac{4}{63}
\label{eqC3.2}
\end{equation}
\end{eqnarray}
\noindent\hspace{2em}公式\ref{eqC3.2}中运算$|\bullet|$表示计算句长。类似的可以得到“机器”和“translation”、“机器”和“look”的单词翻译概率,如式\ref{eqC3.3}\ref{eqC3.4}所示。
\begin{equation}
\textrm{P}('\text{机器}','translation'; s,t) = \frac{2}{63}
\label{eqC3.3}
\end{equation}
\begin{equation}
\textrm{P}('\text{机器}','look'; s,t) = \frac{0}{63}
\noindent这里运算$|\cdot|$表示句子长度。类似的,可以得到``机器''和``translation''、“机器”和“look”的单词翻译概率:
\begin{eqnarray}
\textrm{P}(\text{``机器''},\text{``translation''}; s,t) & = & \frac{2}{63} \\
\textrm{P}(\text{``机器''},\text{``look''}; s,t) & = & \frac{0}{63}
\label{eqC3.4}
\end{equation}
\textbf{如何从大量的双语平行数据中学习?}\index{Chapter3.2.3.3}
\end{eqnarray}
\noindent\hspace{2em}在很多时候,我们有多个互译句对$(s^1,t^1),...,(s^n,t^n)$。如果能从更多的数据中进行统计,那么单词翻译概率也会更加的准确。当我们从大规模的双语平行数据中计算单词翻译概率时,其可定义为公式\ref{eqC3.5}。与公式\ref{eqC3.1}相比,分子分母都多了一项累加符号$\sum_{i-1}^{n}\bullet$,它表示遍历语料库中所有的句对,其中$n$表示语料库中句对的数量。换句话说,当我们计算词的共现次数时,需要对每个句对上的结果进行累加。
\noindent注意,由于``look''没有出现在数据中,因此$\textrm{P}(\text{``机器''},\text{``look''}; s,t)=0$。这时,我们可以使用第二章介绍的平滑算法赋予它一个非零的值,以保证在后续的步骤中整个翻译模型不会出现0概率的情况。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{(三)如何从大量的双语平行数据中学习?}\index{Chapter3.2.3.3}
\parinterval 上面提到的方法需要能在更多的句子上使用。假设,有多个互译句对$(s^1,t^1)$,...,$(s^n,t^n)$。这时,我们仍然可以使用基于相对频度的方法进行估计,具体方法如下
\begin{equation}
\textrm{P}(x,y) = \frac{{\sum_{i=1}^{n} c(x,y;s^i,t^i)}}{\sum_{i=1}^{n}{{\sum_{x',y'} c(x',y';x^i,y^i)}}}
\label{eqC3.5}
\end{equation}
\noindent\hspace{2em}举个例子。如图\ref{figureC3.9}所示,表示的是两个双语句对。我们使用$s^1$$s^2$分别表示第一个句对和第二个句对的源语句,$t^1$$t^2$表示目标语句。
\noindent与公式\ref{eqC3.1}相比,分子分母都多了一项累加符号$\sum_{i-1}^{n} \cdot$,它表示遍历语料库中所有的句对,其中$n$表示语料库中句对的数量。换句话说,当我们计算词的共现次数时,需要对每个句对上的计数结果进行累加。从统计学习的角度,使用更大规模的数据进行参数估计可以提高估计的准确性。在自然语言处理任务中,使用更大规模的数据往往是提高系统性能的捷径。计算单词的翻译概率也是一样,在小规模的数据上看,很多翻译现象的特征并不明显,但是当使用的数据量增加到一定程度,翻译的规律会很明显的体现出来。
%----------------------------------------------
% 图3.9
% 图3.8
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure39}
\caption{此处为图片的描述...多个互译的句对}
\label{figureC3.9}
\input{./Chapter3/Figures/figure-two-zh-en-sentences}
\caption{两个汉英互译的句对}
\label{fig:two-zh-en-sentences}
\end{figure}
%---------------------------
\noindent\hspace{2em}如公式\ref{eqC3.6}所示,表示的是词对“翻译”和“translation”基于上述双语句对计算得到的单词翻译概率。分子是两个句对的“翻译”和“translation”共现次数的累计,分母是两个句对的源语词和目标语词的组合数的累加。
{\footnotesize
\begin{equation}
\begin{split}
{\textrm{P}(\textrm{'翻译'},\textrm{'translation'})}&={\frac{c(\textrm{'翻译'},\textrm{'translation'};s^{1},t^{1})+c(\textrm{'翻译'},\textrm{'translation'};s^{2},t^{2})}{\sum_{x',y'} c(x',y';s^{1},t^{1}) + \sum_{x',y'} c(x',y';s^{2},t^{2})}}\\
&={{\frac{4 + 1}{|s^{1}| \times |t^{1}| + |s^{2}| \times |t^{2}|} = \frac{4 + 1}{9 \times 7 + 5 \times 7} = \frac{5}{102}}}
\parinterval 举个例子来说明在多个句子上计算单词翻译概率的方法。图\ref{fig:two-zh-en-sentences}展示了一个由两个句对构成的平行语料库。我们用$s^1$$s^2$分别表示第一个句对和第二个句对的源语句子,$t^1$$t^2$表示对应的目标语句子。于是,“翻译”和“translation”的翻译概率的计算过程如下,
{\small
\begin{eqnarray}
{\textrm{P}(\textrm{``翻译''},\textrm{``translation''})} & = & {\frac{c(\textrm{``翻译''},\textrm{``translation''};s^{1},t^{1})+c(\textrm{``翻译''},\textrm{``translation''};s^{2},t^{2})}{\sum_{x',y'} c(x',y';s^{1},t^{1}) + \sum_{x',y'} c(x',y';s^{2},t^{2})}} \nonumber \\
& = & \frac{4 + 1}{|s^{1}| \times |t^{1}| + |s^{2}| \times |t^{2}|} \nonumber \\
& = & \frac{4 + 1}{9 \times 7 + 5 \times 7} \nonumber \\
& = & \frac{5}{102}
\label{eqC3.6}
\end{split}
\end{equation}
\end{eqnarray}
}
公式\ref{eqC3.6}所展示的计算过程很简单。分子是两个句对中``翻译''和``translation''共现次数的累计,分母是两个句对的源语词和目标语词的组合数的累加。显然,这个方法也很容易推广到处理更多句子的情况中,我们仅需要对每个句子的计数进行累加即可。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{句子级翻译模型}\index{Chapter3.2.4}
\noindent\hspace{2em}本节介绍如何获取句子级翻译概率。如图\ref{figureC3.10}所示,我们用条件概率$\textrm{P}(t|s)$表示句子级翻译模型,它表示给定源语句$s$时,目标语句$t$的概率或者可能性。下面展开详细的描述
\parinterval 在获得单词翻译概率的基础上,本节继续介绍如何获取句子级翻译概率。如图\ref{fig:role-of-P(t|s)-in-sentence-level-translation}所示,条件概率$\textrm{P}(t|s)$表示给出源语言句子$s$的情况下译文为$t$的概率。这也是整个句子级翻译模型的核心,它处于整个统计机器翻译流程的中心,一方面我们需要从数据中学习这个模型的参数,另一方面,对于新输入的句子,我们需要使用这个模型得到最佳的译文。下面介绍句子级翻译的建模方法
%----------------------------------------------
% 图3.10
% 图3.9
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure310}
\caption{此处为图片的描述...句子级翻译模型就是翻译模型$\textrm{P}(t|s)$}
\label{figureC3.10}
\input{./Chapter3/Figures/figurerole-of-P-in-sentence-level-translation}
\caption{$\textrm{P}(t|s)$在句子级翻译中的作用}
\label{fig:role-of-P(t|s)-in-sentence-level-translation}
\end{figure}
%---------------------------
\noindent\textbf{初级句子级翻译模型}\index{Chapter3.2.4.1}
\subsubsection{(一)句子级翻译的基础模型}\index{Chapter3.2.4.1}
\noindent\hspace{2em}直接定义句子级翻译概率并不容易。一个退而求其次的方法是:找到一个函数$g(s,t)$来衡量翻译结果的质量。它描述了这样一个事:当翻译结果$t$的质量越好,则它的值越大;当$t$的翻译质量越差,则它的值越小。换句话说,$g(s,t)$的单调性和翻译质量呈正相关。假如我们已经找到了一个这样的函数$g(s,t)$,就能够间接地定义句子级翻译概率,如公式\ref{eqC3.7}所示。
\parinterval 计算句子级翻译概率并不容易。因为自然语言句子非常灵活,任何数据无法覆盖足够多的句子,因此也我们无法像公式\ref{eqC3.5}一样直接用简单计数的方式对句子的翻译概率进行估计。这里,我们采用一个退而求其次的方法:找到一个函数$g(s,t)$来衡量翻译结果的质量。我们假设:$g(s,t) \ge 0$翻译结果$t$的质量越好,$g(s,t)$的值越大;$t$的翻译质量越差,$g(s,t)$的值越小。换句话说,$g(s,t)$的单调性和翻译质量呈正相关。如果存在这样的函数$g(s,t)$,可以利用$g(s,t)$近似表示句子级翻译概率,如下:
\begin{equation}
\textrm{P}(t|s) = \frac{g(s,t)}{\sum_{t}g(s,t)}
\textrm{P}(t|s) \approx \frac{g(s,t)}{\sum_{t'}g(s,t')}
\label{eqC3.7}
\end{equation}
\noindent\hspace{2em}公式\ref{eqC3.7}相当于在函数$g$上做了归一化,使其具有概率的意义。具体来说,我们枚举了源语句$s$的所有翻译结果$t$,并把所有$t$对应的函数$g$的计算结果相加作为分母,而分子是某个翻译结果$t$的函数$g$的值。
\parinterval 公式\ref{eqC3.7}相当于在函数$g$上做了归一化,这样等式右端的结果具有一些概率的属性,比如,$0 \le \frac{g(s,t)}{\sum_{t}g(s,t)} \le 1$。具体来说,对于源语句枚举其所有的翻译结果,并把这些翻译结果所对应的函数$g(\cdot)$的计算结果相加作为分母,而分子是某个翻译结果$t$所对应的$g(\cdot)$的值。
\parinterval 上述过程初步建立了句子级翻译模型,我们并没有求句子翻译概率的值,而是把问题转为对$g(\cdot)$的设计和计算上。但是,面临着两个新的问题:
\vspace{0.5em}
\begin{itemize}
\item 如何定义函数$g(s,t)$定义?即,在知道单词翻译概率的前提下,如何计算$g(s,t)$
\vspace{0.5em}
\item 公式\ref{eqC3.7}中分母$\sum_{t}g(s,t')$需要累加所有翻译结果所对应函数$g(s,t')$的计算结果,但枚举所有$t'$是不可能的。
\end{itemize}
\vspace{0.5em}
\noindent\hspace{2em}上述过程初步建立了句子级翻译模型,但发现一些问题不好解决。我们主要面临两个问题,第一、函数$g(s,t)$怎么定义。即给定单词翻译概率,如何求句子级互译概率。第二、公式\ref{eqC3.7}中分母的计算需要累加所有翻译结果$t$的函数$g$的计算结果,但求解所有$t$几乎是不可能。实际上最核心的问题还是函数$g(s,t)$的定义或计算。而第二个问题其实不需要解决,这是因为我们通常只关注于可能性最大的翻译结果,即$g(s,t)$的计算结果最大时对应译文
\noindent 当然,最核心的问题还是函数$g(s,t)$的定义。而第二个问题其实不需要解决,因为我们通常只关注于可能性最大的翻译结果,即$g(s,t)$的计算结果最大时对应译文。这个问题会在随后进行讨论
\noindent\hspace{2em}因此如何定义$g(s,t)$成为关键。换句话说,如何表示两个词串之间的对应关系呢?这里我们使用的一个基础思想是大题小做。具体来说,直接表示句子之间的对应太困难了,但可以利用词之间的对应来描述句子之间的对应。这里就用到了上一小节的单词翻译概率。
\parinterval 回到设计$g(s,t)$的问题上。这里,我们采用``大题小作''的方法,这个技巧在第二章已经进行了充分的介绍。具体来说,直接建模句子之间的对应比较困难,但可以利用词之间的对应来描述句子之间的对应关系。这里,就用到了上一小节所介绍的单词翻译概率。
\noindent\hspace{2em}我们首先引入一个非常重要的概率—词对齐,它是统计机器翻译中最基本的概念之一。词对齐描述了句子间的对应,它指出本质上句子之间的对应是由词之间的对应表示的。如图\ref{figureC3.11}所示,$s$$t$分别表源语句和目标语句,单词的右下标表示的是该词在句中的位置,而虚线描述的是句子$s$$t$中的词对齐关系。比如“满意”的右下表“5”表示该词在句子$s$中处于第5个位置,“satisfied”的右下表“3”表示在句子$t$中处于第3个位置,并且“满意”和“satisfied”用虚线连接来表示对应。为方便描述,我们用二元组$(j,i)$来描述词对齐,它表示源语句第$j$个单词对应目标语句第$i$个单词,即单词$s_j$$t_i$对应。图\ref{figureC3.11}中共有5条虚线,表示有5组单词之间的对应。我们把它们构成集合称为$A$,并按如下方式记录下所有的对齐链接,即$A={(1,1),(2,4),(3,5),(4,2)(5,3)}$
\parinterval 我们首先引入一个非常重要的概念\ \ \textbf{词对齐},它是统计机器翻译中最基本的概念之一。词对齐描述了并行句对中单词之间的对应关系,它体现了一种观点:本质上句子之间的对应是由词之间的对应表示的。当然,这个观点在神经机器翻译或者其它模型中可能会有不同的理解,但是翻译句子的过程中我们考虑词一级的对应关系是符合我们对语言的认知的。图\ref{figureC3.11}展示了一个句对$s$$t$,单词的右下标数字表示了该词在句中的位置,而虚线表示的是句子$s$$t$中的词对齐关系。比如,``满意''的右下标数字5表示在句子$s$中处于第5个位置,``satisfied''的右下标数字3表示在句子$t$中处于第3个位置,``满意''和``satisfied''之间的虚线表示两个单词之间是对齐的。为方便描述,我们用二元组$(j,i)$来描述词对齐,它表示源语句第$j$个单词对应目标语句第$i$个单词,即单词$s_j$$t_i$对应。通常,也会把$(j,i)$称作一条词对齐连接。图\ref{figureC3.11}中共有5条虚线,表示有5组单词之间的词对齐连接。我们把这些词对齐连接构成的集合称为$A$,即$A={\{(1,1),(2,4),(3,5),(4,2)(5,3)}\}$
%----------------------------------------------
% 图3.11
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure311}
\caption{此处为图片的描述...蓝色的虚线表示的是对齐关系(词对齐}
\caption{汉英互译句对及词对齐连接(蓝色虚线}
\label{figureC3.11}
\end{figure}
%---------------------------
\noindent\hspace{2em}当给定一个源语和目标语的句对$(s,t)$,以及它们的最优词对齐$\widehat{A}$,可以使用单词翻译概率计算$g(s,t)$,如公式\ref{eqC3.8}所示。其中$g(s,t)$被定义为句子$s$中的单词和句子$t$中的单词的翻译概率的乘积,并且这两个单词必须对齐或具有对齐链接。$\textrm{P}(s_j,t_i)$表示具有对齐链接的源语词$s_j$和目标语词$t_i$的单词翻译概率。
\parinterval 对于源语和目标语的句对$(s,t)$,假设我们可以得到最优词对齐$\widehat{A}$,于是可以使用单词翻译概率计算$g(s,t)$,如下
\begin{equation}
g(s,t) = \prod_{(j,i)\in \widehat{A}}\textrm{P}(s_j,t_i)
\label{eqC3.8}
\end{equation}
\noindent\hspace{2em}用图\ref{figureC3.11}表示的句对$(s,t)$进行举例。其中“我”与“I”、“对”与“with”、“你”与“you”\\等相互对应,它们的翻译概率相乘就是$g(s,t)$的计算结果。如公式\ref{eqC3.9}所示。显然如果每个单词的翻译概率都高,那么整句的模型得分也高。
\begin{equation}
\begin{split}
{g(s,t)}&={ \textrm{P}(\textrm{'我','I'}) \times \textrm{P}(\textrm{'对','with'}) \times \textrm{P}(\textrm{'你','you'}) \times}\\
&{\textrm{P}(\textrm{'感到','am'}) \times \textrm{P}(\textrm{'满意','satisfied'})}
\noindent其中$g(s,t)$被定义为句子$s$中的单词和句子$t$中的单词的翻译概率的乘积,并且这两个单词之间必须有对齐连接。$\textrm{P}(s_j,t_i)$表示具有对齐链接的源语词$s_j$和目标语词$t_i$的单词翻译概率。以图\ref{figureC3.11}中的句对为例,其中``我''与``I''、``对''与``with''、``你''与``you''\\等相互对应,可以把它们的翻译概率相乘得到$g(s,t)$的计算结果,如下:
\begin{eqnarray}
{g(s,t)}&= & \textrm{P}(\textrm{``我'',``I''}) \times \textrm{P}(\textrm{``对'',``with''}) \times \textrm{P}(\textrm{``你'',``you''}) \times \nonumber \\
& & \textrm{P}(\textrm{``感到'', ``am''}) \times \textrm{P}(\textrm{``满意'',``satisfied''})
\label{eqC3.9}
\end{split}
\end{equation}
\textbf{语言模型加强的句子翻译概率}\index{Chapter3.2.4.2}
\end{eqnarray}
\noindent 显然,如果每个词对齐连接所对应的翻译概率变大,那么整个句子翻译的得分也会提高。也就是说,词对齐越准确,翻译模型的打分越高,$s$$t$之间存在翻译关系的可能性越大。
\noindent\hspace{2em}公式\ref{eqC3.8}定义的$g(s,t)$存在的问题是没有考虑词序信息。我们用一个简单的例子说明这个问题。如图\ref{figureC3.12}所示,表示源语句“我 对 你 感到 满意”的两个翻译结果,第一个翻译结果是“I am satisfied with you”,第二个是“I with you am satisfied”。虽然它们选择的目标语单词是一样的,但词序存在很大差异。比如它们都选择“satisfied”作为源语单词“满意”的译文,但是在第一个翻译结果中处于第3个位置,而第二个中处于最后的位置。显然第一个翻译结果更符合英文的表达习惯,翻译的质量更高。但是当用公式\ref{eqC3.8}计算得到的函数$g$的值却是一样的。
\subsubsection{语言模型加强的句子翻译概率}\index{Chapter3.2.4.2}
\parinterval 公式\ref{eqC3.8}定义的$g(s,t)$存在的问题是没有考虑词序信息。我们用一个简单的例子说明这个问题。如图\ref{figureC3.12}所示,源语句``我 对 你 感到 满意''有两个翻译结果,第一个翻译结果是``I am satisfied with you'',第二个是``I with you am satisfied''。虽然这两个译文包含的目标语单词是一样的,但词序存在很大差异。比如,它们都选择了``satisfied''作为源语单词``满意''的译文,但是在第一个翻译结果中``satisfied''处于第3个位置,而第二个结果中处于最后的位置。显然第一个翻译结果更符合英文的表达习惯,翻译的质量更高。可遗憾的,对于有明显差异的两个译文,公式\ref{eqC3.8}计算得到的函数$g(\cdot)$的值却是一样的。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------
% 图3.12
\begin{figure}[htp]
......@@ -268,56 +333,37 @@ g(s,t) = \prod_{(j,i)\in \widehat{A}}\textrm{P}(s_j,t_i)
\end{figure}
%---------------------------
\noindent\hspace{2em}如何在$g(s,t)$引入词序信息呢?我们希望函数$g(s,t)$对符合自然语言表达习惯的翻译结果给更高的分数,对于不合符的或不通顺的句子给更低的分数。因此我们引入一种常用于衡量句子流畅度的方法—$n$元文法(n-gram)语言模型
\parinterval 如何在$g(s,t)$引入词序信息呢?我们希望函数$g(s,t)$对符合自然语言表达习惯的翻译结果给出更高的分数,对于不合符的或不通顺的句子给出更低的分数。这里很自然想到使用语言模型,因为语言模型可以度量一个句子出现的可能性,流畅的句子语言模型得分越高,反之越低
\noindent\hspace{2em}$n$元文法语言模型是统计机器翻译中非常重要的特征。它用概率化模型描述了句子的流畅度。概率越高表示句子的流畅度越高,越贴近于人的表达习惯。概率越低表示句子越不符合人的表达。一个常用的$n$元文法(unigram)语言模型的定义见公式\ref{eqC3.10}$\textrm{P}_{lm}(t)$表示语言模型给句子$t$的打分,其中$t$依次由单词$t_1t_2...t_m$组成。具体而言,$\textrm{P}_{lm}(t)$被定义为$\textrm{P}(t_i|t_{i-1})(i=1,2,...,m)$的连乘,其中$\textrm{P}(t_i|t_{i-1})(i=1,2,...,m)$表示当前一个单词是$t_{i-1}$时,当前单词是$t_i$的概率。
\begin{equation}
\textrm{P}_{lm}(t)=\textrm{P}_{lm}(t_1...t_m)=\textrm{P}(t_1)\times \textrm{P}(t_2|t_1)\times \textrm{P}(t_3|t_2)\times ... \times \textrm{P}(t_m|t_{m-1})
\label{eqC3.10}
\end{equation}
\parinterval 我们可以使用第二章介绍的$n$-gram语言模型,它也是统计机器翻译中确保流畅翻译结果的重要模型之一。$n$-gram语言模型用概率化方法描述了句子的生成过程。以2-gram语言模型为例,可以使用如下公式计算一个词串的概率:
\noindent\hspace{2em}概率$\textrm{P}(t_i|t_{i-1})(i=1,2,...,m)$也是从大规模的单语数据中统计得到的,它的计算如公式\ref{eqC3.11}所示。其中$c(t_i,t_{i-1})$表示单词$t_{i-1}$$t_i$在单语语料中依次连续出现的次数,而$c(t',t_{i-1})$表示$t_{i-1}$和任意单词$t'$在语料中依次连续出现的次数,它们相除就表示$\textrm{P}(t_i|t_{i-1})$
\begin{equation}
\textrm{P}(t_i|t_{i-1})=\frac{c(t_i|t_{i-1})}{c(t'|t_{i-1})}
\label{eqC3.11}
\end{equation}
\noindent\hspace{2em}举个例子说明。如图\ref{figureC3.13}所示,表示的是4个英文句子$t^1\textrm{}t^2\textrm{}t^3$$t^4$。其中<s>\\和</s>也是单词,用于标识句子的开头和结尾。我们将从这4个句子中估计 ,即“machine”后面是“translation”的概率。
%----------------------------------------------
% 图3.13
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure313}
\caption{此处为图片的描述...}
\label{figureC3.13}
\end{figure}
%---------------------------
\noindent\hspace{2em}如公式\ref{eqC3.12}所示。分母是“machine”后面跟任意单词的次数,在4个句子中各出现一个。分子是“machine”后面跟“translation”的次数,仅在第一个句子中出现一次。因此$\textrm{P}('translation'|'machine')$等于$1/4$。当单语语料的规模更大时,我们得到的计算结果将越来越准确。
\begin{equation}
\textrm{P}('translation'|'machine')=\frac{1}{1+1+1+1}=\frac{1}{4}
\label{eqC3.12}
\end{equation}
\begin{eqnarray}
\textrm{P}_{lm}(t) & = & \textrm{P}_{lm}(t_1...t_m) \nonumber \\
& = & \textrm{P}(t_1)\times \textrm{P}(t_2|t_1)\times \textrm{P}(t_3|t_2)\times ... \times \textrm{P}(t_m|t_{m-1})
\label{eqC3.10}
\end{eqnarray}
\noindent\hspace{2em}语言模型$\textrm{P}_{lm}{(t)}$概率化地描述了目标语句的流畅度,这里将不再对语言模型做过多的介绍,而将重点放在句子级翻译模型的构建
\noindent 其中,$t=t_1...t_m$表示由$m$个单词组成的句子,$\textrm{P}_{lm}(t)$表示语言模型给句子$t$的打分。具体而言,$\textrm{P}_{lm}(t)$被定义为$\textrm{P}(t_i|t_{i-1})(i=1,2,...,m)$的连乘\footnote{为了确保数学表达的准确性,我们定义$\textrm{P}(t_1|t_0) \equiv \textrm{P}(t_1)$},其中$\textrm{P}(t_i|t_{i-1})(i=1,2,...,m)$表示前面一个单词是$t_{i-1}$时,当前单词是$t_i$的概率。语言模型的训练方法可以参看第二章相关内容,这里将不再对语言模型做过多的介绍
\noindent\hspace{2em}如果我们将语言模型$\textrm{P}_{lm}{(t)}$和公式\ref{eqC3.8}表示$g(s,t)$相乘,就得到了一个考虑词序信息的$g(s,t)$。如公式\ref{eqC3.13}所示。但这样做能否筛选出词序正确的翻译结果呢?
\parinterval 回到翻译问题的建模问题上来。我们已经又了语言模型可以帮助系统度量衡每个译文的流畅度,因此可以把它加入模型打分中。一种简单的方法是把语言模型$\textrm{P}_{lm}{(t)}$和公式\ref{eqC3.8}中的$g(s,t)$相乘,这样就得到了一个新的$g(s,t)$,它同时考虑了翻译准确性($\prod_{j,i \in \widehat{A}}{\textrm{P}(s_j,t_i)}$)和流畅度($\textrm{P}_{lm}(t)$):
\begin{equation}
g(s,t) \equiv \prod_{j,i \in \widehat{A}}{\textrm{P}(s_j,t_i) \times \textrm{P}_{lm}(t)}
g(s,t) \equiv \prod_{j,i \in \widehat{A}}{\textrm{P}(s_j,t_i)} \times \textrm{P}_{lm}(t)
\label{eqC3.13}
\end{equation}
\noindent\hspace{2em}如图\ref{figureC3.14}所示,语言模型$\textrm{P}_{lm}(t)$给分别$t^{'}$$t^{''}$赋予0.0107和0.0009的概率,这表明句子$t^{'}$更符合英文的表达。这与我们的观察相吻合。当再分别乘以$\prod_{j,i \in \widehat{A}}{\textrm{P}(s_j,t_i)}$\\的值,就得到公式\ref{eqC3.13}定义的函数$g$的值。显然句子$t^{'}$的分数更高。同时它也是我们希望得到的翻译结果。至此我们完成了对函数$g(s,t)$的定义,当代入公式\ref{eqC3.7}就得到了考虑词序的句子级翻译模型。
\parinterval 如图\ref{figureC3.14}所示,语言模型$\textrm{P}_{lm}(t)$给分别$t^{'}$$t^{''}$赋予0.0107和0.0009的概率,这表明句子$t^{'}$更符合英文的表达。这与我们的期望是相吻合的。它们再分别乘以$\prod_{j,i \in \widehat{A}}{\textrm{P}(s_j,t_i)}$的值,就得到公式\ref{eqC3.13}定义的函数$g(\cdot)$的值。显然句子$t^{'}$的分数更高。同时它也是我们希望得到的翻译结果。至此,我们完成了对函数$g(s,t)$的一个简单定义,把它带入公式\ref{eqC3.7}就得到了同时考虑准确性和流畅性的句子级统计翻译模型。
%----------------------------------------------
% 图3.14
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure314}
\caption{此处为图片的描述...}
\caption{不同译文的语言模型得分和翻译模型得分}
\label{figureC3.14}
\end{figure}
%---------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{解码}\index{Chapter3.2.5}
\noindent\hspace{2em}当我们得到句子级翻译模型后,做的一件事就是对于输入模型的任意句子翻译为对应的目标语译文,这个过程称为解码。具体地说,当给定任意的源语句$s$,找到翻译概率最大的目标语译文$\widehat{t}$。如公式\ref{eqC3.14}所示。这里$\emph{argmax}_t{\textrm{P}(t|s)}$表示找到使$\textrm{P}(t|s)$达到最大时的$t$进行输出。换句话说,我们想找到这样一个$t$,它使得$\textrm{P}(t|s)$的计算结果最大。
......@@ -357,13 +403,24 @@ g(s,t) \equiv \prod_{j,i \in \widehat{A}}{\textrm{P}(s_j,t_i) \times \textrm{P}
\noindent\hspace{2em}$n^{m}\bullet m!$是什么样的概念呢?当$m$$n$分别为2和10时,译文可能有200个,这个计算量并不大。但是当$m$$n$分别为20和10时,即源语句的词数20,每个词有10个候选译文。此时约有$2.4329 \times 10^{38}$个候选翻译,这几乎是不可计算的。这说明潜在翻译结果的非常多,几乎无法枚举,因此我们需要高效的搜索算法找到理想的解。
%----------------------------------------------
% 图3.16
\begin{figure}[htp]
\centering
\input{./Chapter3/Figures/figure316}
\caption{此处为图片的描述...}
\label{figureC3.16}
\end{figure}
% 表3.1
\begin{table}[h]
\centering
\begin{tabular}{l | l | l}
\toprule
$m$ & $n$ & $n^m \cdot m!$\\
\midrule
1 & 1 & 1 \\
1 & 10 & 10 \\
2 & 10 & 200 \\
10 & 10 & 36288000000000000 \\
20 & 10 & 2.43290200817664 $\times 10^{38}$ \\
20 & 30 & 8.48300477127188 $\times 10^{47}$ \\
\bottomrule
\end{tabular}
\caption{}
\label{}
\end{table}
%---------------------------
\noindent\hspace{2em}这里介绍一种贪婪的解码算法,它并不从整体最优考虑译文的生成。换句话说,贪婪算法不枚举所有可能的译文,而是每步选择一个源语言单词,利用它的翻译候选扩展译文,并只保留当前步“最好”的结果,直到所有源语言的单词都被翻译。
......@@ -816,13 +873,12 @@ g(s,t) \equiv \prod_{j,i \in \widehat{A}}{\textrm{P}(s_j,t_i) \times \textrm{P}
\noindent\hspace{2em}如何解决带约束的目标函数优化问题呢?这里用到了拉格朗日乘数法。在百度百科中关于它的定义如下所示。简单地说,拉格朗日乘数法解决了把含有约束的优化问题转换为了不含约束的优化问题。
%----------------------------------------------
% 图3.37
\begin{figure}[htp]
% \centering
\includegraphics{./Chapter3/Figures/figure1.png}
\caption{拉格朗日乘数法}
\label{figureC3.37}
\end{figure}
% 定义3.1
\begin{definition}[拉格朗日乘数法]
百度百科
{\color{red}拉格朗日乘数法}是一种寻找变量受一个或多个条件所限制的多元函数的极值的方法。这种方法将一个有$n$个变量与$k$个约束条件的最优化问题转换为一个有$n\sum k$个变量的方程组的极值问题,其变量不受任何约束。这种方法引入了一种新的标量未知数,即拉格朗日乘数
\end{definition}
%-------------------------------------------
\noindent\hspace{2em}这里我们的目标是$max(\textrm{P}_{\theta}(s|t))$,约束是对于任意的$\forall{t_y}$,都有$\sum_{s_x}{\textrm{P}(s_x|t_y)}=1$。根据拉格朗日乘数法,我们可以把上述优化问题重新定义如下。
......
......@@ -6,10 +6,10 @@
\begin{scope}
\node [anchor=west] (s1) at (0,0) {\textbf{}};
\node [anchor=west] (s2) at ([xshift=2em]s1.east) {\textbf{}};
\node [anchor=west] (s3) at ([xshift=2em]s2.east) {\textbf{}};
\node [anchor=west] (s4) at ([xshift=2em]s3.east) {\textbf{表示ʾ}};
\node [anchor=west] (s5) at ([xshift=2em]s4.east) {\textbf{满意}};
\node [anchor=west] (s2) at ([xshift=3em]s1.east) {\textbf{}};
\node [anchor=west] (s3) at ([xshift=3em]s2.east) {\textbf{}};
\node [anchor=west] (s4) at ([xshift=3em]s3.east) {\textbf{表示ʾ}};
\node [anchor=west] (s5) at ([xshift=3em]s4.east) {\textbf{满意}};
\node [anchor=south west] (sentlabel) at ([yshift=-0.5em]s1.north west) {\scriptsize{\textbf{\color{red}{待翻译句子(已经分词):}}}};
{
......@@ -21,15 +21,15 @@
{\small
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t11) at ([yshift=-1em]s1.south) {I};
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t12) at ([yshift=-0.2em]t11.south) {me};
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t13) at ([yshift=-0.2em]t12.south) {I'm};
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t12) at ([yshift=-0.8em]t11.south) {me};
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t13) at ([yshift=-0.8em]t12.south) {I'm};
\node [anchor=north west,inner sep=1pt,fill=black] (tl11) at (t11.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl12) at (t12.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl13) at (t13.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t21) at ([yshift=-1em]s2.south) {to};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t22) at ([yshift=-0.2em]t21.south) {with};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t23) at ([yshift=-0.2em]t22.south) {for};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t22) at ([yshift=-0.8em]t21.south) {with};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t23) at ([yshift=-0.8em]t22.south) {for};
\node [anchor=north west,inner sep=1pt,fill=black] (tl21) at (t21.north west) {\tiny{{\color{white} \textbf{2}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl22) at (t22.north west) {\tiny{{\color{white} \textbf{2}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl23) at (t23.north west) {\tiny{{\color{white} \textbf{2}}}};
......@@ -38,13 +38,13 @@
\node [anchor=north west,inner sep=1pt,fill=black] (tl31) at (t31.north west) {\tiny{{\color{white} \textbf{3}}}};
\node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3em] (t41) at ([yshift=-1em]s4.south) {$\phi$};
\node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3em] (t42) at ([yshift=-0.2em]t41.south) {show};
\node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3em] (t42) at ([yshift=-0.8em]t41.south) {show};
\node [anchor=north west,inner sep=1pt,fill=black] (tl41) at (t41.north west) {\tiny{{\color{white} \textbf{4}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl42) at (t42.north west) {\tiny{{\color{white} \textbf{4}}}};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t51) at ([yshift=-1em]s5.south) {satisfy};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t52) at ([yshift=-0.2em]t51.south) {satisfied};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t53) at ([yshift=-0.2em]t52.south) {satisfies};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t52) at ([yshift=-0.8em]t51.south) {satisfied};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t53) at ([yshift=-0.8em]t52.south) {satisfies};
\node [anchor=north west,inner sep=1pt,fill=black] (tl51) at (t51.north west) {\tiny{{\color{white} \textbf{5}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl52) at (t52.north west) {\tiny{{\color{white} \textbf{5}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl53) at (t53.north west) {\tiny{{\color{white} \textbf{5}}}};
......@@ -57,9 +57,9 @@
{
\node [anchor=west,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (ft11) at ([yshift=-1.2in]t11.west) {I'm};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft12) at ([xshift=5.0em]ft11.center) {satisfied};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft13) at ([xshift=5.0em]ft12.center) {with};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft14) at ([xshift=4.0em]ft13.center) {you};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft12) at ([xshift=6.0em]ft11.center) {satisfied};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft13) at ([xshift=6.0em]ft12.center) {with};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft14) at ([xshift=5.0em]ft13.center) {you};
}
{
......
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
\node [anchor=west] (s1) at (0,0) {\textbf{}};
\node [anchor=west] (s2) at ([xshift=2em]s1.east) {\textbf{}};
\node [anchor=west] (s3) at ([xshift=2em]s2.east) {\textbf{}};
\node [anchor=west] (s4) at ([xshift=2em]s3.east) {\textbf{表示}};
\node [anchor=west] (s5) at ([xshift=2em]s4.east) {\textbf{满意}};
\node [anchor=west] (s2) at ([xshift=3em]s1.east) {\textbf{}};
\node [anchor=west] (s3) at ([xshift=3em]s2.east) {\textbf{}};
\node [anchor=west] (s4) at ([xshift=3em]s3.east) {\textbf{表示}};
\node [anchor=west] (s5) at ([xshift=3em]s4.east) {\textbf{满意}};
\node [anchor=south west] (sentlabel) at ([yshift=-0.5em]s1.north west) {\scriptsize{\textbf{\color{red}{待翻译句子(已经分词):}}}};
......@@ -23,15 +18,15 @@
{\small
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t11) at ([yshift=-1em]s1.south) {I};
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t12) at ([yshift=-0.2em]t11.south) {me};
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t13) at ([yshift=-0.2em]t12.south) {I'm};
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t12) at ([yshift=-0.8em]t11.south) {me};
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t13) at ([yshift=-0.8em]t12.south) {I'm};
\node [anchor=north west,inner sep=1pt,fill=black] (tl11) at (t11.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl12) at (t12.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl13) at (t13.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t21) at ([yshift=-1em]s2.south) {to};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t22) at ([yshift=-0.2em]t21.south) {with};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t23) at ([yshift=-0.2em]t22.south) {for};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t22) at ([yshift=-0.8em]t21.south) {with};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t23) at ([yshift=-0.8em]t22.south) {for};
\node [anchor=north west,inner sep=1pt,fill=black] (tl21) at (t21.north west) {\tiny{{\color{white} \textbf{2}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl22) at (t22.north west) {\tiny{{\color{white} \textbf{2}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl23) at (t23.north west) {\tiny{{\color{white} \textbf{2}}}};
......@@ -40,13 +35,13 @@
\node [anchor=north west,inner sep=1pt,fill=black] (tl31) at (t31.north west) {\tiny{{\color{white} \textbf{3}}}};
\node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3em] (t41) at ([yshift=-1em]s4.south) {$\phi$};
\node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3em] (t42) at ([yshift=-0.2em]t41.south) {show};
\node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3em] (t42) at ([yshift=-0.8em]t41.south) {show};
\node [anchor=north west,inner sep=1pt,fill=black] (tl41) at (t41.north west) {\tiny{{\color{white} \textbf{4}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl42) at (t42.north west) {\tiny{{\color{white} \textbf{4}}}};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t51) at ([yshift=-1em]s5.south) {satisfy};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t52) at ([yshift=-0.2em]t51.south) {satisfied};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t53) at ([yshift=-0.2em]t52.south) {satisfies};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t52) at ([yshift=-0.8em]t51.south) {satisfied};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t53) at ([yshift=-0.8em]t52.south) {satisfies};
\node [anchor=north west,inner sep=1pt,fill=black] (tl51) at (t51.north west) {\tiny{{\color{white} \textbf{5}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl52) at (t52.north west) {\tiny{{\color{white} \textbf{5}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl53) at (t53.north west) {\tiny{{\color{white} \textbf{5}}}};
......@@ -81,23 +76,23 @@
\begin{scope}
{\small
\node [anchor=west,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (ft11) at ([yshift=-1.2in]t11.west) {I'm};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft12) at ([xshift=5.0em]ft11.center) {satisfied};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft13) at ([xshift=5.0em]ft12.center) {with};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft14) at ([xshift=4.0em]ft13.center) {you};
\node [anchor=west,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (ft11) at ([yshift=-1.4in]t11.west) {I'm};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft12) at ([xshift=6.0em]ft11.center) {satisfied};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft13) at ([xshift=6.0em]ft12.center) {with};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft14) at ([xshift=5.0em]ft13.center) {you};
{
\node [anchor=west,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (ft21) at ([yshift=-2em]ft11.west) {I'm};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft22) at ([xshift=5.0em]ft21.center) {satisfy};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft23) at ([xshift=5.0em]ft22.center) {to};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft24) at ([xshift=4.0em]ft23.center) {you};
\node [anchor=west,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (ft21) at ([yshift=-3em]ft11.west) {I'm};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft22) at ([xshift=6.0em]ft21.center) {satisfy};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft23) at ([xshift=6.0em]ft22.center) {to};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft24) at ([xshift=5.0em]ft23.center) {you};
}
{
\node [anchor=west,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (ft31) at ([yshift=-2em]ft21.west) {I'm};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft32) at ([xshift=5.0em]ft31.center) {satisfy};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft33) at ([xshift=5.0em]ft32.center) {you};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft34) at ([xshift=4.0em]ft33.center) {to};
\node [anchor=west,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (ft31) at ([yshift=-3em]ft21.west) {I'm};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft32) at ([xshift=6.0em]ft31.center) {satisfy};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft33) at ([xshift=6.0em]ft32.center) {you};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft34) at ([xshift=5.0em]ft33.center) {to};
}
\node [anchor=north west,inner sep=1pt,fill=black] (ftl11) at (ft11.north west) {\tiny{{\color{white} \textbf{1}}}};
......@@ -162,28 +157,45 @@
\end{scope}
\begin{scope}
{
\node [anchor=east] (label4) at ([yshift=0.4em]ft11.west) {\scriptsize{翻译就是一条}};
\node [anchor=north west] (label4part2) at ([yshift=0.7em]label4.south west) {\scriptsize{译文选择路径}};
{\small
\node [anchor=east] (label4) at ([yshift=0.8em]ft11.west) {翻译就是一条};
\node [anchor=north west] (label4part2) at ([yshift=0.7em]label4.south west) {译文选择路径};
}
{
\node [anchor=east] (label5) at ([yshift=0.4em]ft21.west) {\scriptsize{不同的译文对}};
\node [anchor=north west] (label5part2) at ([yshift=0.7em]label5.south west) {\scriptsize{应不同的路径}};
{\small
\node [anchor=east] (label5) at ([yshift=0.4em]ft21.west) {不同的译文对};
\node [anchor=north west] (label5part2) at ([yshift=0.7em]label5.south west) {应不同的路径};
}
{
\node [anchor=east] (label6) at ([yshift=0.4em]ft31.west) {\scriptsize{单词翻译的词}};
\node [anchor=north west] (label6part2) at ([yshift=0.7em]label6.south west) {\scriptsize{序也可能不同}};
{\small
\node [anchor=east] (label6) at ([yshift=0.4em]ft31.west) {单词翻译的词};
\node [anchor=north west] (label6part2) at ([yshift=0.7em]label6.south west) {序也可能不同};
}
{\small
\node [anchor=east] (label7) at ([yshift=0.4em]ft41.west) {可能的翻译路};
\node [anchor=north west] (label7part2) at ([yshift=0.7em]label7.south west) {径非常多};
}
\end{scope}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{scope}
{
\node [anchor=east] (label7) at ([yshift=0.4em]ft41.west) {\scriptsize{可能的翻译路}};
\node [anchor=north west] (label7part2) at ([yshift=0.7em]label7.south west) {\scriptsize{径非常多}};
\draw[decorate,thick,decoration={brace,amplitude=5pt}] ([yshift=8em,xshift=1.5em]t53.south east) -- ([xshift=1.5em]t53.south east) node [pos=0.5,right,xshift=0.5em,yshift=2.0em] (label2) {\footnotesize{\textbf{从双语数}}};
\node [anchor=north west] (label2part2) at ([yshift=0.3em]label2.south west) {\footnotesize{\textbf{据中自动}}};
\node [anchor=north west] (label2part3) at ([yshift=0.3em]label2part2.south west) {\footnotesize{\textbf{学习词典}}};
\node [anchor=north west] (label2part4) at ([yshift=0.3em]label2part3.south west) {\footnotesize{\textbf{(训练)}}};
}
{
\draw[decorate,thick,decoration={brace,amplitude=5pt}] ([yshift=-1.0em,xshift=5.7em]t53.south west) -- ([yshift=-10.5em,xshift=5.7em]t53.south west) node [pos=0.5,right,xshift=0.5em,yshift=2.0em] (label3) {\footnotesize{\textbf{利用概率}}};
\node [anchor=north west] (label3part2) at ([yshift=0.3em]label3.south west) {\footnotesize{\textbf{化的词典}}};
\node [anchor=north west] (label3part3) at ([yshift=0.3em]label3part2.south west) {\footnotesize{\textbf{进行翻译}}};
\node [anchor=north west] (label3part4) at ([yshift=0.3em]label3part3.south west) {\footnotesize{\textbf{(解码)}}};
}
\end{scope}
\begin{scope}
{
......@@ -204,15 +216,11 @@
\begin{scope}
{
\draw [->,ultra thick,ublue,line width=2pt,opacity=0.7] ([xshift=-0.5em]t13.west) -- ([xshift=0.8em]t13.east) -- ([xshift=-0.2em]t21.west) -- ([xshift=0.8em]t21.east) -- ([xshift=-0.2em]t31.west) -- ([xshift=0.8em]t31.east) -- ([xshift=-0.2em]t41.west) -- ([xshift=0.8em]t41.east) -- ([xshift=-0.2em]t51.west) -- ([xshift=1.2em]t51.east);
\draw [->,ultra thick,ublue,line width=2pt,opacity=0.7] ([xshift=-0.5em,yshift=-0.3em]t13.west) -- ([xshift=0.8em,yshift=-0.3em]t13.east) -- ([xshift=-0.2em,yshift=-0.3em]t21.west) -- ([xshift=0.8em,yshift=-0.3em]t21.east) -- ([xshift=-0.2em,yshift=-0.3em]t31.west) -- ([xshift=0.8em,yshift=-0.3em]t31.east) -- ([xshift=-0.2em,yshift=-0.3em]t41.west) -- ([xshift=0.8em,yshift=-0.3em]t41.east) -- ([xshift=-0.2em,yshift=-0.3em]t51.west) -- ([xshift=1.2em,yshift=-0.3em]t51.east);
}
\draw [->,ultra thick,red,line width=2pt,opacity=0.7] ([xshift=-0.5em]t13.west) -- ([xshift=0.8em]t13.east) -- ([xshift=-0.2em]t22.west) -- ([xshift=0.8em]t22.east) -- ([xshift=-0.2em]t31.west) -- ([xshift=0.8em]t31.east) -- ([xshift=-0.2em]t41.west) -- ([xshift=0.8em]t41.east) -- ([xshift=-0.2em]t52.west) -- ([xshift=1.2em]t52.east);
\draw [->,ultra thick,red,line width=2pt,opacity=0.7] ([xshift=-0.5em,yshift=-0.5em]t13.west) -- ([xshift=0.8em,yshift=-0.5em]t13.east) -- ([xshift=-0.2em,yshift=-0.5em]t22.west) -- ([xshift=0.8em,yshift=-0.5em]t22.east) -- ([xshift=-0.2em,yshift=-0.5em]t31.west) -- ([xshift=0.8em,yshift=-0.5em]t31.east) -- ([xshift=-0.2em,yshift=-0.5em]t41.west) -- ([xshift=0.8em,yshift=-0.5em]t41.east) -- ([xshift=-0.2em,yshift=-0.5em]t52.west) -- ([xshift=1.2em,yshift=-0.5em]t52.east);
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
\end{tikzpicture}
\ No newline at end of file
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
{
\node [anchor=north west,inner sep=1pt] (entry1) at (0,0) {{\textbf{1:} 这 是 数据 $\leftrightarrow$ This is data}};
\node [anchor=north west,inner sep=1pt] (entry2) at ([yshift=-0.5em]entry1.south west) {\textbf{2:} 小心 !$\leftrightarrow$ Look out !};
\node [anchor=north west,inner sep=1pt] (entry3) at ([yshift=-0.5em]entry2.south west) {\textbf{3:} 你 是 谁 $\leftrightarrow$ Who are you};
\node [anchor=north west,inner sep=2pt] (entry4) at ([yshift=-0.5em]entry3.south west) {...};
\node [anchor=south west,font=\Large] (corpuslabel) at (entry1.north west) {{\color{ublue} \textbf{双语平行数据}}};
\begin{pgfonlayer}{background}
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow,minimum height=1.6cm] [fit = (entry1) (entry2) (entry3) (entry4) (corpuslabel)] (corpus) {};
\end{pgfonlayer}
}
\node [anchor=west,ugreen] (P) at ([xshift=6em,yshift=-0.7em]corpus.east){P($t|s$)};
\node [anchor=south,font=\Large] (modellabel) at (P.north) {\color{ublue} \textbf{翻译模型}};
\begin{pgfonlayer}{background}
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow,minimum height=1.6cm] [fit = (P) (modellabel)] (model) {};
\end{pgfonlayer}
\draw [->,very thick,ublue] ([xshift=0.2em]corpus.east) -- ([xshift=4.2em]corpus.east) node [pos=0.5, above] {\color{red}{模型学习}};
{
\draw [->,very thick,ublue] ([xshift=11.2em]corpus.east) -- ([xshift=15.4em]corpus.east) node [pos=0.5, above] {\color{red}{穷举\&计算}};
{
\node [anchor=north west,inner sep=2pt,font=\Large] (sentlabel) at ([xshift=5.0em,yshift=0.4em]model.north east) {{\color{ublue} \textbf{机器翻译引擎}}};
\node [anchor=north west] (sent) at ([xshift=1.5em,yshift=-0.5em]sentlabel.south west) {对任意句子};
\node [anchor=north west] (sentpart2) at ([xshift=0.0em,yshift=0.3em]sent.south west) {进行翻译};
}
}
\begin{pgfonlayer}{background}
{
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow,minimum height=1.6cm] [fit = (sentlabel) (sent) (sentpart2)] (segsystem) {};
}
\end{pgfonlayer}
\end{tikzpicture}
%---------------------------------------------------------------------
......@@ -4,16 +4,16 @@
\begin{tikzpicture}
\begin{scope}
{
\node [pos=0.5,left,xshift=-0.5em,yshift=2.0em] (label2) {\footnotesize{\textbf{Input: a word pair (x, y) and a sentence pair (s, t)}}};
\node [anchor=north west] (label2part2) at ([yshift=0.3em]label2.south west) {\footnotesize{\textbf{Output: the number of (x, y) in the (s, t)}}};
\node [anchor=north west] (label2part3) at ([yshift=0.3em]label2part2.south west) {\footnotesize{{1:count $\leftarrow$ 0}}};
\node [anchor=north west] (label2part4) at ([yshift=0.3em]label2part3.south west) {\footnotesize{{2:\textbf{for} s\underline{\hbox to 0.1cm{}}word $\leftarrow$ $S_1$$S_length(s)$ \textbf{do} }}};
\node [anchor=north west] (label2part5)at ([yshift=0.3em]label2part4.south west) {\footnotesize{{3:\quad\textbf{for}t\underline{\hbox to 0.1cm{}}word $\leftarrow$ $t_1$$t_length(t)$ \textbf{do} }}};
\node [anchor=north west] (label2part6)at ([yshift=0.3em]label2part5.south west) {\footnotesize{{4:\quad\quad\textbf{if} s\underline{\hbox to 0.1cm{}}word == x \textbf{and} t\underline{\hbox to 0.1cm{}}word==y \textbf{then} }}};
\node [anchor=north west] (label2part7) at ([yshift=0.3em]label2part6.south west) {\footnotesize{{5:\quad\quad\quad\quad count $\leftarrow$ count + 1 }}};
\node [anchor=north west] (label2part8) at ([yshift=0.3em]label2part7.south west) {\footnotesize{{6:\quad\quad \textbf{end if} }}};
\node [anchor=north west] (label2part9) at ([yshift=0.3em]label2part8.south west) {\footnotesize{{7:\quad \textbf{end for} }}};
\node [anchor=north west] (label2part10) at ([yshift=0.3em]label2part9.south west) {\footnotesize{{8: \textbf{end for} }}};
\node [pos=0.5,left,xshift=-0.5em,yshift=2.0em] (label2) {Input: a word pair (x, y) and a sentence pair (s, t)};
\node [anchor=north west] (label2part2) at ([yshift=0.3em]label2.south west) {Output: the number of (x, y) in the (s, t)};
\node [anchor=north west] (label2part3) at ([yshift=0.3em]label2part2.south west) {{1:$count$ $\leftarrow$ 0}};
\node [anchor=north west] (label2part4) at ([yshift=0.3em]label2part3.south west) {{2:\textbf{for} $s\underline{\hbox to 0.1cm{}}word$ $\leftarrow$ $S_1$$S_{length(s)}$ \textbf{do} }};
\node [anchor=north west] (label2part5)at ([yshift=0.3em]label2part4.south west) {{3:\quad\textbf{for} $t\underline{\hbox to 0.1cm{}}word$ $\leftarrow$ $t_1$$t_{length(t)}$ \textbf{do} }};
\node [anchor=north west] (label2part6)at ([yshift=0.3em]label2part5.south west) {{4:\quad\quad\textbf{if} $s\underline{\hbox to 0.1cm{}}word$ == x \textbf{and} $t\underline{\hbox to 0.1cm{}}word$==y \textbf{then} }};
\node [anchor=north west] (label2part7) at ([yshift=0.3em]label2part6.south west) {{5:\quad\quad\quad\quad $count$ $\leftarrow$ $count$ + 1 }};
\node [anchor=north west] (label2part8) at ([yshift=0.3em]label2part7.south west) {{6:\quad\quad \textbf{end if} }};
\node [anchor=north west] (label2part9) at ([yshift=0.3em]label2part8.south west) {{7:\quad \textbf{end for} }};
\node [anchor=north west] (label2part10) at ([yshift=0.3em]label2part9.south west) {{8: \textbf{end for} }};
}
......
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\definecolor{ugreen}{rgb}{0,0.5,0}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\node [anchor=west,draw,thick,minimum width=18.8em,minimum height=1.2em] (sent) at (0,0) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,red] (s1) at ([xshift=0.0em,yshift=-2em]sent.south west) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,ugreen] (s2) at ([xshift=2.7em]s1.east) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,orange] (s3) at ([xshift=2.7em]s2.east) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,ublue] (s4) at ([xshift=2.7em]s3.east) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,purple] (s5) at ([xshift=2.7em]s4.east) {};
{
\node [anchor=west,draw,thick,circle,minimum size=1.6em,red,fill=red] (t1) at ([yshift=-3.5em]s1.west) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,ugreen,fill=ugreen] (t2) at ([xshift=2.7em]t1.east) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,orange,fill=orange] (t3) at ([xshift=2.7em]t2.east) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,ublue,fill=ublue] (t4) at ([xshift=2.7em]t3.east) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,purple,fill=purple] (t5) at ([xshift=2.7em]t4.east) {};
}
{
\node [anchor=west,draw,thick,circle,minimum size=1.6em,red,fill=red] (ft1) at ([yshift=-3.5em]t1.west) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,ublue,fill=ublue] (ft2) at ([xshift=2.7em]ft1.east) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,purple,fill=purple] (ft3) at ([xshift=2.7em]ft2.east) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,ugreen,fill=ugreen] (ft4) at ([xshift=2.7em]ft3.east) {};
\node [anchor=west,draw,thick,circle,minimum size=1.6em,orange,fill=orange] (ft5) at ([xshift=2.7em]ft4.east) {};
}
\draw [->,thick,double] ([yshift=-0.1em]sent.south) -- ([yshift=-.8em]sent.south);
{
\draw [->,thick] ([yshift=-0.1em]s1.south) -- ([yshift=0.1em]t1.north);
\draw [->,thick] ([yshift=-0.1em]s2.south) -- ([yshift=0.1em]t2.north);
\draw [->,thick] ([yshift=-0.1em]s3.south) -- ([yshift=0.1em]t3.north);
\draw [->,thick] ([yshift=-0.1em]s4.south) -- ([yshift=0.1em]t4.north);
\draw [->,thick] ([yshift=-0.1em]s5.south) -- ([yshift=0.1em]t5.north);
}
{
\draw [->,thick] ([yshift=-0.1em]t1.south) -- ([yshift=0.1em]ft1.north);
\draw [->,thick] ([yshift=-0.1em]t2.south) -- ([yshift=0.1em]ft4.north);
\draw [->,thick] ([yshift=-0.1em]t3.south) -- ([yshift=0.1em]ft5.north);
\draw [->,thick] ([yshift=-0.1em]t4.south) -- ([yshift=0.1em]ft2.north);
\draw [->,thick] ([yshift=-0.1em]t5.south) -- ([yshift=0.1em]ft3.north);
}
{
\node [anchor=north west] (label1) at ([xshift=1.5em,yshift=0.5em]s5.east) {\textbf{分析}};
\node [anchor=north west] (label2) at ([xshift=1.5em,yshift=0.5em]t5.east) {\textbf{转换}};
\node [anchor=north west] (label3) at ([xshift=1.5em,yshift=0.5em]ft5.east) {\textbf{生成}};
}
\end{tikzpicture}
%---------------------------------------------------------------------
\begin{center}
%%% outline
%-------------------------------------------------------------------------
{\footnotesize
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\begin{tikzpicture}
\begin{scope}
\node [anchor=west, font=\normalsize] (s1) at (0,0) {};
\node [anchor=west, font=\normalsize] (s2) at ([xshift=3em]s1.east) {};
\node [anchor=west, font=\normalsize] (s3) at ([xshift=5.6em]s2.east) {};
\node [anchor=west, font=\normalsize] (s4) at ([xshift=5.1em]s3.east) {感到};
\node [anchor=west, font=\normalsize] (s5) at ([xshift=3.1em]s4.east) {满意};
\end{scope}
\begin{scope}[yshift=-7em]
\node [anchor=west, font=\normalsize] (t1) at (0.4em,0) {I};
\node [anchor=west, font=\normalsize] (t2) at ([xshift=3.5em,yshift=-0.1em]t1.east) {am};
\node [anchor=west, font=\normalsize] (t3) at ([xshift=3.5em,yshift=0.1em]t2.east) {satisfied};
\node [anchor=west, font=\normalsize] (t4) at ([xshift=3.5em]t3.east) {with};
\node [anchor=west, font=\normalsize] (t5) at ([xshift=3.5em,yshift=-0.2em]t4.east) {you};
\end{scope}
{
\draw [-,very thick,ublue,dashed] (s1.south) -- (t1.north);
\draw [-,very thick,ublue,dashed] (s4.south) -- ([yshift=0.3em]t2.north);
\draw [-,very thick,ublue,dashed] (s2.south) ..controls +(south:1em) and +(north:1em).. (t4.north);
\draw [-,very thick,ublue,dashed] (s3.south) ..controls +(south:0.5em) and +(north:1.5em).. (t5.north);
\draw [-,very thick,ublue,dashed] (s5.south) -- (t3.north);
}
\end{tikzpicture}
}
%---------------------------------------------------------------------
\end{center}
\begin{center}
%%% outline
%-------------------------------------------------------------------------
{\footnotesize
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\begin{tikzpicture}
\begin{scope}
\node [anchor=west] (s1) at (0,0) {};
\node [anchor=west] (s2) at ([xshift=0.8em]s1.east) {};
\node [anchor=west] (s3) at ([xshift=0.8em]s2.east) {};
\node [anchor=west] (s4) at ([xshift=0.8em]s3.east) {感到};
\node [anchor=west] (s5) at ([xshift=0.8em]s4.east) {满意};
\end{scope}
\begin{scope}[yshift=-3em]
\node [anchor=west] (t1) at (0.35em,0) {I};
\node [anchor=west] (t2) at ([xshift=0.5em,yshift=-0.1em]t1.east) {am};
\node [anchor=west] (t3) at ([xshift=0.5em,yshift=0.1em]t2.east) {satisfied};
\node [anchor=west] (t4) at ([xshift=0.5em]t3.east) {with};
\node [anchor=west] (t5) at ([xshift=0.5em,yshift=-0.2em]t4.east) {you};
\end{scope}
{
\draw [-,thick,ublue,dashed] (s1.south) -- (t1.north);
\draw [-,thick,ublue,dashed] (s4.south) -- ([yshift=0.3em]t2.north);
\draw [-,thick,ublue,dashed] (s2.south) ..controls +(south:1em) and +(north:1em).. (t4.north);
\draw [-,thick,ublue,dashed] (s3.south) ..controls +(south:0.5em) and +(north:1.5em).. (t5.north);
\draw [-,thick,ublue,dashed] (s5.south) -- (t3.north);
}
\end{tikzpicture}
}
%---------------------------------------------------------------------
\end{center}
......@@ -6,20 +6,20 @@
\begin{tikzpicture}
\begin{scope}
\node [anchor=west] (s1) at (0,0) {\footnotesize{$_1$}};
\node [anchor=west] (s2) at ([xshift=0.5em]s1.east) {\footnotesize{$_2$}};
\node [anchor=west] (s3) at ([xshift=0.5em]s2.east) {\footnotesize{$_3$}};
\node [anchor=west] (s4) at ([xshift=0.5em]s3.east) {感到\footnotesize{$_4$}};
\node [anchor=west] (s5) at ([xshift=0.5em]s4.east) {满意\footnotesize{$_5$}};
\node [anchor=west] (s1) at (0,0) {$_1$};
\node [anchor=west] (s2) at ([xshift=3em]s1.east) {$_2$};
\node [anchor=west] (s3) at ([xshift=4.6em]s2.east) {$_3$};
\node [anchor=west] (s4) at ([xshift=5.1em]s3.east) {感到$_4$};
\node [anchor=west] (s5) at ([xshift=3.1em]s4.east) {满意$_5$};
\node [anchor=east] (s) at (s1.west) {$s=$};
\end{scope}
\begin{scope}[yshift=-3.0em]
\node [anchor=west] (t1) at (0.35em,0) {I\footnotesize{$_1$}};
\node [anchor=west] (t2) at ([xshift=0.3em,yshift=-0.1em]t1.east) {am\footnotesize{$_2$}};
\node [anchor=west] (t3) at ([xshift=0.3em,yshift=0.1em]t2.east) {satisfied\footnotesize{$_3$}};
\node [anchor=west] (t4) at ([xshift=0.3em]t3.east) {with\footnotesize{$_4$}};
\node [anchor=west] (t5) at ([xshift=0.3em,yshift=-0.2em]t4.east) {you\footnotesize{$_5$}};
\begin{scope}[yshift=-7.0em]
\node [anchor=west] (t1) at (0.4em,0) {I$_1$};
\node [anchor=west] (t2) at ([xshift=3.5em,yshift=-0.1em]t1.east) {am$_2$};
\node [anchor=west] (t3) at ([xshift=3.5em,yshift=0.1em]t2.east) {satisfied$_3$};
\node [anchor=west] (t4) at ([xshift=3.5em]t3.east) {with$_4$};
\node [anchor=west] (t5) at ([xshift=3.5em,yshift=-0.2em]t4.east) {you$_5$};
\node [anchor=east] (t) at ([xshift=-0.3em]t1.west) {$t=$};
\end{scope}
......
......@@ -14,21 +14,21 @@
{\footnotesize
\begin{scope}
\node [anchor=west] (s1) at (0,0) {\footnotesize{$_1$}};
\node [anchor=west] (s2) at ([xshift=0.5em]s1.east) {\footnotesize{$_2$}};
\node [anchor=west] (s3) at ([xshift=0.5em]s2.east) {\footnotesize{$_3$}};
\node [anchor=west] (s4) at ([xshift=0.5em]s3.east) {感到\footnotesize{$_4$}};
\node [anchor=west] (s5) at ([xshift=0.5em]s4.east) {满意\footnotesize{$_5$}};
\node [anchor=west] (s1) at (0,0) {$_1$};
\node [anchor=west] (s2) at ([xshift=2.2em]s1.east) {$_2$};
\node [anchor=west] (s3) at ([xshift=3.2em]s2.east) {$_3$};
\node [anchor=west] (s4) at ([xshift=3.6em]s3.east) {感到$_4$};
\node [anchor=west] (s5) at ([xshift=1.9em]s4.east) {满意$_5$};
\node [anchor=east] (s) at (s1.west) {$s=$};
\end{scope}
\begin{scope}[yshift=-2.6em]
\node [anchor=west] (t1) at (0.35em,0) {I\footnotesize{$_1$}};
\node [anchor=west] (t2) at ([xshift=0.3em,yshift=-0.1em]t1.east) {am\footnotesize{$_2$}};
\node [anchor=west] (t3) at ([xshift=0.3em,yshift=0.1em]t2.east) {satisfied\footnotesize{$_3$}};
\node [anchor=west] (t4) at ([xshift=0.3em]t3.east) {with\footnotesize{$_4$}};
\node [anchor=west] (t5) at ([xshift=0.3em,yshift=-0.2em]t4.east) {you\footnotesize{$_5$}};
\node [anchor=east] (t) at ([xshift=-0.3em]t1.west) {$t'=$};
\begin{scope}[yshift=-3.6em]
\node [anchor=west] (t1) at (0.35em,0) {I$_1$};
\node [anchor=west] (t2) at ([xshift=2.3em,yshift=-0.1em]t1.east) {am$_2$};
\node [anchor=west] (t3) at ([xshift=2.3em,yshift=0.1em]t2.east) {satisfied$_3$};
\node [anchor=west] (t4) at ([xshift=2.3em]t3.east) {with$_4$};
\node [anchor=west] (t5) at ([xshift=2.3em,yshift=-0.2em]t4.east) {you$_5$};
\node [anchor=east] (t) at (t1.west) {$t'=$};
\end{scope}
......@@ -51,20 +51,20 @@
{\footnotesize
\begin{scope}
\node [anchor=west] (s1) at (0,0) {\footnotesize{$_1$}};
\node [anchor=west] (s2) at ([xshift=0.5em]s1.east) {\footnotesize{$_2$}};
\node [anchor=west] (s3) at ([xshift=0.5em]s2.east) {\footnotesize{$_3$}};
\node [anchor=west] (s4) at ([xshift=0.5em]s3.east) {感到\footnotesize{$_4$}};
\node [anchor=west] (s5) at ([xshift=0.5em]s4.east) {满意\footnotesize{$_5$}};
\node [anchor=west] (s1) at (0,0) {$_1$};
\node [anchor=west] (s2) at ([xshift=2.5em]s1.east) {$_2$};
\node [anchor=west] (s3) at ([xshift=2.5em]s2.east) {$_3$};
\node [anchor=west] (s4) at ([xshift=2.5em]s3.east) {感到$_4$};
\node [anchor=west] (s5) at ([xshift=2.5em]s4.east) {满意$_5$};
\node [anchor=east] (s) at (s1.west) {$s=$};
\end{scope}
\begin{scope}[yshift=-2.6em]
\node [anchor=center] (t1) at ([yshift=-1.6em]s1.south) {I\footnotesize{$_1$}};
\node [anchor=center] (t2) at ([yshift=-1.6em]s2.south) {with\footnotesize{$_2$}};
\node [anchor=center] (t3) at ([yshift=-1.7em]s3.south) {you\footnotesize{$_3$}};
\node [anchor=center] (t4) at ([yshift=-1.7em]s4.south) {am\footnotesize{$_4$}};
\node [anchor=center] (t5) at ([yshift=-1.6em]s5.south) {satisfied\footnotesize{$_5$}};
\begin{scope}[yshift=-3.6em]
\node [anchor=center] (t1) at ([yshift=-1.6em]s1.south) {I$_1$};
\node [anchor=center] (t2) at ([yshift=-1.6em]s2.south) {with$_2$};
\node [anchor=center] (t3) at ([yshift=-1.7em]s3.south) {you$_3$};
\node [anchor=center] (t4) at ([yshift=-1.7em]s4.south) {am$_4$};
\node [anchor=center] (t5) at ([yshift=-1.6em]s5.south) {satisfied$_5$};
\node [anchor=center] (t) at ([xshift=-1.3em]t1.west) {$t''=$};
\end{scope}
......
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
{
\node [pos=0.5,left,xshift=-0.5em,yshift=2.0em] (label2) {\footnotesize{{$t^1$ =$<$s$>$ {\color{red}machine}\; {\color{red}translation}\; is\; just\; translation\; by\; computer\; $<$/s$>$ }}};
\node [anchor=north west] (label2part2) at ([yshift=0.3em]label2.south west) {\footnotesize{{$t^2$ =$<$s$>$ how\; does\;this\; {\color{red}machine}\;work\; $?$ $<$/s$>$ }}};
\node [anchor=north west] (label2part3) at ([yshift=0.3em]label2part2.south west) {\footnotesize{{$t^3$ =$<$s$>$ we\; are\;replaced\;the\; old\; adding\; {\color{red}machine}\;with\;a\; computer\; $<$/s$>$ }}};
\node [anchor=north west] (label2part4) at ([yshift=0.3em]label2part3.south west) {\footnotesize{{$t^4$ =$<$s$>$ several\; approaches\; to\;{\color{red}machine}\;learning\; are\; used\; to\; solve\; problems\; $?$\; $<$/s$>$ }}};
}
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
......@@ -10,21 +10,21 @@
{\footnotesize
\begin{scope}
\node [anchor=west] (s1) at (0,0) {\footnotesize{$_1$}};
\node [anchor=west] (s2) at ([xshift=0.5em]s1.east) {\footnotesize{$_2$}};
\node [anchor=west] (s3) at ([xshift=0.5em]s2.east) {\footnotesize{$_3$}};
\node [anchor=west] (s4) at ([xshift=0.5em]s3.east) {感到\footnotesize{$_4$}};
\node [anchor=west] (s5) at ([xshift=0.5em]s4.east) {满意\footnotesize{$_5$}};
\node [anchor=west] (s1) at (0,0) {$_1$};
\node [anchor=west] (s2) at ([xshift=2.2em]s1.east) {$_2$};
\node [anchor=west] (s3) at ([xshift=3.2em]s2.east) {$_3$};
\node [anchor=west] (s4) at ([xshift=3.6em]s3.east) {感到$_4$};
\node [anchor=west] (s5) at ([xshift=1.9em]s4.east) {满意$_5$};
\node [anchor=east] (s) at (s1.west) {$s=$};
\end{scope}
\begin{scope}[yshift=-2.6em]
\node [anchor=west] (t1) at (0.35em,0) {I\footnotesize{$_1$}};
\node [anchor=west] (t2) at ([xshift=0.3em,yshift=-0.1em]t1.east) {am\footnotesize{$_2$}};
\node [anchor=west] (t3) at ([xshift=0.3em,yshift=0.1em]t2.east) {satisfied\footnotesize{$_3$}};
\node [anchor=west] (t4) at ([xshift=0.3em]t3.east) {with\footnotesize{$_4$}};
\node [anchor=west] (t5) at ([xshift=0.3em,yshift=-0.2em]t4.east) {you\footnotesize{$_5$}};
\node [anchor=east] (t) at ([xshift=-0.3em]t1.west) {$t'=$};
\begin{scope}[yshift=-3.6em]
\node [anchor=west] (t1) at (0.35em,0) {I$_1$};
\node [anchor=west] (t2) at ([xshift=2.3em,yshift=-0.1em]t1.east) {am$_2$};
\node [anchor=west] (t3) at ([xshift=2.3em,yshift=0.1em]t2.east) {satisfied$_3$};
\node [anchor=west] (t4) at ([xshift=2.3em]t3.east) {with$_4$};
\node [anchor=west] (t5) at ([xshift=2.3em,yshift=-0.2em]t4.east) {you$_5$};
\node [anchor=east] (t) at (t1.west) {$t'=$};
\end{scope}
......@@ -47,20 +47,20 @@
{\footnotesize
\begin{scope}
\node [anchor=west] (s1) at (0,0) {\footnotesize{$_1$}};
\node [anchor=west] (s2) at ([xshift=0.5em]s1.east) {\footnotesize{$_2$}};
\node [anchor=west] (s3) at ([xshift=0.5em]s2.east) {\footnotesize{$_3$}};
\node [anchor=west] (s4) at ([xshift=0.5em]s3.east) {感到\footnotesize{$_4$}};
\node [anchor=west] (s5) at ([xshift=0.5em]s4.east) {满意\footnotesize{$_5$}};
\node [anchor=west] (s1) at (0,0) {$_1$};
\node [anchor=west] (s2) at ([xshift=2.5em]s1.east) {$_2$};
\node [anchor=west] (s3) at ([xshift=2.5em]s2.east) {$_3$};
\node [anchor=west] (s4) at ([xshift=2.5em]s3.east) {感到$_4$};
\node [anchor=west] (s5) at ([xshift=2.5em]s4.east) {满意$_5$};
\node [anchor=east] (s) at (s1.west) {$s=$};
\end{scope}
\begin{scope}[yshift=-2.6em]
\node [anchor=center] (t1) at ([yshift=-1.6em]s1.south) {I\footnotesize{$_1$}};
\node [anchor=center] (t2) at ([yshift=-1.6em]s2.south) {with\footnotesize{$_2$}};
\node [anchor=center] (t3) at ([yshift=-1.7em]s3.south) {you\footnotesize{$_3$}};
\node [anchor=center] (t4) at ([yshift=-1.7em]s4.south) {am\footnotesize{$_4$}};
\node [anchor=center] (t5) at ([yshift=-1.6em]s5.south) {satisfied\footnotesize{$_5$}};
\begin{scope}[yshift=-3.6em]
\node [anchor=center] (t1) at ([yshift=-1.6em]s1.south) {I$_1$};
\node [anchor=center] (t2) at ([yshift=-1.6em]s2.south) {with$_2$};
\node [anchor=center] (t3) at ([yshift=-1.7em]s3.south) {you$_3$};
\node [anchor=center] (t4) at ([yshift=-1.7em]s4.south) {am$_4$};
\node [anchor=center] (t5) at ([yshift=-1.6em]s5.south) {satisfied$_5$};
\node [anchor=center] (t) at ([xshift=-1.3em]t1.west) {$t''=$};
\end{scope}
......
......@@ -5,14 +5,14 @@
\definecolor{ugreen}{rgb}{0,0.5,0}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s1) at (0,0) {$\phi$};
\node [anchor=west,inner sep=2pt,fill=red!20,thick,minimum width=3.6em,minimum height=0.8em] (s1) at (0,0) {$\phi$};
{%第一列
\node [anchor=north west] (label1) at ([xshift=2.5em,yshift=6.3em]s1.east) {{\scriptsize \textbf{第1步}}};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s21) at ([xshift=2.0em,yshift=3.5em]s1.east) {$w_1^1$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s22) at ([xshift=2.0em,yshift=0.0em]s1.east) {$w_2^1$};
\node [anchor=west,inner sep=2pt,fill=green!20,thick,minimum width=3.6em,minimum height=0.8em] (s21) at ([xshift=2.0em,yshift=3.5em]s1.east) {$w_1^1$};
\node [anchor=west,inner sep=2pt,fill=green!20,thick,minimum width=3.6em,minimum height=0.8em] (s22) at ([xshift=2.0em,yshift=0.0em]s1.east) {$w_2^1$};
\node [anchor=west] (s23) at ([xshift=3.3em,yshift=-3.2em]s1.east) {$\vdots$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s24) at ([xshift=2.0em,yshift=-7.0em]s1.east) {\scriptsize{$w_{m \bullet n}^1$}};
\node [anchor=west,inner sep=2pt,fill=green!20,thick,minimum width=3.6em,minimum height=0.8em] (s24) at ([xshift=2.0em,yshift=-7.0em]s1.east) {\scriptsize{$w_{m \bullet n}^1$}};
}
{
\draw [->,thick] ([yshift=0.0em]s1.east) -- ([yshift=0.0em]s21.west);
......@@ -23,10 +23,10 @@
{%第二列
\node [anchor=north west] (label2) at ([xshift=9.3em,yshift=6.3em]s1.east) {{\scriptsize \textbf{第2步}}};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s31) at ([xshift=8.8em,yshift=3.5em]s1.east) {$w_1^2$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s32) at ([xshift=8.8em,yshift=0.0em]s1.east) {$w_2^2$};
\node [anchor=west,inner sep=2pt,fill=blue!20,thick,minimum width=3.6em,minimum height=0.8em] (s31) at ([xshift=8.8em,yshift=3.5em]s1.east) {$w_1^2$};
\node [anchor=west,inner sep=2pt,fill=blue!20,thick,minimum width=3.6em,minimum height=0.8em] (s32) at ([xshift=8.8em,yshift=0.0em]s1.east) {$w_2^2$};
\node [anchor=west] (s33) at ([xshift=10.1em,yshift=-3.2em]s1.east) {$\vdots$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s34) at ([xshift=8.8em,yshift=-7.0em]s1.east) {\tiny{$w_{(m-1) \bullet n}^2$}};
\node [anchor=west,inner sep=2pt,fill=blue!20,thick,minimum width=3.6em,minimum height=0.8em] (s34) at ([xshift=8.8em,yshift=-7.0em]s1.east) {\tiny{$w_{(m-1) \bullet n}^2$}};
}
{
\draw [->,thick] ([yshift=0.0em]s21.east) -- ([yshift=0.0em]s31.west);
......@@ -79,10 +79,10 @@
{%第四列
\node [anchor=north west] (label3) at ([xshift=19.4em,yshift=6.3em]s1.east) {{\scriptsize \textbf{第m步}}};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s51) at ([xshift=19.0em,yshift=3.5em]s1.east) {$w_1^m$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s52) at ([xshift=19.0em,yshift=0.0em]s1.east) {$w_2^m$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s53) at ([xshift=19.0em,yshift=-3.5em]s1.east) {$w_{?}^{m}$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s54) at ([xshift=19.0em,yshift=-7.0em]s1.east) {\scriptsize{$w_{1 \bullet n}^m$}};
\node [anchor=west,inner sep=2pt,fill=orange!20,thick,minimum width=3.6em,minimum height=0.8em] (s51) at ([xshift=19.0em,yshift=3.5em]s1.east) {$w_1^m$};
\node [anchor=west,inner sep=2pt,fill=orange!20,thick,minimum width=3.6em,minimum height=0.8em] (s52) at ([xshift=19.0em,yshift=0.0em]s1.east) {$w_2^m$};
\node [anchor=west,inner sep=2pt,fill=orange!20,thick,minimum width=3.6em,minimum height=0.8em] (s53) at ([xshift=19.0em,yshift=-3.5em]s1.east) {$w_{?}^{m}$};
\node [anchor=west,inner sep=2pt,fill=orange!20,thick,minimum width=3.6em,minimum height=0.8em] (s54) at ([xshift=19.0em,yshift=-7.0em]s1.east) {\scriptsize{$w_{1 \bullet n}^m$}};
\draw [->,thick] ([yshift=0.0em]s41.east) -- ([yshift=0.0em]s51.west);
\draw [->,thick] ([yshift=0.0em]s42.east) -- ([yshift=0.0em]s52.west);
......
%%% outline
%-------------------------------------------------------------------------
\begin{tabular}{l | l | l}
$m$ & $n$ & $n^m \cdot m!$ \\ \hline
1 & 1 & 1 \\
1 & 10 & 10 \\
2 & 10 & 200 \\
10 & 10 & 36288000000000000 \\
20 & 10 & 2.43290200817664 $\times 10^{38}$ \\
20 & 30 & 8.48300477127188 $\times 10^{47}$ \\
\end{tabular}
%---------------------------------------------------------------------
......@@ -6,14 +6,14 @@
\definecolor{ugreen}{rgb}{0,0.5,0}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s1) at (0,0) {$\phi$};
\node [anchor=west,inner sep=2pt,fill=red!20,thick,minimum width=3.6em,minimum height=0.8em] (s1) at (0,0) {$\phi$};
{%第一列
\node [anchor=north west] (label1) at ([xshift=2.5em,yshift=6.3em]s1.east) {{\scriptsize \textbf{第1步}}};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s21) at ([xshift=2.0em,yshift=3.5em]s1.east) {$w_1^1$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s22) at ([xshift=2.0em,yshift=0.0em]s1.east) {$w_2^1$};
\node [anchor=west,inner sep=2pt,fill=green!20,thick,minimum width=3.6em,minimum height=0.8em] (s21) at ([xshift=2.0em,yshift=3.5em]s1.east) {$w_1^1$};
\node [anchor=west,inner sep=2pt,fill=green!20,thick,minimum width=3.6em,minimum height=0.8em] (s22) at ([xshift=2.0em,yshift=0.0em]s1.east) {$w_2^1$};
\node [anchor=west] (s23) at ([xshift=3.3em,yshift=-3.2em]s1.east) {$\vdots$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s24) at ([xshift=2.0em,yshift=-7.0em]s1.east) {\scriptsize{$w_{m \bullet n}^1$}};
\node [anchor=west,inner sep=2pt,fill=green!20,thick,minimum width=3.6em,minimum height=0.8em] (s24) at ([xshift=2.0em,yshift=-7.0em]s1.east) {\scriptsize{$w_{m \bullet n}^1$}};
}
{
\draw [->,thick,red] ([yshift=0.0em]s1.east) -- ([yshift=0.0em]s21.west);
......@@ -24,10 +24,10 @@
{%第二列
\node [anchor=north west] (label2) at ([xshift=9.3em,yshift=6.3em]s1.east) {{\scriptsize \textbf{第2步}}};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s31) at ([xshift=8.8em,yshift=3.5em]s1.east) {$w_1^2$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s32) at ([xshift=8.8em,yshift=0.0em]s1.east) {$w_2^2$};
\node [anchor=west,inner sep=2pt,fill=blue!20,thick,minimum width=3.6em,minimum height=0.8em] (s31) at ([xshift=8.8em,yshift=3.5em]s1.east) {$w_1^2$};
\node [anchor=west,inner sep=2pt,fill=blue!20,thick,minimum width=3.6em,minimum height=0.8em] (s32) at ([xshift=8.8em,yshift=0.0em]s1.east) {$w_2^2$};
\node [anchor=west] (s33) at ([xshift=10.1em,yshift=-3.2em]s1.east) {$\vdots$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s34) at ([xshift=8.8em,yshift=-7.0em]s1.east) {\tiny{$w_{(m-1) \bullet n}^2$}};
\node [anchor=west,inner sep=2pt,fill=blue!20,thick,minimum width=3.6em,minimum height=0.8em] (s34) at ([xshift=8.8em,yshift=-7.0em]s1.east) {\tiny{$w_{(m-1) \bullet n}^2$}};
}
{
\draw [->,thick,densely dashed] ([yshift=0.0em]s21.east) -- ([yshift=0.0em]s31.west);
......@@ -51,10 +51,10 @@
{%第四列
\node [anchor=north west] (label3) at ([xshift=19.4em,yshift=6.3em]s1.east) {{\scriptsize \textbf{第m步}}};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s51) at ([xshift=19.0em,yshift=3.5em]s1.east) {$w_1^m$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s52) at ([xshift=19.0em,yshift=0.0em]s1.east) {$w_2^m$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s53) at ([xshift=19.0em,yshift=-3.5em]s1.east) {$w_{?}^{m}$};
\node [anchor=west,draw,thick,minimum width=3.6em,minimum height=0.8em] (s54) at ([xshift=19.0em,yshift=-7.0em]s1.east) {\scriptsize{$w_{1 \bullet n}^m$}};
\node [anchor=west,inner sep=2pt,fill=orange!20,thick,minimum width=3.6em,minimum height=0.8em] (s51) at ([xshift=19.0em,yshift=3.5em]s1.east) {$w_1^m$};
\node [anchor=west,inner sep=2pt,fill=orange!20,thick,minimum width=3.6em,minimum height=0.8em] (s52) at ([xshift=19.0em,yshift=0.0em]s1.east) {$w_2^m$};
\node [anchor=west,inner sep=2pt,fill=orange!20,thick,minimum width=3.6em,minimum height=0.8em] (s53) at ([xshift=19.0em,yshift=-3.5em]s1.east) {$w_{?}^{m}$};
\node [anchor=west,inner sep=2pt,fill=orange!20,thick,minimum width=3.6em,minimum height=0.8em] (s54) at ([xshift=19.0em,yshift=-7.0em]s1.east) {\scriptsize{$w_{1 \bullet n}^m$}};
\draw [->,thick,densely dashed] ([yshift=0.0em]s41.east) -- ([yshift=0.0em]s51.west);
\draw [->,thick,densely dashed] ([yshift=0.0em]s42.east) -- ([yshift=0.0em]s52.west);
......
......@@ -5,7 +5,7 @@
\begin{tikzpicture}
{\scriptsize
{
\node [anchor=north west,inner sep=2pt,align=left] (line1) at (0,0) {\textrm{\textbf{Function} \textsc{WordDecoding}($s$)}};
\node [anchor=north west,inner sep=2pt,align=left] (line2) at ([yshift=-1pt]line1.south west) {\textrm{1: $\pi = $\textsc{GetTransOptions}($s$)}};
......@@ -30,43 +30,43 @@
%% highlights
%\begin{pgfonlayer}{background}
{
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.71in] (line2highlight) at (line2.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=2.21in] (line2highlight) at (line2.west) {};
}
{
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.71in] (line3highlight) at (line3.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.71in] (line5highlight) at (line5.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=2.21in] (line3highlight) at (line3.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=2.21in] (line5highlight) at (line5.west) {};
}
{
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.71in] (line8highlight) at (line8.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=2.21in] (line8highlight) at (line8.west) {};
}
{
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.71in] (line9highlight) at (line9.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=2.21in] (line9highlight) at (line9.west) {};
}
{
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=1.71in] (line10highlight) at (line10.west) {};
\node[anchor=west,fill=blue!20,minimum height=0.16in,minimum width=2.21in] (line10highlight) at (line10.west) {};
}
%\end{pgfonlayer}
\end{pgfonlayer}
{\footnotesize
{
%% remark 1
\begin{scope}
{
\node [anchor=north west,align=left] (remark1) at ([xshift=0.4in]algorithm.north east) {获取每个单词\\的翻译候选};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,red] (s1) at ([yshift=-1.0em,xshift=0.5em]remark1.north east){\tiny{1}};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,ugreen] (s2) at ([xshift=0.4em]s1.east) {\tiny{2}};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,orange] (s3) at ([xshift=0.4em]s2.east) {\tiny{3}};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=3.0pt,ublue] (s4) at ([xshift=0.4em]s3.east) {.};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=1.5pt,purple] (s5) at ([xshift=0.4em]s4.east) {\tiny{$m$}};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,red] (s1) at ([yshift=-0.7em,xshift=0.5em]remark1.north east){1};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,ugreen] (s2) at ([xshift=0.4em]s1.east) {2};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,orange] (s3) at ([xshift=0.4em]s2.east) {3};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=3.0pt,ublue] (s4) at ([xshift=0.4em]s3.east) {...};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=1.5pt,purple] (s5) at ([xshift=0.4em]s4.east) {$m$};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,red,fill=red] (t1) at ([yshift=-1.7em]s1.center) {{\color{white} \tiny{$n$}}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,ugreen,fill=ugreen] (t2) at ([yshift=-1.7em]s2.center) {{\color{white} \tiny{$n$}}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,orange,fill=orange] (t3) at ([yshift=-1.7em]s3.center) {{\color{white} \tiny{$n$}}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,ublue,fill=ublue] (t4) at ([yshift=-1.7em]s4.center) {{\color{white} \tiny{$n$}}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,purple,fill=purple] (t5) at ([yshift=-1.7em]s5.center) {{\color{white} \tiny{$n$}}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,red,fill=red] (t1) at ([yshift=-1.7em]s1.center) {{\color{white} $n$}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,ugreen,fill=ugreen] (t2) at ([yshift=-1.7em]s2.center) {{\color{white} $n$}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,orange,fill=orange] (t3) at ([yshift=-1.7em]s3.center) {{\color{white} $n$}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,ublue,fill=ublue] (t4) at ([yshift=-1.7em]s4.center) {{\color{white} $n$}};
\node [anchor=center,draw,thick,circle,minimum size=0.3em,inner sep=2pt,purple,fill=purple] (t5) at ([yshift=-1.7em]s5.center) {{\color{white} $n$}};
\draw [->,thick] ([yshift=-0.1em]s1.south) -- ([yshift=0.1em]t1.north);
\draw [->,thick] ([yshift=-0.1em]s2.south) -- ([yshift=0.1em]t2.north);
......@@ -104,8 +104,8 @@
{
\node [anchor=north west,inner sep=2pt,align=left] (remark4) at ([xshift=0.25em,yshift=-0.6em]remark3.south west) {\textsc{Join}($a,b$) 返回\\$a$$b$ 的所有组合};
{\scriptsize
\node [anchor=north west,inner sep=1pt,align=center,draw] (a1) at ([yshift=-0.5em]remark4.north east) {a1\\a2};
{
\node [anchor=north west,inner sep=1pt,align=center,draw] (a1) at ([yshift=-0.2em]remark4.north east) {a1\\a2};
\node [anchor=west] (join) at (a1.east) {$\times$};
\node [anchor=north west,inner sep=1pt,align=center,draw] (b1) at ([xshift=1.5em]a1.north east) {b1\\b2};
\node [anchor=west] (join) at (b1.east) {$=$};
......@@ -124,17 +124,17 @@
%% remark 5
\begin{scope}
{
\node [anchor=north west,align=left] (remark5) at ([xshift=0.0em,yshift=-1em]remark4.south west) {\textsc{PruneForTop1}\\保留得分最高的结果};
\node [anchor=west,draw,inner sep=1pt] (s1) at ([yshift=-0.5em,xshift=1.2em]remark5.north east){\tiny{0.234}};
\node [anchor=north west,draw,inner sep=1pt] (s2) at ([yshift=-0.2em]s1.south west){\tiny{0.197}};
\node [anchor=north west,draw,inner sep=1pt] (s3) at ([yshift=-0.2em]s2.south west){\tiny{0.083}};
\node [anchor=north west,align=left] (remark5) at ([xshift=0.0em,yshift=-1.3em]remark4.south west) {\textsc{PruneForTop1}\\保留得分最高的结果};
\node [anchor=west,draw,inner sep=1pt] (s1) at ([yshift=-0.5em,xshift=1.2em]remark5.north east){0.234};
\node [anchor=north west,draw,inner sep=1pt] (s2) at ([yshift=-0.2em]s1.south west){0.197};
\node [anchor=north west,draw,inner sep=1pt] (s3) at ([yshift=-0.2em]s2.south west){0.083};
\draw [-] ([yshift=-0.1em,xshift=-0.2em]s1.south west) -- ([yshift=-0.1em,xshift=3em]s1.south east);
\node [anchor=west] (top1) at ([xshift=0.1em]s1.east) {\tiny{\color{red}{$\gets$ top1}}};
\node [anchor=west] (top1) at ([xshift=0.1em]s1.east) {\color{red}{$\gets$ top1}};
\begin{pgfonlayer}{background}
{
\node[rectangle,draw,inner sep=0.2em,fill=blue!10] [fit = (remark5) (top1)] (remark5label) {};
\node[rectangle,draw,inner sep=0.2em,fill=blue!10] [fit = (remark5) (s3) (top1)] (remark5label) {};
}
\end{pgfonlayer}
}
......@@ -144,13 +144,13 @@
%% remark 6
\begin{scope}
{
\node [anchor=north west,align=left] (remark6) at ([xshift=0.0em,yshift=-1em]remark5.south west) {记录已经翻译过\\的源语单词};
\node [anchor=north west,align=left] (remark6) at ([xshift=0.0em,yshift=-1.3em]remark5.south west) {记录已经翻译过\\的源语单词};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,red] (s1) at ([yshift=-1.0em,xshift=0.5em]remark6.north east){\tiny{1}};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,ugreen] (s2) at ([xshift=0.4em]s1.east) {\tiny{2}};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,orange] (s3) at ([xshift=0.4em]s2.east) {\tiny{3}};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=3.0pt,ublue] (s4) at ([xshift=0.4em]s3.east) {.};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=1.5pt,purple] (s5) at ([xshift=0.4em]s4.east) {\tiny{$m$}};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,red] (s1) at ([yshift=-1.3em,xshift=0.5em]remark6.north east){1};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,ugreen] (s2) at ([xshift=0.4em]s1.east) {2};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=2.1pt,orange] (s3) at ([xshift=0.4em]s2.east) {3};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=3.0pt,ublue] (s4) at ([xshift=0.4em]s3.east) {...};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,inner sep=1.5pt,purple] (s5) at ([xshift=0.4em]s4.east) {$m$};
\draw [-,thick,red] (s1.north east) -- (s1.south west);
\draw [-,thick,orange] (s3.north east) -- (s3.south west);
......
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\definecolor{ugreen}{rgb}{0,0.5,0}
\definecolor{ublue}{rgb}{0.152,0.250,0.545}
\node [anchor=west,draw,thick,minimum width=7.7em,minimum height=0.8em] (sent) at (0,0) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,red] (s1) at ([yshift=-1.5em]sent.south west) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,ugreen] (s2) at ([xshift=0.7em]s1.east) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,orange] (s3) at ([xshift=0.7em]s2.east) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,ublue] (s4) at ([xshift=0.7em]s3.east) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,purple] (s5) at ([xshift=0.7em]s4.east) {};
{
\node [anchor=west,draw,thick,circle,minimum size=0.3em,red,fill=red] (t1) at ([yshift=-2.0em]s1.west) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,ugreen,fill=ugreen] (t2) at ([xshift=0.7em]t1.east) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,orange,fill=orange] (t3) at ([xshift=0.7em]t2.east) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,ublue,fill=ublue] (t4) at ([xshift=0.7em]t3.east) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,purple,fill=purple] (t5) at ([xshift=0.7em]t4.east) {};
}
{
\node [anchor=west,draw,thick,circle,minimum size=0.3em,red,fill=red] (ft1) at ([yshift=-2.0em]t1.west) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,ublue,fill=ublue] (ft2) at ([xshift=0.7em]ft1.east) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,purple,fill=purple] (ft3) at ([xshift=0.7em]ft2.east) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,ugreen,fill=ugreen] (ft4) at ([xshift=0.7em]ft3.east) {};
\node [anchor=west,draw,thick,circle,minimum size=0.3em,orange,fill=orange] (ft5) at ([xshift=0.7em]ft4.east) {};
}
\draw [->,thick,double] ([yshift=-0.1em]sent.south) -- ([yshift=-0.8em]sent.south);
{
\draw [->,thick] ([yshift=-0.1em]s1.south) -- ([yshift=0.1em]t1.north);
\draw [->,thick] ([yshift=-0.1em]s2.south) -- ([yshift=0.1em]t2.north);
\draw [->,thick] ([yshift=-0.1em]s3.south) -- ([yshift=0.1em]t3.north);
\draw [->,thick] ([yshift=-0.1em]s4.south) -- ([yshift=0.1em]t4.north);
\draw [->,thick] ([yshift=-0.1em]s5.south) -- ([yshift=0.1em]t5.north);
}
{
\draw [->,thick] ([yshift=-0.1em]t1.south) -- ([yshift=0.1em]ft1.north);
\draw [->,thick] ([yshift=-0.1em]t2.south) -- ([yshift=0.1em]ft4.north);
\draw [->,thick] ([yshift=-0.1em]t3.south) -- ([yshift=0.1em]ft5.north);
\draw [->,thick] ([yshift=-0.1em]t4.south) -- ([yshift=0.1em]ft2.north);
\draw [->,thick] ([yshift=-0.1em]t5.south) -- ([yshift=0.1em]ft3.north);
}
{
\node [anchor=north west] (label1) at ([xshift=0.5em,yshift=0.3em]sent.south east) {{\scriptsize \textbf{分析}}};
\node [anchor=north west] (label2) at ([yshift=-0.5em]label1.south west) {{\scriptsize \textbf{转换}}};
\node [anchor=north west] (label3) at ([yshift=-0.5em]label2.south west) {{\scriptsize \textbf{生成}}};
}
\end{tikzpicture}
%---------------------------------------------------------------------
......@@ -6,34 +6,34 @@
\begin{scope}
{\small
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=1em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.2em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.45em]s2.center) {you};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=2em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-2.2em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-2.45em]s2.center) {you};
\draw [-] (s1.south) -- ([yshift=-0.2em]t1.north);
\draw [-] (s2.south) -- (t2.north);
\node [anchor=center,draw=ublue,circle,thick,fill=white,inner sep=1pt,circular drop shadow={shadow xshift=0.1em,shadow yshift=-0.1em}] (mark) at ([xshift=0.5em,yshift=-0.2em]s2.south east) {{\color{ugreen} \tiny{\textbf{Yes}}}};
\node [anchor=center,draw=ublue,circle,thick,fill=white,inner sep=1pt,circular drop shadow={shadow xshift=0.1em,shadow yshift=-0.1em}] (mark) at ([xshift=0.8em,yshift=-0.7em]s2.south east) {{\color{ugreen} \tiny{\textbf{Yes}}}};
}
\end{scope}
\begin{scope}[xshift=1.3in]
\begin{scope}[xshift=1.8in]
{\small
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=1em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.2em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.45em]s2.center) {you};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=2em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-2.2em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-2.45em]s2.center) {you};
\draw [-] (s1.south) -- ([yshift=-0.2em]t1.north);
\draw [-] (s1.south) -- (t2.north);
\node [anchor=center,draw=ublue,circle,thick,fill=white,inner sep=1.5pt,circular drop shadow={shadow xshift=0.1em,shadow yshift=-0.1em}] (mark) at ([xshift=0.5em,yshift=-0.2em]s2.south east) {{\color{red} \tiny{\textbf{No}}}};
\node [anchor=center,draw=ublue,circle,thick,fill=white,inner sep=1.5pt,circular drop shadow={shadow xshift=0.1em,shadow yshift=-0.1em}] (mark) at ([xshift=0.8em,yshift=-0.7em]s2.south east) {{\color{red} \tiny{\textbf{No}}}};
}
\end{scope}
\begin{scope}[xshift=2.6in]
\begin{scope}[xshift=3.6in]
{\small
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=1em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.2em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.45em]s2.center) {you};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=2em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-2.2em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-2.45em]s2.center) {you};
\draw [-] (s1.south) -- ([yshift=-0.2em]t1.north);
\draw [-] (s2.south) -- ([yshift=-0.2em]t1.north);
\node [anchor=center,draw=ublue,circle,thick,fill=white,inner sep=1pt,circular drop shadow={shadow xshift=0.1em,shadow yshift=-0.1em}] (mark) at ([xshift=0.5em,yshift=-0.2em]s2.south east) {{\color{ugreen} \tiny{\textbf{Yes}}}};
\node [anchor=center,draw=ublue,circle,thick,fill=white,inner sep=1pt,circular drop shadow={shadow xshift=0.1em,shadow yshift=-0.1em}] (mark) at ([xshift=0.8em,yshift=-0.7em]s2.south east) {{\color{ugreen} \tiny{\textbf{Yes}}}};
}
\end{scope}
\end{tikzpicture}
......
......@@ -4,146 +4,146 @@
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
{\scriptsize
{
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=0.4em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.7em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.9em]s2.center) {you};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.4em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.6em]s2.center) {you};
\node [anchor=east,inner sep=2pt] (t0) at ([xshift=-0.2em,yshift=-0.05em]t1.west) {$t_0$};
\draw [-] (s1.south) -- (t0.north);
\draw [-] (s2.south) -- (t0.north);
{
\node [anchor=south east,inner sep=0pt] (p) at (t0.north west) {\small{{\color{ugreen} P(}}};
\node [anchor=south west,inner sep=0pt] (p2) at ([yshift=0.2em]t2.north east) {\small{{\color{ugreen} )}}};
\node [anchor=west] (eq) at (p2.east) {\small{+}};
\node [anchor=west] (eq) at ([xshift=0.7em]p2.east) {\small{+}};
}
}
\end{scope}
\begin{scope}[xshift=1.2in]
{\scriptsize
\begin{scope}[xshift=1.5in]
{
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=0.4em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.7em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.9em]s2.center) {you};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.4em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.6em]s2.center) {you};
\node [anchor=east,inner sep=2pt] (t0) at ([xshift=-0.2em,yshift=-0.05em]t1.west) {$t_0$};
\draw [-] (s1.south) -- (t0.north);
\draw [-] (s2.south) -- (t1.north);
{
\node [anchor=south east,inner sep=0pt] (p) at (t0.north west) {\small{{\color{ugreen} P(}}};
\node [anchor=south west,inner sep=0pt] (p2) at ([yshift=0.2em]t2.north east) {\small{{\color{ugreen} )}}};
\node [anchor=west] (eq) at (p2.east) {\small{+}};
\node [anchor=west] (eq) at ([xshift=0.7em]p2.east) {\small{+}};
}
}
\end{scope}
\begin{scope}[xshift=2.4in]
{\scriptsize
\begin{scope}[xshift=3in]
{
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=0.4em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.7em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.9em]s2.center) {you};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.4em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.6em]s2.center) {you};
\node [anchor=east,inner sep=2pt] (t0) at ([xshift=-0.2em,yshift=-0.05em]t1.west) {$t_0$};
\draw [-] (s1.south) -- (t0.north);
\draw [-] (s2.south) -- (t2.north);
{
\node [anchor=south east,inner sep=0pt] (p) at (t0.north west) {\small{{\color{ugreen} P(}}};
\node [anchor=south west,inner sep=0pt] (p2) at ([yshift=0.2em]t2.north east) {\small{{\color{ugreen} )}}};
\node [anchor=west] (eq) at (p2.east) {\small{+}};
\node [anchor=west] (eq) at ([xshift=0.7em]p2.east) {\small{+}};
}
}
\end{scope}
\begin{scope}[yshift=-0.5in]
{\scriptsize
\begin{scope}[yshift=-0.6in]
{
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=0.4em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.7em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.9em]s2.center) {you};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.4em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.6em]s2.center) {you};
\node [anchor=east,inner sep=2pt] (t0) at ([xshift=-0.2em,yshift=-0.05em]t1.west) {$t_0$};
\draw [-] (s1.south) -- ([yshift=-0.2em]t1.north);
\draw [-] (s2.south) -- (t0.north);
{
\node [anchor=south east,inner sep=0pt] (p) at (t0.north west) {\small{{\color{ugreen} P(}}};
\node [anchor=south west,inner sep=0pt] (p2) at ([yshift=0.2em]t2.north east) {\small{{\color{ugreen} )}}};
\node [anchor=west] (eq) at (p2.east) {\small{+}};
\node [anchor=west] (eq) at ([xshift=0.7em]p2.east) {\small{+}};
}
}
\end{scope}
\begin{scope}[xshift=1.2in,yshift=-0.5in]
{\scriptsize
\begin{scope}[xshift=1.5in,yshift=-0.6in]
{
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=0.4em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.7em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.9em]s2.center) {you};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.4em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.6em]s2.center) {you};
\node [anchor=east,inner sep=2pt] (t0) at ([xshift=-0.2em,yshift=-0.05em]t1.west) {$t_0$};
\draw [-] (s1.south) -- ([yshift=-0.2em]t1.north);
\draw [-] (s2.south) -- ([yshift=-0.2em]t1.north);
{
\node [anchor=south east,inner sep=0pt] (p) at (t0.north west) {\small{{\color{ugreen} P(}}};
\node [anchor=south west,inner sep=0pt] (p2) at ([yshift=0.2em]t2.north east) {\small{{\color{ugreen} )}}};
\node [anchor=west] (eq) at (p2.east) {\small{+}};
\node [anchor=west] (eq) at ([xshift=0.7em]p2.east) {\small{+}};
}
}
\end{scope}
\begin{scope}[xshift=2.4in,yshift=-0.5in]
{\scriptsize
\begin{scope}[xshift=3in,yshift=-0.6in]
{
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=0.4em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.7em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.9em]s2.center) {you};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.4em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.6em]s2.center) {you};
\node [anchor=east,inner sep=2pt] (t0) at ([xshift=-0.2em,yshift=-0.05em]t1.west) {$t_0$};
\draw [-] (s1.south) -- ([yshift=-0.2em]t1.north);
\draw [-] (s2.south) -- (t2.north);
{
\node [anchor=south east,inner sep=0pt] (p) at (t0.north west) {\small{{\color{ugreen} P(}}};
\node [anchor=south west,inner sep=0pt] (p2) at ([yshift=0.2em]t2.north east) {\small{{\color{ugreen} )}}};
\node [anchor=west] (eq) at (p2.east) {\small{+}};
\node [anchor=west] (eq) at ([xshift=0.7em]p2.east) {\small{+}};
}
}
\end{scope}
\begin{scope}[yshift=-1in]
{\scriptsize
\begin{scope}[yshift=-1.2in]
{
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=0.4em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.7em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.9em]s2.center) {you};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.4em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.6em]s2.center) {you};
\node [anchor=east,inner sep=2pt] (t0) at ([xshift=-0.2em,yshift=-0.05em]t1.west) {$t_0$};
\draw [-] (s1.south) -- (t2.north);
\draw [-] (s2.south) -- (t0.north);
{
\node [anchor=south east,inner sep=0pt] (p) at (t0.north west) {\small{{\color{ugreen} P(}}};
\node [anchor=south west,inner sep=0pt] (p2) at ([yshift=0.2em]t2.north east) {\small{{\color{ugreen} )}}};
\node [anchor=west] (eq) at (p2.east) {\small{+}};
\node [anchor=west] (eq) at ([xshift=0.7em]p2.east) {\small{+}};
}
}
\end{scope}
\begin{scope}[xshift=1.2in,yshift=-1in]
{\scriptsize
\begin{scope}[xshift=1.5in,yshift=-1.2in]
{
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=0.4em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.7em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.9em]s2.center) {you};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.4em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.6em]s2.center) {you};
\node [anchor=east,inner sep=2pt] (t0) at ([xshift=-0.2em,yshift=-0.05em]t1.west) {$t_0$};
\draw [-] (s1.south) -- (t2.north);
\draw [-] (s2.south) -- (t1.north);
{
\node [anchor=south east,inner sep=0pt] (p) at (t0.north west) {\small{{\color{ugreen} P(}}};
\node [anchor=south west,inner sep=0pt] (p2) at ([yshift=0.2em]t2.north east) {\small{{\color{ugreen} )}}};
\node [anchor=west] (eq) at (p2.east) {\small{+}};
\node [anchor=west] (eq) at ([xshift=0.7em]p2.east) {\small{+}};
}
}
\end{scope}
\begin{scope}[xshift=2.4in,yshift=-1in]
{\scriptsize
\begin{scope}[xshift=3in,yshift=-1.2in]
{
\node [anchor=west,inner sep=2pt] (s1) at (0,0) {谢谢};
\node [anchor=west,inner sep=2pt] (s2) at ([xshift=0.4em]s1.east) {};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.7em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.9em]s2.center) {you};
\node [anchor=north,inner sep=2pt] (t1) at ([yshift=-1.4em]s1.center) {thank};
\node [anchor=north,inner sep=2pt] (t2) at ([yshift=-1.6em]s2.center) {you};
\node [anchor=east,inner sep=2pt] (t0) at ([xshift=-0.2em,yshift=-0.05em]t1.west) {$t_0$};
\draw [-] (s1.south) -- (t2.north);
\draw [-] (s2.south) -- (t2.north);
{
\node [anchor=south east,inner sep=0pt] (p) at (t0.north west) {\small{{\color{ugreen} P(}}};
\node [anchor=south west,inner sep=0pt] (p2) at ([yshift=0.2em]t2.north east) {\small{{\color{ugreen} )}}};
\node [anchor=west] (eq) at (p2.east) {\normalsize{= \ P($s|t$)}};
\node [anchor=west] (eq) at ([xshift=0.7em]p2.east) {\normalsize{= \ P($s|t$)}};
}
}
\end{scope}
......
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
\node [anchor=west] (s1) at (0,0) {\textbf{}};
\node [anchor=west] (s2) at ([xshift=2em]s1.east) {\textbf{}};
\node [anchor=west] (s3) at ([xshift=2em]s2.east) {\textbf{}};
\node [anchor=west] (s4) at ([xshift=2em]s3.east) {\textbf{表示}};
\node [anchor=west] (s5) at ([xshift=2em]s4.east) {\textbf{满意}};
\node [anchor=south west] (sentlabel) at ([yshift=-0.5em]s1.north west) {\scriptsize{\textbf{\color{red}{待翻译句子(已经分词):}}}};
\draw [->,very thick,ublue] (s1.south) -- ([yshift=-0.7em]s1.south);
\draw [->,very thick,ublue] (s2.south) -- ([yshift=-0.7em]s2.south);
\draw [->,very thick,ublue] (s3.south) -- ([yshift=-0.7em]s3.south);
\draw [->,very thick,ublue] (s4.south) -- ([yshift=-0.7em]s4.south);
\draw [->,very thick,ublue] (s5.south) -- ([yshift=-0.7em]s5.south);
{\small
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t11) at ([yshift=-1em]s1.south) {I};
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t12) at ([yshift=-0.2em]t11.south) {me};
\node [anchor=north,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (t13) at ([yshift=-0.2em]t12.south) {I'm};
\node [anchor=north west,inner sep=1pt,fill=black] (tl11) at (t11.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl12) at (t12.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl13) at (t13.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t21) at ([yshift=-1em]s2.south) {to};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t22) at ([yshift=-0.2em]t21.south) {with};
\node [anchor=north,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (t23) at ([yshift=-0.2em]t22.south) {for};
\node [anchor=north west,inner sep=1pt,fill=black] (tl21) at (t21.north west) {\tiny{{\color{white} \textbf{2}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl22) at (t22.north west) {\tiny{{\color{white} \textbf{2}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl23) at (t23.north west) {\tiny{{\color{white} \textbf{2}}}};
\node [anchor=north,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (t31) at ([yshift=-1em]s3.south) {you};
\node [anchor=north west,inner sep=1pt,fill=black] (tl31) at (t31.north west) {\tiny{{\color{white} \textbf{3}}}};
\node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3em] (t41) at ([yshift=-1em]s4.south) {$\phi$};
\node [anchor=north,inner sep=2pt,fill=orange!20,minimum height=1.5em,minimum width=3em] (t42) at ([yshift=-0.2em]t41.south) {show};
\node [anchor=north west,inner sep=1pt,fill=black] (tl41) at (t41.north west) {\tiny{{\color{white} \textbf{4}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl42) at (t42.north west) {\tiny{{\color{white} \textbf{4}}}};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t51) at ([yshift=-1em]s5.south) {satisfy};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t52) at ([yshift=-0.2em]t51.south) {satisfied};
\node [anchor=north,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=4.5em] (t53) at ([yshift=-0.2em]t52.south) {satisfies};
\node [anchor=north west,inner sep=1pt,fill=black] (tl51) at (t51.north west) {\tiny{{\color{white} \textbf{5}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl52) at (t52.north west) {\tiny{{\color{white} \textbf{5}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (tl53) at (t53.north west) {\tiny{{\color{white} \textbf{5}}}};
}
{\tiny
{
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt11) at (t11.east) {{\color{white} \textbf{P=.4}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt12) at (t12.east) {{\color{white} \textbf{P=.2}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt13) at (t13.east) {{\color{white} \textbf{P=.4}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt21) at (t21.east) {{\color{white} \textbf{P=.4}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt22) at (t22.east) {{\color{white} \textbf{P=.3}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt23) at (t23.east) {{\color{white} \textbf{P=.3}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt31) at (t31.east) {{\color{white} \textbf{P=1}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt41) at (t41.east) {{\color{white} \textbf{P=.5}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt42) at (t42.east) {{\color{white} \textbf{P=.5}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt51) at (t51.east) {{\color{white} \textbf{P=.5}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt52) at (t52.east) {{\color{white} \textbf{P=.4}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.55em,fill=black] (pt53) at (t53.east) {{\color{white} \textbf{P=.1}}};
}
}
\end{scope}
\begin{scope}
{\small
\node [anchor=west,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (ft11) at ([yshift=-1.2in]t11.west) {I'm};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft12) at ([xshift=5.0em]ft11.center) {satisfied};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft13) at ([xshift=5.0em]ft12.center) {with};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft14) at ([xshift=4.0em]ft13.center) {you};
{
\node [anchor=west,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (ft21) at ([yshift=-2em]ft11.west) {I'm};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft22) at ([xshift=5.0em]ft21.center) {satisfy};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft23) at ([xshift=5.0em]ft22.center) {to};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft24) at ([xshift=4.0em]ft23.center) {you};
}
{
\node [anchor=west,inner sep=2pt,fill=red!20,minimum height=1.5em,minimum width=2.5em] (ft31) at ([yshift=-2em]ft21.west) {I'm};
\node [anchor=center,inner sep=2pt,fill=purple!20,minimum height=1.5em,minimum width=5em] (ft32) at ([xshift=5.0em]ft31.center) {satisfy};
\node [anchor=center,inner sep=2pt,fill=blue!20,minimum height=1.5em,minimum width=2.5em] (ft33) at ([xshift=5.0em]ft32.center) {you};
\node [anchor=center,inner sep=2pt,fill=green!20,minimum height=1.5em,minimum width=2.5em] (ft34) at ([xshift=4.0em]ft33.center) {to};
}
\node [anchor=north west,inner sep=1pt,fill=black] (ftl11) at (ft11.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (ftl12) at (ft12.north west) {\tiny{{\color{white} \textbf{5}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (ftl13) at (ft13.north west) {\tiny{{\color{white} \textbf{2}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (ftl14) at (ft14.north west) {\tiny{{\color{white} \textbf{3}}}};
{
\node [anchor=north west,inner sep=1pt,fill=black] (ftl21) at (ft21.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (ftl22) at (ft22.north west) {\tiny{{\color{white} \textbf{5}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (ftl23) at (ft23.north west) {\tiny{{\color{white} \textbf{2}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (ftl24) at (ft24.north west) {\tiny{{\color{white} \textbf{3}}}};
}
{
\node [anchor=north west,inner sep=1pt,fill=black] (ftl31) at (ft31.north west) {\tiny{{\color{white} \textbf{1}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (ftl32) at (ft32.north west) {\tiny{{\color{white} \textbf{5}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (ftl33) at (ft33.north west) {\tiny{{\color{white} \textbf{3}}}};
\node [anchor=north west,inner sep=1pt,fill=black] (ftl34) at (ft34.north west) {\tiny{{\color{white} \textbf{2}}}};
}
{\tiny
{
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft11) at (ft11.east) {{\color{white} \textbf{P=.4}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft12) at (ft12.east) {{\color{white} \textbf{P=.4}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft13) at (ft13.east) {{\color{white} \textbf{P=.3}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft14) at (ft14.east) {{\color{white} \textbf{P=1}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft21) at (ft21.east) {{\color{white} \textbf{P=.4}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft22) at (ft22.east) {{\color{white} \textbf{P=.1}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft23) at (ft23.east) {{\color{white} \textbf{P=.4}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft24) at (ft24.east) {{\color{white} \textbf{P=1}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft31) at (ft31.east) {{\color{white} \textbf{P=.4}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft32) at (ft32.east) {{\color{white} \textbf{P=.1}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft33) at (ft33.east) {{\color{white} \textbf{P=1}}};
\node [anchor=north,rotate=90,inner sep=1pt,minimum width=2.5em,fill=black] (pft34) at (ft34.east) {{\color{white} \textbf{P=.4}}};
}
}
\begin{pgfonlayer}{background}
\node[rectangle,draw=ublue,red,inner sep=0.1em,fill=white] [fit = (ft11) (pft14)] (trans1) {};
{
\node[rectangle,draw=ublue,ublue,inner sep=0.1em,fill=white] [fit = (ft21) (pft24)] (trans1) {};
}
{
\node[rectangle,draw=ublue,ublue,inner sep=0.1em,fill=white] [fit = (ft31) (pft34)] (trans1) {};
}
\end{pgfonlayer}
{
\node [anchor=west,inner sep=2pt,minimum height=1.5em,minimum width=2.5em] (ft41) at ([yshift=-2em]ft31.west) {...};
}
{
\node [anchor=west,inner sep=2pt,minimum height=1.5em,minimum width=2.5em] (ft42) at ([yshift=-2em]ft32.west) {\scriptsize{\textbf{所有翻译单元都是概率化的}}};
\node [anchor=west,inner sep=1pt,fill=black] (ft43) at (ft42.east) {{\color{white} \tiny{\textbf{P=概率}}}};
}
}
\end{scope}
\begin{scope}
{
\draw[decorate,thick,decoration={brace,amplitude=5pt,mirror}] ([yshift=8em,xshift=-0.5em]t13.south west) -- ([xshift=-0.5em]t13.south west) node [pos=0.5,left,xshift=-0.5em,yshift=2.0em] (label2) {\footnotesize{\textbf{从双语数}}};
\node [anchor=north west] (label2part2) at ([yshift=0.3em]label2.south west) {\footnotesize{\textbf{据中自动}}};
\node [anchor=north west] (label2part3) at ([yshift=0.3em]label2part2.south west) {\footnotesize{\textbf{学习词典}}};
\node [anchor=north west] (label2part4) at ([yshift=0.3em]label2part3.south west) {\footnotesize{\textbf{(训练)}}};
}
{
\draw[decorate,thick,decoration={brace,amplitude=5pt,mirror}] ([yshift=-0.2em,xshift=-0.5em]t13.south west) -- ([yshift=-9.5em,xshift=-0.5em]t13.south west) node [pos=0.5,left,xshift=-0.5em,yshift=2.0em] (label3) {\footnotesize{\textbf{利用概率}}};
\node [anchor=north west] (label3part2) at ([yshift=0.3em]label3.south west) {\footnotesize{\textbf{化的词典}}};
\node [anchor=north west] (label3part3) at ([yshift=0.3em]label3part2.south west) {\footnotesize{\textbf{进行翻译}}};
\node [anchor=north west] (label3part4) at ([yshift=0.3em]label3part3.south west) {\footnotesize{\textbf{(解码)}}};
}
\end{scope}
\begin{scope}
{
\node [anchor=west] (score1) at ([xshift=1.5em]ft14.east) {\footnotesize{P=0.042}};
\node [anchor=west] (score2) at ([xshift=1.5em]ft24.east) {\footnotesize{P=0.006}};
\node [anchor=west] (score3) at ([xshift=1.5em]ft34.east) {\footnotesize{P=0.003}};
\node [anchor=south] (scorelabel) at (score1.north) {\scriptsize{\textbf{\color{red}{都赋予一个模型得分}}}};
\node [anchor=south] (scorelabel2) at ([yshift=-0.5em]scorelabel.north) {\scriptsize{\textbf{\color{red}{系统给每个译文}}}};
}
{
\node [anchor=north] (scorelabel2) at (score3.south) {\scriptsize{\textbf{选择得分}}};
\node [anchor=north west] (scorelabel2part2) at ([xshift=-0.5em,yshift=0.5em]scorelabel2.south west) {\scriptsize{\textbf{最高的译文}}};
\node [anchor=center,draw=ublue,circle,thick,fill=white,inner sep=1pt,circular drop shadow={shadow xshift=0.05em,shadow yshift=-0.05em}] (head1) at ([xshift=0.3em]score1.east) {\scriptsize{{\color{ugreen} \textbf{ok}}}};
}
\end{scope}
\begin{scope}
{
\draw [->,ultra thick,ublue,line width=2pt,opacity=0.7] ([xshift=-0.5em]t13.west) -- ([xshift=0.8em]t13.east) -- ([xshift=-0.2em]t21.west) -- ([xshift=0.8em]t21.east) -- ([xshift=-0.2em]t31.west) -- ([xshift=0.8em]t31.east) -- ([xshift=-0.2em]t41.west) -- ([xshift=0.8em]t41.east) -- ([xshift=-0.2em]t51.west) -- ([xshift=1.2em]t51.east);
}
\draw [->,ultra thick,red,line width=2pt,opacity=0.7] ([xshift=-0.5em]t13.west) -- ([xshift=0.8em]t13.east) -- ([xshift=-0.2em]t22.west) -- ([xshift=0.8em]t22.east) -- ([xshift=-0.2em]t31.west) -- ([xshift=0.8em]t31.east) -- ([xshift=-0.2em]t41.west) -- ([xshift=0.8em]t41.east) -- ([xshift=-0.2em]t52.west) -- ([xshift=1.2em]t52.east);
\end{scope}
\end{tikzpicture}
%---------------------------------------------------------------------
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
{\scriptsize
\node [anchor=north west,inner sep=1pt] (entry1) at (0,0) {\tiny{\textbf{1:} 这 是 数据 $\leftrightarrow$ This is data}};
\node [anchor=north west,inner sep=1pt] (entry2) at ([yshift=0.1em]entry1.south west) {\tiny{\textbf{2:} 小心 !$\leftrightarrow$ Look out !}};
\node [anchor=north west,inner sep=1pt] (entry3) at ([yshift=0.1em]entry2.south west) {\tiny{\textbf{3:} 你 是 谁 $\leftrightarrow$ Who are you}};
\node [anchor=north west,inner sep=2pt] (entry4) at ([yshift=0.1em]entry3.south west) {...};
\node [anchor=south west] (corpuslabel) at (entry1.north west) {{\color{ublue} \textbf{双语平行数据}}};
\begin{pgfonlayer}{background}
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow,minimum height=1.6cm] [fit = (entry1) (entry2) (entry3) (entry4) (corpuslabel)] (corpus) {};
\end{pgfonlayer}
}
\node [anchor=west,ugreen] (P) at ([xshift=4em,yshift=-0.7em]corpus.east){P($t|s$)};
\node [anchor=south] (modellabel) at (P.north) {{\color{ublue} {\scriptsize \textbf{翻译模型}}}};
\begin{pgfonlayer}{background}
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow,minimum height=1.6cm] [fit = (P) (modellabel)] (model) {};
\end{pgfonlayer}
\draw [->,very thick,ublue] ([xshift=0.2em]corpus.east) -- ([xshift=3.2em]corpus.east) node [pos=0.5, above] {\color{red}{\scriptsize{模型学习}}};
{
\draw [->,very thick,ublue] ([xshift=0.4em]model.east) -- ([xshift=3.4em]model.east) node [inner sep=0pt,pos=0.5, above,yshift=0.3em] (decodingarrow) {\color{red}{\scriptsize{穷举\&计算}}};
{\scriptsize
\node [anchor=north west,inner sep=2pt] (sentlabel) at ([xshift=5.5em,yshift=-0.3em]model.north east) {{\color{ublue} \textbf{机器翻译引擎}}};
\node [anchor=north west] (sent) at ([yshift=-0.5em]sentlabel.south west) {\textbf{对任意句子}};
\node [anchor=north west] (sentpart2) at ([yshift=0.3em]sent.south west) {\textbf{进行翻译}};
}
}
\begin{pgfonlayer}{background}
{
\node[rectangle,draw=ublue,thick,inner sep=0.2em,fill=white,drop shadow,minimum height=1.6cm] [fit = (sentlabel) (sent) (sentpart2)] (segsystem) {};
}
\end{pgfonlayer}
\end{tikzpicture}
%---------------------------------------------------------------------
......@@ -98,8 +98,8 @@
%----------------------------------------------------------------------------------------
% CHAPTERS
%----------------------------------------------------------------------------------------
\include{Chapter1/chapter1}
%\include{Chapter2/chapter2}
%\include{Chapter1/chapter1}
\include{Chapter2/chapter2}
%\include{Chapter3/chapter3}
......
......@@ -111,8 +111,8 @@
{\addvspace{3pt}\sffamily\bfseries} % Spacing and font options for sections
{\contentslabel[\thecontentslabel]{1.25cm}} % Formatting of numbered sections of this type
{} % Formatting of numberless sections of this type
{\hfill\color{black}\thecontentspage} % Formatting of the filler to the right of the heading and the page number
{ \titlerule*[.5pc]{.}\;\thecontentspage}%
%{\hfill\color{black}\thecontentspage} % Formatting of the filler to the right of the heading and the page number
% Subsection text styling
\titlecontents{subsection}
[1.25cm] % Left indentation
......@@ -540,8 +540,8 @@ addtohook={%
%----------------------------------------------------------------------------------------
\usepackage{chngpage}
\usepackage[justification=centering]{caption}%强制图片居中
\usepackage{subfigure}
\newcommand{\parinterval}{\noindent\hspace{2em}}%定义变量替代原来开头的控制缩进
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论