Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
Toy-MT-Introduction
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
单韦乔
Toy-MT-Introduction
Commits
f3d7a392
Commit
f3d7a392
authored
Mar 22, 2020
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixes of CYK
parent
d0ba52a4
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
16 行删除
+17
-16
Section04-Phrasal-and-Syntactic-Models/section04.tex
+17
-16
没有找到文件。
Section04-Phrasal-and-Syntactic-Models/section04.tex
查看文件 @
f3d7a392
...
@@ -3724,7 +3724,7 @@ d = r_1 \circ r_2 \circ r_3 \circ r_4
...
@@ -3724,7 +3724,7 @@ d = r_1 \circ r_2 \circ r_3 \circ r_4
\begin{center}
\begin{center}
\begin{tikzpicture}
\begin{tikzpicture}
\node
[anchor=south west,rectangle,draw=ublue,thick,inner sep=0.4em,fill=white,drop shadow] (sourceG) at (0,0)
{{
\color
{
ublue
}
\footnotesize
{
\textbf
{
S端文法
}}}}
;
\node
[anchor=south west,rectangle,draw=ublue,thick,inner sep=0.4em,fill=white,drop shadow] (sourceG) at (0,0)
{{
\color
{
ublue
}
\footnotesize
{
\textbf
{
S端文法
}}}}
;
\node
[anchor=west,rectangle,draw=ublue,thick,inner sep=0.4em,fill=white,drop shadow] (chom) at ([xshift=3.5em]sourceG.east)
{{
\color
{
ublue
}
\footnotesize
{
\textbf
{
乔姆斯基范式
}}}}
;
\node
[anchor=west,rectangle,draw=ublue,thick,inner sep=0.4em,fill=white,drop shadow] (chom) at ([xshift=3.5em]sourceG.east)
{{
\color
{
ublue
}
\footnotesize
{
\textbf
{
乔姆斯基范式
(CNF)
}}}}
;
\node
[anchor=west,rectangle,draw=ublue,thick,inner sep=0.4em,fill=white,drop shadow] (targetG) at ([xshift=3.5em]chom.east)
{{
\color
{
ublue
}
\footnotesize
{
\textbf
{
T端文法
}}}}
;
\node
[anchor=west,rectangle,draw=ublue,thick,inner sep=0.4em,fill=white,drop shadow] (targetG) at ([xshift=3.5em]chom.east)
{{
\color
{
ublue
}
\footnotesize
{
\textbf
{
T端文法
}}}}
;
\draw
[->,very thick]
([xshift=0.1em]sourceG.east) -- ([xshift=-0.1em]chom.west);
\draw
[->,very thick]
([xshift=0.1em]sourceG.east) -- ([xshift=-0.1em]chom.west);
...
@@ -3751,27 +3751,28 @@ d = r_1 \circ r_2 \circ r_3 \circ r_4
...
@@ -3751,27 +3751,28 @@ d = r_1 \circ r_2 \circ r_3 \circ r_4
\begin{itemize}
\begin{itemize}
\item
CYK算法通过遍历不同
\alert
{
span
}
来判断字符串是否符合文法
\item
CYK算法通过遍历不同
\alert
{
span
}
来判断字符串是否符合文法
\begin{itemize}
\begin{itemize}
\item
输入:源语串
\textbf
{
s =
}
$
s
_
1
... s
_
J
$
,以及
上下文无关
文法
$
G
$
\item
输入:源语串
\textbf
{
s =
}
$
s
_
1
... s
_
J
$
,以及
CNF
文法
$
G
$
\item
输出:判断字符串是否符合
上下文无关文法
\item
输出:判断字符串是否符合
G
\end{itemize}
\end{itemize}
\vspace
{
-0.
7
em
}
\vspace
{
-0.
3
em
}
\begin{center}
\begin{center}
\begin{tikzpicture}
\begin{tikzpicture}
\tikzstyle
{
alignmentnode
}
= [rectangle,fill=blue!30,minimum size=0.45em,text=white,inner sep=0.1pt]
\tikzstyle
{
alignmentnode
}
= [rectangle,fill=blue!30,minimum size=0.45em,text=white,inner sep=0.1pt]
\tikzstyle
{
selectnode
}
= [rectangle,fill=green!20,minimum height=1.5em,minimum width=1.5em,inner sep=1.2pt]
\tikzstyle
{
selectnode
}
= [rectangle,fill=green!20,minimum height=1.5em,minimum width=1.5em,inner sep=1.2pt]
\tikzstyle
{
srcnode
}
= [anchor=south west]
\tikzstyle
{
srcnode
}
= [anchor=south west]
\begin{scope}
[scale=0.85]
\begin{scope}
[scale=0.85]
\node
[srcnode]
(c1) at (0,0)
{
\small
{
\textbf
{
Function
}
CKY-Algorithm(
$
s,G
$
)
}}
;
\node
[srcnode,anchor=north west]
(c21) at ([xshift=1.5em,yshift=0.4em]c1.south west)
{
\small
{
\textbf
{
foreach
}
(
$
j
_
1
, j
_
2
$
): 0
$
\leq
j
_
1
,j
_
2
\leq
J
$
and
$
j
_
1
\textless
j
_
2
$}}
;
\node
[srcnode]
(c1) at (0,0)
{
\small
{
\textbf
{
Function
}
CYK-Algorithm(
$
s,G
$
)
}}
;
\node
[srcnode,anchor=north west]
(c22) at ([xshift=1.5em,yshift=0.4em]c21.south west)
{
\small
{$
span
[
j
_
1
,j
_
2
]
$
.updatePhrase(
$
G
$
)
}}
;
\node
[srcnode,anchor=north west]
(c21) at ([xshift=1.5em,yshift=0.4em]c1.south west)
{
\small
{
\textbf
{
fore
}
$
j
=
0
$
to
$
J
-
1
$}}
;
\node
[srcnode,anchor=north west]
(c22) at ([xshift=1.5em,yshift=0.4em]c21.south west)
{
\small
{$
span
[
j,j
+
1
]
$
.Add(
$
A
\to
a
\in
G
$
)
}}
;
\node
[srcnode,anchor=north west]
(c3) at ([xshift=-1.5em,yshift=0.4em]c22.south west)
{
\small
{
\textbf
{
for
}
$
l
_{
span
}$
= 1 to
$
J
$}}
;
\node
[srcnode,anchor=north west]
(c3) at ([xshift=-1.5em,yshift=0.4em]c22.south west)
{
\small
{
\textbf
{
for
}
$
l
_{
span
}$
= 1 to
$
J
$}}
;
\node
[srcnode,anchor=west]
(c31) at ([xshift=6em]c3.east)
{
\small
{
// length of span
}}
;
\node
[srcnode,anchor=west]
(c31) at ([xshift=6em]c3.east)
{
\small
{
// length of span
}}
;
\node
[srcnode,anchor=north west]
(c4) at ([xshift=1.5em,yshift=0.4em]c3.south west)
{
\small
{
\textbf
{
for
}
$
j
$
= 0 to
$
J
-
l
_{
span
}
$}}
;
\node
[srcnode,anchor=north west]
(c4) at ([xshift=1.5em,yshift=0.4em]c3.south west)
{
\small
{
\textbf
{
for
}
$
j
$
= 0 to
$
J
-
l
$}}
;
\node
[srcnode,anchor=north west]
(c41) at ([yshift=0.4em]c31.south west)
{
\small
{
// begining of span
}}
;
\node
[srcnode,anchor=north west]
(c41) at ([yshift=0.4em]c31.south west)
{
\small
{
// begin
n
ing of span
}}
;
\node
[srcnode,anchor=north west]
(c5) at ([xshift=1.5em,yshift=0.4em]c4.south west)
{
\small
{
\textbf
{
for
}
$
k
$
=
$
j
$
to
$
j
+
l
_{
span
}
$}}
;
\node
[srcnode,anchor=north west]
(c5) at ([xshift=1.5em,yshift=0.4em]c4.south west)
{
\small
{
\textbf
{
for
}
$
k
$
=
$
j
$
to
$
j
+
l
$}}
;
\node
[srcnode,anchor=north west]
(c51) at ([yshift=0.4em]c41.south west)
{
\small
{
// partition of span
}}
;
\node
[srcnode,anchor=north west]
(c51) at ([yshift=0.4em]c41.south west)
{
\small
{
// partition of span
}}
;
\node
[srcnode,anchor=north west]
(c6) at ([xshift=1.5em,yshift=0.4em]c5.south west)
{
\small
{$
hypos
$
= Compose(
$
span
[
j, k
]
, span
[
k, j
+
l
_{
span
}
]
$
)
}}
;
\node
[srcnode,anchor=north west]
(c6) at ([xshift=1.5em,yshift=0.4em]c5.south west)
{
\small
{$
hypos
$
= Compose(
$
span
[
j, k
]
, span
[
k, j
+
l
]
$
)
}}
;
\node
[srcnode,anchor=north west]
(c7) at ([yshift=0.4em]c6.south west)
{
\small
{$
span
[
j, j
+
l
_{
span
}
]
$
.u
pdate(
$
hypos
$
)
}}
;
\node
[srcnode,anchor=north west]
(c7) at ([yshift=0.4em]c6.south west)
{
\small
{$
span
[
j, j
+
l
]
$
.U
pdate(
$
hypos
$
)
}}
;
\node
[srcnode,anchor=north west]
(c8) at ([xshift=-4.5em,yshift=0.4em]c7.south west)
{
\small
{
\textbf
{
return
}
$
span
[
0
, J
]
$}}
;
\node
[srcnode,anchor=north west]
(c8) at ([xshift=-4.5em,yshift=0.4em]c7.south west)
{
\small
{
\textbf
{
return
}
$
span
[
0
, J
]
$}}
;
...
@@ -3784,13 +3785,13 @@ d = r_1 \circ r_2 \circ r_3 \circ r_4
...
@@ -3784,13 +3785,13 @@ d = r_1 \circ r_2 \circ r_3 \circ r_4
\node
[srcnode]
(s7) at ([xshift=1em]s6.south east)
{$
s
_
6
$}
;
\node
[srcnode]
(s7) at ([xshift=1em]s6.south east)
{$
s
_
6
$}
;
\node
[srcnode]
(s8) at ([xshift=1em]s7.south east)
{$
s
_
7
$}
;
\node
[srcnode]
(s8) at ([xshift=1em]s7.south east)
{$
s
_
7
$}
;
\node
[srcnode,anchor=center]
(j1) at ([yshift=-1.4em]s3.south)
{$
j
$}
;
\node
[srcnode,anchor=center]
(j1) at ([yshift=-1.4em
,xshift=-0.8em
]s3.south)
{$
j
$}
;
\node
[srcnode,anchor=center]
(j2) at ([yshift=-1.4em]s7.south)
{$
j
+
l
_{
span
}$}
;
\node
[srcnode,anchor=center]
(j2) at ([yshift=-1.4em
,xshift=0.8em
]s7.south)
{$
j
+
l
_{
span
}$}
;
\node
[srcnode,anchor=center]
(k) at ([xshift=1.5em,yshift=-1.5em]s4.south)
{$
k
$}
;
\node
[srcnode,anchor=center]
(k) at ([xshift=1.5em,yshift=-1.5em]s4.south)
{$
k
$}
;
\draw
[->,thick]
([yshift=-0.
1em]j1.north)--([yshift=0.1em]s3.sou
th);
\draw
[->,thick]
([yshift=-0.
3em,xshift=-0.8em]j1.north)--([yshift=0.5em,xshift=-0.8em]j1.nor
th);
\draw
[->,thick]
([yshift=-0.
1em]j2.north)--([yshift=0.1em]s7.sou
th);
\draw
[->,thick]
([yshift=-0.
3em,xshift=0.8em]j2.north)--([yshift=0.5em,xshift=0.8em]j2.nor
th);
\draw
[->,thick]
([yshift=-0.1em]k.north)--([xshift=1.5em,yshift=0.1em]s4.south);
\draw
[->,thick]
([yshift=-0.1em]k.north)--([xshift=1.5em,yshift=0.1em]s4.south);
\node
[rectangle,inner sep=0.3em,rounded corners=1pt,very thick,dotted,draw=ugreen] [fit = (s3) (s7)] (box1)
{}
;
\node
[rectangle,inner sep=0.3em,rounded corners=1pt,very thick,dotted,draw=ugreen] [fit = (s3) (s7)] (box1)
{}
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论