编辑:错误是此行if len(rhs) == 2 and rhs[0] in T[i][k] and rhs[1] in T[k + 1][j]: 我能够使用少量的规则、终端和非终端实现基于cky解析器wiki的cky算法。但是我扩展了它以包含更多的规则,单词,语法,现在它给了我IndexError: list index out of range,有人知道我在更大的语法集上做错了什么吗? 以下是前面的较小规模的语法,如果有帮助的话。 non_terminals = ["NP", "Nom", "Det", "AP",
所以我一直在维基百科和许多powerpoint/pdf上阅读关于的文章。let the input be a string S consisting of n characters: a1 ... an.This grammar contains the subset Rs which is the set of start symbols.
let P[n,n,r] be an array