Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

cyk algorithm doesn't add all symbols to the cyk-table #1

Open
rivit98 opened this issue Dec 20, 2020 · 0 comments
Open

cyk algorithm doesn't add all symbols to the cyk-table #1

rivit98 opened this issue Dec 20, 2020 · 0 comments

Comments

@rivit98
Copy link

rivit98 commented Dec 20, 2020

This part of code is wrong:

automata-cyk/cyk_main.py

Lines 96 to 98 in 13723da

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant