Changeset 254 for liacs/TPFL2010/assignment3
- Timestamp:
- Dec 15, 2010, 4:56:08 PM (14 years ago)
- Location:
- liacs/TPFL2010/assignment3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
liacs/TPFL2010/assignment3/cyk.py
r253 r254 6 6 7 7 8 # Word to search for 8 9 # CNF from example pg. 142 9 10 w = 'cabab' 10 11 # CNF12 11 cnf = { 13 12 'S' : ['AB','b'], … … 15 14 'B' : ['AS', 'b'], 16 15 'C' : ['BS', 'c'], 16 } 17 18 w = 'babbab' 19 cnf = { 20 'S' : ['AB','b'], 21 'A' : ['BC', 'a'], 22 'B' : ['AS', 'CB', 'b'], 23 'C' : ['SS', 'a'], 17 24 } 18 25 … … 68 75 print ''' 69 76 \\end{tabular} 70 \\label{tb:cyk} 71 \\caption{$CYK(L(G),babbbab)$. Algoritme in \cite{JS2009}[pg.~142]} 77 \\caption{$CYK(L(G),%s)$. Algoritme in \cite{JS2009}[pg.~142]} 72 78 \\end{table} 73 ''' 79 ''' % w 74 80 75 81 … … 92 98 return None 93 99 else: 94 return ",".join([ str(x) for x in r])100 return ",".join(["(%s,%s,%s)" % (x[0],x[1],x[2]) for x in r]) 95 101 96 102 -
liacs/TPFL2010/assignment3/report.tex
r253 r254 14 14 \usepackage{tikz} 15 15 \usepackage{fixltx2e} 16 \usepackage{rotating} 16 17 17 18 \usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri} … … 61 62 62 63 63 \begin{ table}[htbp]64 \begin{sidewaystable}[htbp] 64 65 \center 65 \begin{tabular}{|c||c|c|c|c|c| }66 \begin{tabular}{|c||c|c|c|c|c|c|} 66 67 \hline 67 68 68 i\textbackslash j & 1 & 2 & 3 & 4 & 5 \\ \hline \hline 69 1 & \begin{tabular}{l} C \\ \end{tabular} & \begin{tabular}{l} $\emptyset$ \end{tabular} & \begin{tabular}{l} A: ('C', 'B', 1) \\ \end{tabular} & \begin{tabular}{l} A: ('A', 'A', 3) \\ \end{tabular} & \begin{tabular}{l} S: ('A', 'B', 3),('A', 'B', 4) \\B: ('A', 'S', 3),('A', 'S', 4) \\ \end{tabular} \\ \hline 70 2 & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} A \\ \end{tabular} & \begin{tabular}{l} S: ('A', 'B', 2) \\B: ('A', 'S', 2) \\ \end{tabular} & \begin{tabular}{l} $\emptyset$ \end{tabular} & \begin{tabular}{l} C: ('B', 'S', 3) \\ \end{tabular} \\ \hline 71 3 & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} S \\B \\ \end{tabular} & \begin{tabular}{l} $\emptyset$ \end{tabular} & \begin{tabular}{l} C: ('B', 'S', 3) \\ \end{tabular} \\ \hline 72 4 & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} A \\ \end{tabular} & \begin{tabular}{l} S: ('A', 'B', 4) \\B: ('A', 'S', 4) \\ \end{tabular} \\ \hline 73 5 & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} S \\B \\ \end{tabular} \\ \hline 69 i\textbackslash j & 1 & 2 & 3 & 4 & 5 & 6 \\ \hline \hline 70 1 & \begin{tabular}{l} S \\B \\ \end{tabular} & \begin{tabular}{l} A: (B,C,1) \\ \end{tabular} & \begin{tabular}{l} C: (S,S,1) \\S: (A,B,2) \\B: (A,S,2) \\ \end{tabular} & \begin{tabular}{l} A: (B,C,1) \\B: (C,B,3) \\C: (S,S,3) \\ \end{tabular} & \begin{tabular}{l} A: (B,C,4) \\ \end{tabular} & \begin{tabular}{l} A: (B,C,1),(B,C,3) \\C: (S,S,1),(S,S,3) \\S: (A,B,2),(A,B,4),(A,B,5) \\B: (C,B,3),(A,S,4),(C,B,4),(A,S,5) \\ \end{tabular} \\ \hline 71 2 & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} A \\C \\ \end{tabular} & \begin{tabular}{l} S: (A,B,2) \\B: (A,S,2),(C,B,2) \\ \end{tabular} & \begin{tabular}{l} C: (S,S,3) \\ \end{tabular} & \begin{tabular}{l} $\emptyset$ \end{tabular} & \begin{tabular}{l} S: (A,B,2) \\B: (C,B,2),(C,B,4) \\A: (B,C,3) \\C: (S,S,3) \\ \end{tabular} \\ \hline 72 3 & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} S \\B \\ \end{tabular} & \begin{tabular}{l} C: (S,S,3) \\ \end{tabular} & \begin{tabular}{l} $\emptyset$ \end{tabular} & \begin{tabular}{l} A: (B,C,3) \\C: (S,S,3) \\B: (C,B,4) \\ \end{tabular} \\ \hline 73 4 & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} S \\B \\ \end{tabular} & \begin{tabular}{l} A: (B,C,4) \\ \end{tabular} & \begin{tabular}{l} C: (S,S,4) \\S: (A,B,5) \\B: (A,S,5) \\ \end{tabular} \\ \hline 74 5 & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} A \\C \\ \end{tabular} & \begin{tabular}{l} S: (A,B,5) \\B: (A,S,5),(C,B,5) \\ \end{tabular} \\ \hline 75 6 & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} \end{tabular} & \begin{tabular}{l} S \\B \\ \end{tabular} \\ \hline 74 76 75 77 \end{tabular} 76 \label{tb:cyk} 77 \caption{$CYK(L(G),babbbab)$. Algoritme in \cite{JS2009}[pg.~142]} 78 \end{table} 78 \caption{$CYK(L(G),a)$. Algoritme in \cite{JS2009}[pg.~142]} 79 \end{sidewaystable} 79 80 80 81 \section{Opgave 5.5}
Note:
See TracChangeset
for help on using the changeset viewer.