Efficient enumeration algorithms for annotated grammars

01/03/2022
by   Antoine Amarilli, et al.
0

We introduce annotated grammars, an extension of context-free grammars which allows annotations on terminals. Our model extends the standard notion of regular spanners, and has the same expressiveness as the extraction grammars recently introduced by Peterfreund. We study the enumeration problem for annotated grammars: fixing a grammar, and given a string as input, enumerate all annotations of the string that form a word derivable from the grammar. Our first result is an algorithm for unambiguous annotated grammars, which preprocesses the input string in cubic time and enumerates all annotations with output-linear delay. This improves over Peterfreund's result, which needs quintic time preprocessing to achieve this delay bound. We then study how we can reduce the preprocessing time while keeping the same delay bound, by making additional assumptions on the grammar. Specifically, we present a class of grammars which only have one derivation shape for all outputs, for which we can enumerate with quadratic time preprocessing. We also give classes generalizing regular spanners for which linear time preprocessing suffices.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
09/25/2022

Constant-delay enumeration for SLP-compressed documents

We study the problem of enumerating results from a query over a compress...
research
06/04/2023

A Fast Algorithm for Computing Prefix Probabilities

Multiple algorithms are known for efficiently calculating the prefix pro...
research
03/15/2020

Grammars for Document Spanenrs

A new grammar-based language for defining information-extractors from te...
research
03/15/2020

Grammars for Document Spanners

A new grammar-based language for defining information-extractors from te...
research
10/12/2020

Constant-delay enumeration algorithms for document spanners over nested documents

Some of the most relevant document schemas used online, such as XML and ...
research
02/10/2019

Balancing Straight-Line Programs

It is shown that a context-free grammar of size m that produces a single...
research
01/25/2021

Spanner Evaluation over SLP-Compressed Documents

We consider the problem of evaluating regular spanners over compressed d...

Please sign up or login with your details

Forgot password? Click here to reset