an Earley parser in XQuery?

Monday, 22 August 2022 · 7 messages · last reply 25 Aug 2022
MH
Martin Honnenin reply to Graydon Saunders, 22 Aug 2022, 21:0822 Aug 2022 19:42 #
Quoted text · Graydon Saunders · 9 lines
On 22.08.2022 19:07, Graydon Saunders wrote: > > > I'm trying to test if some extracted sentences validate as productions > of a particular context-free grammar expressed in a BNF dialect. > > Is there an available implementation of a parser in XQuery that can do > this? >
In the context of Invisible XML https://invisiblexml.org/ I have heard that term "Earley" parser a lot but I am not familiar enough with the various implementations to tell whether all are "Earley" parsers, https://github.com/cmsmcq/Aparecium is an XQuery implementation of Invisible XML. I think the various NineML tools by Norman Walsh use an Earley parser and are written in Java, there is an XPath/XQuery/XSLT extension for Saxon, so it should be possible to integrate that in BaseX, perhaps, too.
GS
Graydon Saunders22 Aug 2022 21:08 #
Hello -- I'm trying to test if some extracted sentences validate as productions of a particular context-free grammar expressed in a BNF dialect. Is there an available implementation of a parser in XQuery that can do this? Thanks! Graydon
G
Graydonin reply to Martin Honnen, 22 Aug 2022, 19:4223 Aug 2022 02:00 #
Quoted text · Graydon Saunders · 13 lines
On Mon, Aug 22, 2022 at 07:42:39PM +0200, Martin Honnen scripsit: > On 22.08.2022 19:07, Graydon Saunders wrote: > > I'm trying to test if some extracted sentences validate as productions > > of a particular context-free grammar expressed in a BNF dialect. > > > > Is there an available implementation of a parser in XQuery that can do > > this? > > > In the context of Invisible XML https://invisiblexml.org/ I have heard > that term "Earley" parser a lot but I am not familiar enough with the > various implementations to tell whether all are "Earley" parsers, > https://github.com/cmsmcq/Aparecium is an XQuery implementation of > Invisible XML.
And thus interesting, but alas too slow for the application I have.
Quoted text · Martin Honnen · 3 lines
> I think the various NineML tools by Norman Walsh use an Earley parser > and are written in Java, there is an XPath/XQuery/XSLT extension for > Saxon, so it should be possible to integrate that in BaseX, perhaps, too.
It would require someone who better understands Java than I don't, as it were. But the command line version of Coffeepot has some potential for the problem I've got. Thank you!
-- Graydon Saunders | graydonish at gmail.com Þæs oferéode, ðisses swá mæg. -- Deor ("That passed, so may this.")
JR
Jonathan Robiein reply to Graydon Saunders, 22 Aug 2022, 21:0823 Aug 2022 15:05 #
Are you talking HPSG or something like that? What is your input? Jonathan
Quoted text · Graydon Saunders · 13 lines
On Mon, Aug 22, 2022 at 1:08 PM Graydon Saunders <graydonish at gmail.com> wrote: > Hello -- > > I'm trying to test if some extracted sentences validate as productions of > a particular context-free grammar expressed in a BNF dialect. > > Is there an available implementation of a parser in XQuery that can do > this? > > Thanks! > Graydon >
G
Graydon23 Aug 2022 15:41 #
Quoted text · Jonathan Robie · 2 lines
On Tue, Aug 23, 2022 at 07:04:54AM -0400, Jonathan Robie scripsit: > Are you talking HPSG or something like that?
Had to look that up! That's much more general than anything I think I need.
Quoted text · Jonathan Robie · 1 line
> What is your input?
A bunch of customary plain-text natural language change descriptions. The idea is both to validate the descriptions as regular with respect to the expressed customary rules and to maybe eventually generate some from a node-aware diff of two versions of an XML document. So far, ixml is looking like a reasonable fit.
-- Graydon Saunders | graydonish at gmail.com Þæs oferéode, ðisses swá mæg. -- Deor ("That passed, so may this.")
CS
C. M. Sperberg-McQueen24 Aug 2022 19:13 #
Quoted text · Graydon Saunders · 14 lines
On 23 August 2022, Graydon Saunders wrote: > On Mon, Aug 22, 2022 at 07:42:39PM +0200, Martin Honnen scripsit: > > On 22.08.2022 19:07, Graydon Saunders wrote: > > > I'm trying to test if some extracted sentences validate as productions > > > of a particular context-free grammar expressed in a BNF dialect. > > > > > > Is there an available implementation of a parser in XQuery that can do > > > this? > > > > > In the context of Invisible XML https://invisiblexml.org/ I have heard > > that term "Earley" parser a lot but I am not familiar enough with the > > various implementations to tell whether all are "Earley" parsers, > > https://github.com/cmsmcq/Aparecium is an XQuery implementation of > > Invisible XML.
For what it's worth: Of the ixml processors I'm familiar with, all use (or can use) Earley parsers to parse the input string against the input grammar; Norm Walsh's Coffeepot and its related libraries also make a GLL parser available, which is sometimes faster and sometimes slower. About half use the same parser to parse the input grammar against the spec grammar; about half have a hand-written parser for the ixml spec grammar.
Quoted text · Graydon · 1 line
> And thus interesting, but alas too slow for the application I have.
If you are willing and able to send me a copy of your grammar and some sample data, I would be grateful; it might help me improve the situation with respect to Aparecium's performance. Both Norm Walsh's processor and John Lumley's processor are currently a lot faster than Aparecium, though I don't know a simple way to call them directly from XQuery. Another alternative, if you have speed issues and just one grammar you are interested in, is to use Gunther Rademacher's REx parser generator to compile the grammar you are interested in into a parser written in XQuery (other target languages are also available). https://bottlecaps.de/rex/
-- C. M. Sperberg-McQueen Black Mesa Technologies LLC http://blackmesatech.com
G
Graydon25 Aug 2022 06:08 #
Quoted text · C. M. Sperberg-McQueen · 4 lines
On Wed, Aug 24, 2022 at 08:58:32AM -0600, C. M. Sperberg-McQueen scripsit: > On 23 August 2022, Graydon Saunders wrote: > > On Mon, Aug 22, 2022 at 07:42:39PM +0200, Martin Honnen scripsit:
[snip]
Quoted text · C. M. Sperberg-McQueen · 6 lines
> > > https://github.com/cmsmcq/Aparecium is an XQuery implementation of > > And thus interesting, but alas too slow for the application I have. > > If you are willing and able to send me a copy of your grammar and some > sample data, I would be grateful; it might help me improve the > situation with respect to Aparecium's performance.
Unfortunately this is work for my employer, so I would not be able to communicate it. [snip]
Quoted text · C. M. Sperberg-McQueen · 6 lines
> Another alternative, if you have speed issues and just one grammar you > are interested in, is to use Gunther Rademacher's REx parser generator > to compile the grammar you are interested in into a parser written in > XQuery (other target languages are also available). > > https://bottlecaps.de/rex/
That's interesting; thank you!
-- Graydon Saunders | graydonish at gmail.com Þæs oferéode, ðisses swá mæg. -- Deor ("That passed, so may this.")

⚡Generated with XQuery