[DGD] parse_string question

bart at wotf.org bart at wotf.org
Sun Dec 30 20:48:34 CET 2007


On Sun, 30 Dec 2007 16:13:38 +0100, Felix A. Croes wrote
> > I'd still end up calling a function to change the array for verbs, but it
> > would remove the ambiguity of the grammar I believe. Its also less flexible
> > because I can't change the verbs it recognizes dynamically.
> 
> The grammar is just a string, and you can build it on the fly.

Ok, I understand that, but I wonder, how does that relate to the following bit
from the parser doc?

--------

Internally, DGD generates two partial automatons for each grammar, one to
match tokens and one to parse a sentence of tokens.  Only those parts of the
automatons are generated that are required to parse the sentences seen so far;
this effect is cumulative for successive calls in each object, ensuring that
the automatons are not needlessly generated more than once.  Each object can
handle only one grammar at a time.  If a grammar differs from the previous
one used by the same object, any existing generated automatons are wiped out
and constructed anew.

--------

This suggests that while technically I could generate the grammar anew each
time I try to parse a sentence, its not a very good idea to do so.

I suppose that if this happens only every so often, it shouldn't be much of an
issue, but would it be if the list of verbs is determined just before parsing
the input, and as a result may change every time a new line of input is parsed?

Bart.
--
Created with Open WebMail at http://www.bartsplace.net/
Read my weblog at http://soapbox.bartsplace.net/




More information about the DGD mailing list