Commit cc957e53 by xiaotong

updates of section 2

parent e7da2f83
......@@ -883,7 +883,7 @@ I cannot see without my reading \underline{\ \ \ \ \ \ \ \ }
\end{eqnarray}
\begin{eqnarray}
\lambda(w_{i-1}) & = & \frac{d}{c_{\textrm{KN}}(w_{i-n+1}^{i-1})}|\{w:c_{\textrm{KN}}(w_{i-n+1}...w_{i-1}w)>0\}| \label{eq:2.4-18} \\
c_{\textrm{KN}}(\cdot) & = & \begin{cases} \textrm{count}(\cdot)\quad \textrm{for\ highest\ order} \\ \textrm{catcount}(\cdot)\quad \textrm{for\ lower\ order} \end{cases} \label{eq:2.4-19}
c_{\textrm{KN}}(\cdot) & = & \begin{cases} \textrm{count}(\cdot)\quad\quad \textrm{for\ highest\ order} \\ \textrm{catcount}(\cdot)\quad \textrm{for\ lower\ order} \end{cases} \label{eq:2.4-19}
\end{eqnarray}
\noindent 其中catcount$(\cdot)$表示的是基于某个单个词作为第$n$个词的$n$-gram的种类数目。
......@@ -897,7 +897,7 @@ c_{\textrm{KN}}(\cdot) & = & \begin{cases} \textrm{count}(\cdot)\quad \textrm{fo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{句子的句法树表示}\index{Chapter2.5.1}
\parinterval {\small\sffamily\bfseries{句法}}(Syntax)是研究句子的每个组成部分和它们之间的组合方式。一般来说,句法和语言是相关的,比如,英文是主谓宾结构,而日语是主宾谓结构。因此不同的语言也会有不同的句法描述方式。自然语言处理领域最常用的两种句法分析形式是{\small\sffamily\bfseries{短语结构分析}}(Phrase Structure Parsing)和{\small\sffamily\bfseries{依存分析}}(Dependency Parsing)。图\ref{fig:2.5-1}展示了这两种的句法表示形式的实例。其中,左侧是短语结构树。它描述的是短语的结构功能,比如``吃''是动词(记为VV),``鱼''是名词(记为NN),``吃\ 鱼''组成动词短语,这个短语再与``喜欢''这一动词组成新的动词短语。短语结构树的每个子树都是一个句法功能单元,比如,子树VP(VV(吃) NN(鱼))就表示了``吃\ 鱼''这个动词短语的结构,其中子树根节点VP是句法功能标记。短语结构树利用嵌套的方式描述了语言学的功能。短语结构树中,每个词都有词性(或词类),不同的词或者短语可以组成名动结构、动宾结构等语言学短语结构。短语结构分析一般也被称为{\small\bfnew{成分分析}}(Constituency Parsing){\small\bfnew{完全分析}}(Full Parsing)。
\parinterval {\small\sffamily\bfseries{句法}}(Syntax)是研究句子的每个组成部分和它们之间的组合方式。一般来说,句法和语言是相关的,比如,英文是主谓宾结构,而日语是主宾谓结构。因此不同的语言也会有不同的句法描述方式。自然语言处理领域最常用的两种句法分析形式是{\small\sffamily\bfseries{短语结构分析}}(Phrase Structure Parsing)和{\small\sffamily\bfseries{依存分析}}(Dependency Parsing)。图\ref{fig:2.5-1}展示了这两种的句法表示形式的实例。其中,左侧是短语结构树。它描述的是短语的结构功能,比如``吃''是动词(记为VV),``鱼''是名词(记为NN),``吃\ 鱼''组成动词短语,这个短语再与``喜欢''这一动词组成新的动词短语。短语结构树的每个子树都是一个句法功能单元,比如,子树VP(VV(吃) NN(鱼))就表示了``吃\ 鱼''这个动词短语的结构,其中子树根节点VP是句法功能标记。短语结构树利用嵌套的方式描述了语言学的功能。短语结构树中,每个词都有词性(或词类),不同的词或者短语可以组成名动结构、动宾结构等语言学短语结构。短语结构分析一般也被称为{\small\bfnew{成分分析}}(Constituency Parsing)或{\small\bfnew{完全分析}}(Full Parsing)。
%----------------------------------------------
% 图2.5.1.1
......@@ -911,12 +911,13 @@ c_{\textrm{KN}}(\cdot) & = & \begin{cases} \textrm{count}(\cdot)\quad \textrm{fo
\parinterval\ref{fig:2.5-1}右侧展示的是另一种句法结构,被称作依存句法树。依存句法树表示了句子中单词和单词之间的依存关系。比如,从这个例子可以了解,``猫''依赖``喜欢'',``吃''依赖``喜欢'',``鱼''依赖``吃''。
\parinterval 短语结构树和依存句法树的结构和功能有很大不同。短语结构树的叶子节点是单词,中间节点是词性或者短语句法标记。在短语结构分析中,通常把单词称作{\small\bfnew{终结符}}(Terminal),把词性称为{\small\bfnew{预终结符}}(Pre-terminal),而把其它句法标记称为{\small\bfnew{非终结符}}(Non-terminal)。依存句法树没有预终结符和非终结符,所有的节点都是句子里的单词,通过不同节点间的连线表示句子中各个单词之间的依存关系。每个依存关系实际上都是有方向的,头和尾分别指向``接受''和``发出''依存关系的词。依存关系也可以进行分类,如图\ref{fig:2.5-1}对每个依存关系的类型都进行了标记,这也被称作是有标记的依存分析。如果不生成这些标记,这样的句法分析被称作无标记的依存分析。
\parinterval 短语结构树和依存句法树的结构和功能有很大不同。短语结构树的叶子节点是单词,中间节点是词性或者短语句法标记。在短语结构分析中,通常把单词称作{\small\bfnew{终结符}}(Terminal),把词性称为{\small\bfnew{预终结符}}(Pre-terminal),而把其它句法标记称为{\small\bfnew{非终结符}}(Non-terminal)。依存句法树没有预终结符和非终结符,所有的节点都是句子里的单词,通过不同节点间的连线表示句子中各个单词之间的依存关系。每个依存关系实际上都是有方向的,头和尾分别指向``接受''和``发出''依存关系的词。依存关系也可以进行分类,\ref{fig:2.5-1}中我们对每个依存关系的类型都进行了标记,这也被称作是有标记的依存分析。如果不生成这些标记,这样的句法分析被称作无标记的依存分析。
\parinterval 虽然短语结构树和依存树的句法表现形式有很大不同,但是它们在某种条件下能相互转化。比如,可以使用启发性规则将短语结构树自动转化为依存树。从应用的角度,依存分析由于形式更加简单,而且直接建模词语之间的依赖,因此在自然语言处理领域中受到很多关注。在机器翻译中,不过无论是哪种句法树结构,都已经被证明会对机器翻译系统产生正向效果。特别是短语结构树,在机器翻译中的应用历史更长,研究更加深入,因此本节将会以短语结构分析为例介绍句法分析的相关概念。
\parinterval 虽然短语结构树和依存树的句法表现形式有很大不同,但是它们在某些条件下能相互转化。比如,可以使用启发性规则将短语结构树自动转化为依存树。从应用的角度,依存分析由于形式更加简单,而且直接建模词语之间的依赖,因此在自然语言处理领域中受到很多关注。在机器翻译中,不过无论是哪种句法树结构,都已经被证明会对机器翻译系统产生帮助。特别是短语结构树,在机器翻译中的应用历史更长,研究更为深入,因此本节将会以短语结构分析为例介绍句法分析的相关概念。
\parinterval 而句法分析到底是什么呢?简单的理解,句法分析就是我们在小学语文课程中学习的句子中的主谓宾等句子成分的分析,以及对句子中各个成分内部、外部关系的判断。更规范一些的定义,可以参照维基百科和百度百科的句法分析的解释。
\vspace{-0.5em}
\parinterval 而句法分析到底是什么呢?简单的理解,句法分析就是在小学语文课程中学习的句子成分的分析,以及对句子中各个成分内部、外部关系的判断。更规范一些的定义,可以参照维基百科和百度百科的句法分析的解释。
\vspace{-0.0em}
%-------------------------------------------
\begin{definition}
句法分析
......@@ -937,21 +938,20 @@ c_{\textrm{KN}}(\cdot) & = & \begin{cases} \textrm{count}(\cdot)\quad \textrm{fo
\end{itemize}
\vspace{0.5em}
\parinterval 以上要素在实现一个句法分析器中都需要考虑。因此,本节的后半部分会对相关的概念和技术方法进行介绍。
\parinterval 以上三点是实现一个句法分析器的要素。本节的后半部分会对相关的概念和技术方法进行介绍。
\vspace{-0.5em}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{上下文无关文法}\index{Chapter2.5.2}
\parinterval 句法树是对句子的一种抽象。这种树形结构对应着句子的归纳和生成过程,比如,从树的叶子开始,把每一个树节点看作一次抽象,最终形成整个句子的根节点。那么生成这种句法树结构的过程是如何用计算机实现出来呢?这就需要使用形式文法。
\parinterval 句法树是对句子的一种抽象。这种树形结构表达了一种对句子结构的归纳过程,比如,从树的叶子开始,把每一个树节点看作一次抽象,最终形成一个根节点。那这个过程是如何用计算机实现出来呢?这就需要使用到形式文法。
\parinterval 形式文法是句法分析中的核心内容,它不仅可以帮助我们分析计算机编程语言,也可以帮我们分析自然语言。根据乔姆斯基的定义\cite{chomsky2002syntactic},形式文法分为四种类型:无限制文法、上下文相关文法、上下文无关文法和正规文法。不同类型的文法有不同的应用,比如,正规文法可以用来描述自动机,因此也会被使用在语言模型等系统中。对于句法分析问题,这里使用上下文无关文法(context-free grammar),因为它是很多句法分析模型的基础。上下文无关文法的具体形式如下:
\parinterval 形式文法是分析自然语言的一种重要工具。根据乔姆斯基的定义\cite{chomsky2002syntactic},形式文法分为四种类型:无限制文法(0型文法)、上下文相关文法(1型文法)、上下文无关文法(2型文法)和正规文法(3型文法)。不同类型的文法有不同的应用,比如,正规文法可以用来描述自动机,因此也会被使用在语言模型等系统中。对于短语结构分析问题,常用的是{\small\bfnew{上下文无关文法}}(Context-Free Grammar)。上下文无关文法的具体形式如下:
%-------------------------------------------
\begin{definition}
一个上下文无关文法可以被视为一个系统$G=<N,\Sigma,R,S>$,其中
\begin{itemize}
\item
\item $N$为一个非终结符集合
\item $\Sigma$为一个终结符集合
\item $R$为一个规则(产生式)集合,每条规则 $r \in R$的形式为$X \to Y_1Y_2...Y_n$,其中$X \in N$, $Y_i \in N \cup \Sigma$
......@@ -962,7 +962,7 @@ c_{\textrm{KN}}(\cdot) & = & \begin{cases} \textrm{count}(\cdot)\quad \textrm{fo
\parinterval 举例说明,假设有上下文无关文法$G=<N,\Sigma,R,S>$,其中把非终结符集合定义为不同的句法标记
\begin{eqnarray}
\textrm{N}=\{\textrm{NN},\textrm{VV},\textrm{NP},\textrm{VP},\textrm{IP}\}
N=\{\textrm{NN},\textrm{VV},\textrm{NP},\textrm{VP},\textrm{IP}\}
\label{eq:2.5-1}
\end{eqnarray}
......@@ -974,7 +974,7 @@ c_{\textrm{KN}}(\cdot) & = & \begin{cases} \textrm{count}(\cdot)\quad \textrm{fo
再定义起始符集合为
\begin{eqnarray}
\textrm{S}=\{\textrm{IP}\}
S=\{\textrm{IP}\}
\label{eq:2.5-3}
\end{eqnarray}
......@@ -1022,7 +1022,6 @@ s_0 \overset{r_1}{\Rightarrow} s_1 \overset{r_2}{\Rightarrow} s_2 \overset{r_3}{
\begin{itemize}
\item
\item $\forall i \in [0,n], s_i \in (N\cup\Sigma)^*$ \hspace{3.5em} $\lhd$ $s_i$为合法的字符串
\item $\forall j \in [1,n], r_j \in R$ \hspace{6.3em} $\lhd$ $r_j$为G的规则
\item $s_0 \in S$ \hspace{10.9em} $\lhd$ $s_0$为起始非终结符
......
\indexentry{Chapter2.1|hyperpage}{6}
\indexentry{Chapter2.2|hyperpage}{7}
\indexentry{Chapter2.2.1|hyperpage}{7}
\indexentry{Chapter2.2.2|hyperpage}{9}
\indexentry{Chapter2.2.3|hyperpage}{10}
\indexentry{Chapter2.2.4|hyperpage}{11}
\indexentry{Chapter2.2.5|hyperpage}{13}
\indexentry{Chapter2.2.5.1|hyperpage}{13}
\indexentry{Chapter2.2.5.2|hyperpage}{14}
\indexentry{Chapter2.2.5.3|hyperpage}{14}
\indexentry{Chapter2.3|hyperpage}{15}
\indexentry{Chapter2.3.1|hyperpage}{16}
\indexentry{Chapter2.3.2|hyperpage}{17}
\indexentry{Chapter2.3.2.1|hyperpage}{17}
\indexentry{Chapter2.3.2.2|hyperpage}{18}
\indexentry{Chapter2.3.2.3|hyperpage}{20}
\indexentry{Chapter2.4|hyperpage}{22}
\indexentry{Chapter2.4.1|hyperpage}{23}
\indexentry{Chapter2.4.2|hyperpage}{25}
\indexentry{Chapter2.4.2.1|hyperpage}{26}
\indexentry{Chapter2.4.2.2|hyperpage}{27}
\indexentry{Chapter2.4.2.3|hyperpage}{28}
\indexentry{Chapter2.5|hyperpage}{30}
\indexentry{Chapter2.5.1|hyperpage}{30}
\indexentry{Chapter2.5.2|hyperpage}{32}
\indexentry{Chapter2.5.3|hyperpage}{35}
\indexentry{Chapter2.6|hyperpage}{39}
\indexentry{Chapter2.1|hyperpage}{8}
\indexentry{Chapter2.2|hyperpage}{9}
\indexentry{Chapter2.2.1|hyperpage}{9}
\indexentry{Chapter2.2.2|hyperpage}{11}
\indexentry{Chapter2.2.3|hyperpage}{12}
\indexentry{Chapter2.2.4|hyperpage}{13}
\indexentry{Chapter2.2.5|hyperpage}{15}
\indexentry{Chapter2.2.5.1|hyperpage}{15}
\indexentry{Chapter2.2.5.2|hyperpage}{16}
\indexentry{Chapter2.2.5.3|hyperpage}{16}
\indexentry{Chapter2.3|hyperpage}{17}
\indexentry{Chapter2.3.1|hyperpage}{18}
\indexentry{Chapter2.3.2|hyperpage}{19}
\indexentry{Chapter2.3.2.1|hyperpage}{19}
\indexentry{Chapter2.3.2.2|hyperpage}{20}
\indexentry{Chapter2.3.2.3|hyperpage}{22}
\indexentry{Chapter2.4|hyperpage}{24}
\indexentry{Chapter2.4.1|hyperpage}{25}
\indexentry{Chapter2.4.2|hyperpage}{27}
\indexentry{Chapter2.4.2.1|hyperpage}{28}
\indexentry{Chapter2.4.2.2|hyperpage}{29}
\indexentry{Chapter2.4.2.3|hyperpage}{30}
\indexentry{Chapter2.5|hyperpage}{32}
\indexentry{Chapter2.5.1|hyperpage}{32}
\indexentry{Chapter2.5.2|hyperpage}{34}
\indexentry{Chapter2.5.3|hyperpage}{38}
\indexentry{Chapter2.6|hyperpage}{40}
......@@ -71,15 +71,29 @@
~\vfill
\thispagestyle{empty}
\noindent Copyright \copyright\ 2020 Xiao Tong and Jingbo Zhu\\ % Copyright notice
\noindent Copyright \copyright\ 2020 肖桐\ \ 朱靖波\\ % Copyright notice
\noindent \textsc{Published by \red{NLP Lab. at Northeastern University\ /\ NiuTrans Research}}\\ % Publisher
\noindent \textsc{东北大学自然语言处理实验室\ /\ 小牛翻译}\\ % Publisher
\noindent \textsc{\url{http://47.105.50.196/NiuTrans/Toy-MT-Introduction/tree/master/Book}}\\ % URL
\noindent {\red{Licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License (the ``License''). You may not use this file except in compliance with the License. You may obtain a copy of the License at \url{http://creativecommons.org/licenses/by-nc/3.0}. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \textsc{``as is'' basis, without warranties or conditions of any kind}, either express or implied. See the License for the specific language governing permissions and limitations under the License.}}\\ % License information, replace this with your own license (if any)
\noindent \textit{First printing, \red{March 2020}} % Printing/edition date
\noindent \textit{First Edition, April 2020}
%----------------------------------------------------------------------------------------
% ACKNOWLEDGE PAGE
%----------------------------------------------------------------------------------------
\newpage
~\vfill
\thispagestyle{empty}
{\large
\noindent {\color{red} 在此感谢所有为本书做出贡献的人} \\
\noindent 曹润柘、曾信、孟霞、单韦乔、姜雨帆、王子扬、刘辉、许诺、李北、刘继强、张哲旸、周书涵、周涛、张裕浩、刘晓倩、牛蕊 \\
}
%----------------------------------------------------------------------------------------
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论