Skip to content
This repository was 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

Description

@rivit98

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions