in reply to Need Parse::RecDescent Help

As you have found, parsing natural language is not an easy task! People have tried to create grammars for natural language; they start out simple, but all thecombinatorial possibilities and special case results in a mess of rules that are difficult to make sense of.

It seems to me that without a consistent structure, a hierarchical grammar will not really help you. But you can loosen the rules of a grammar to accept more possibilities. For instance,

showinfo : artist date location | artist punct date location | date artist location | artist location date
has only some possible combinations, but
showinfo: showpart(s) showpart: artist | date | punct | location
will allow the showinfo components to be in any order.

-Mark

Replies are listed 'Best First'.
Re: Re: Need Parse::RecDescent Help
by Bklyn (Initiate) on Mar 10, 2004 at 15:12 UTC
    Thats not really the problem, and things like "punct" can appear in the name of an artist even (e.g. "Medeski Martin & Wood"). What I really need is help recognizing patterns like: the brand-name of a (microphone|dat deck|pre-amp) appears *anywhere on the entire line*, and I haven't seen any source info yet" and have that be my "sourceinfo" rule. I'm having difficulty making the token-based parser relax to match an entire line I guess.