This part of code is wrong:
|
for ro in row: |
|
if ro in var1: |
|
table[i][j].add(var0[var1.index(ro)]) |
Code checks if 'ro' exists in var and if so adds symbol to table cell. But there may be more productions with 'ro' symbols in it, so loop is needed.
Possible solution:
for idx, v in enumerate(var1):
if v in row:
table[i][j].add(var0[idx])
It will check all matching productions, not only one.
This part of code is wrong:
automata-cyk/cyk_main.py
Lines 96 to 98 in 13723da
Code checks if 'ro' exists in var and if so adds symbol to table cell. But there may be more productions with 'ro' symbols in it, so loop is needed.
Possible solution:
It will check all matching productions, not only one.