Note that there are some explanatory texts on larger screens.

plurals
  1. POEfficient Context-Free Grammar parser, preferably Python-friendly
    primarykey
    data
    text
    <p>I am in need of parsing a small subset of English for one of my project, described as a context-free grammar with (1-level) feature structures (<a href="http://code.google.com/p/nltk/source/browse/trunk/nltk/examples/grammars/book_grammars/feat0.fcfg?r=8260">example</a>) and I need to do it efficiently .</p> <p>Right now I'm using <a href="http://www.nltk.org/">NLTK</a>'s parser which produces the right output but is very slow. For my grammar of ~450 fairly ambiguous non-lexicon rules and half a million lexical entries, parsing simple sentences can take anywhere from 2 to 30 seconds, depending it seems on the number of resulting trees. Lexical entries have little to no effect on performance.</p> <p>Another problem is that loading the (25MB) grammar+lexicon at the beginning can take up to a minute.</p> <p>From what I can find in literature, the running time of the algorithm used to parse such a grammar (Earley or CKY) should be linear to the size of the grammar and cubic to the size of the input token list. My experience with NLTK indicates that ambiguity is what hurts the performance most, not the absolute size of the grammar.</p> <p>So now I'm looking for a CFG parser to replace NLTK. I've been considering <a href="http://www.dabeaz.com/ply/">PLY</a> but I can't tell whether it supports feature structures in CFGs, which are required in my case, and the examples I've seen seem to be doing a lot of procedural parsing rather than just specifying a grammar. Can anybody show me an example of PLY both supporting feature structs and using a declarative grammar?</p> <p>I'm also fine with any other parser that can do what I need efficiently. A Python interface is preferable but not absolutely necessary.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload