Skip to main content
QUICK REVIEW

[论文解读] An error correcting parser for context free grammars that takes less than cubic time

Sanguthevar Rajasekaran, Marius Nicolae|arXiv (Cornell University)|Jun 13, 2014
semigroups and automata theory参考文献 11被引用 8
一句话总结

本文提出了一种用于上下文无关文法的纠错解析器,通过将语言编辑距离问题约化为热带矩阵乘法,实现了小于三次方时间的运行效率。主要贡献在于提出了一种精确算法,时间复杂度为 $ O\big(n^3 (\text{log}\text{log}\text{ }n)^3 / (\text{log}\text{ }n)^2\big) $,以及一种 $ \frac{n}{M} $-近似算法,时间复杂度为 $ O(Mn^\omega) $,其中 $ \omega \approx 2.376 $,优于 Aho 和 Peterson 在 1972 年建立的三次方时间界限。

ABSTRACT

The problem of parsing has been studied extensively for various formal grammars. Given an input string and a grammar, the parsing problem is to check if the input string belongs to the language generated by the grammar. A closely related problem of great importance is one where the input are a string ${\cal I}$ and a grammar $G$ and the task is to produce a string ${\cal I}'$ that belongs to the language generated by $G$ and the `distance' between ${\cal I}$ and ${\cal I}'$ is the smallest (from among all the strings in the language). Specifically, if ${\cal I}$ is in the language generated by $G$, then the output should be ${\cal I}$. Any parser that solves this version of the problem is called an {\em error correcting parser}. In 1972 Aho and Peterson presented a cubic time error correcting parser for context free grammars. Since then this asymptotic time bound has not been improved under the (standard) assumption that the grammar size is a constant. In this paper we present an error correcting parser for context free grammars that runs in $O(T(n))$ time, where $n$ is the length of the input string and $T(n)$ is the time needed to compute the tropical product of two $n imes n$ matrices. In this paper we also present an $\frac{n}{M}$-approximation algorithm for the {\em language edit distance problem} that has a run time of $O(Mn^ω)$, where $O(n^ω)$ is the time taken to multiply two $n imes n$ matrices. To the best of our knowledge, no approximation algorithms have been proposed for error correcting parsing for general context free grammars.

研究动机与目标

  • 为 1972 年 Aho 和 Peterson 建立的上下文无关文法纠错解析的长期 $ O(n^3) $ 时间界限提供突破。
  • 设计一种解析器,比三次方时间更高效地计算输入字符串与给定 CFG 语言中字符串之间的最小编辑距离。
  • 为上下文无关文法的一般语言编辑距离问题提供首个具有性能保证的近似算法。
  • 证明语言编辑距离问题可约化为计算 $ n \times n $ 矩阵的热带积,从而借助先进的矩阵乘法技术实现更快的算法。

提出的方法

  • 该方法将语言编辑距离问题约化为计算两个 $ n \times n $ 矩阵的热带积(最小-加法积),并利用该操作的已知算法。
  • 该算法基于 CYK 解析器框架的动态规划方法,通过矩阵运算扩展以处理编辑操作(插入、删除、替换)。
  • 对于精确解析,该方法采用改进的 CYK 风格算法,利用热带矩阵乘法计算最小编辑距离,当使用快速矩阵乘法时可实现次立方时间。
  • 对于近似解析,该算法将编辑距离限制在 $ M $ 以内,将大于 $ M $ 的值替换为 $ M+1 $,从而实现 $ O(Mn^\omega) $ 的运行时间。
  • 通过在计算得到的矩阵上递归回溯,可在 $ O(n^2) $ 时间内重构解析结果 $ \mathcal{I}' $。
  • 该方法确保所有矩阵元素均被限制在 $ M+1 $ 以内,以保持值的有界性,并在近似模型下实现高效计算。

实验结果

研究问题

  • RQ1一般上下文无关文法的语言编辑距离问题能否在小于三次方时间内求解?
  • RQ2能否设计一种具有次立方运行时间与有界近似因子的近似算法来解决语言编辑距离问题?
  • RQ3将语言编辑距离约化为热带矩阵乘法是否能实现更快的解析算法?
  • RQ4所提出的解析器在时间复杂度与实际效率方面与经典的 Aho-Peterson 算法相比表现如何?

主要发现

  • 本文提出了一种用于上下文无关文法的精确纠错解析器,其时间复杂度为 $ O\big(n^3 (\text{log}\text{log}\text{ }n)^3 / (\text{log}\text{ }n)^2\big) $,优于 1972 年的 $ O(n^3) $ 界限。
  • 提出了一种 $ \frac{n}{M} $-近似算法,其运行时间为 $ O(Mn^\omega) $,其中 $ \omega \approx 2.376 $,当 $ M $ 较小时可实现次立方性能。
  • 将语言编辑距离问题约化为热带矩阵乘法,建立了解析与高级矩阵计算之间的新联系。
  • 可通过计算得到的矩阵与回溯过程,在 $ O(n^2) $ 时间内重构出达到最小编辑距离的字符串 $ \mathcal{I}' $。
  • 所提算法比以往的三次方时间方法更简单,并通过利用快速矩阵乘法实现了更优的渐近性能。
  • 该工作首次为一般上下文无关语言编辑距离问题提供了近似算法,填补了文献中的关键空白。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。