Alt-CWB-ambs

 view release on metacpan or  search on metacpan

data/vrt/VeryShortStories.vrt  view on Meta::CPAN

17	CD	@card@
,	,	,
2019	CD	@card@
AD	NN	ad
''	''	''
(	(	(
some	DT	some
months	NNS	month
had	VBD	have
been	VBN	be
renamed	VBN	rename
after	IN	after
the	DT	the
Presidents	NNS	president
of	IN	of
the	DT	the
United	NP	United
Continents	NNS	continent
of	IN	of
America	NP	America
)	)	)

lib/CWB/CEQL/Parser.pm  view on Meta::CPAN

whether they are in a nested group with the help of the B<NestingLevel> method
(which returns 0 at the top level).

The example below extends our simple query language with regexp-style
parenthesised groups, quantifiers (C<?>, C<*>, C<+>) and alternatives (C<|>).
In order to simplify the implementation, metacharacters must be separated from
wordform patterns and from other metacharacters by blanks; and quantifiers
must be attached directly to a closing parenthesis (otherwise, the question
mark in C<) ?> would be ambiguous between a quantifier and a wildcard pattern
matching a single character).  Note that the C<simple_query> rule is
practically identical to C<wordform_sequence> above, but has been renamed to
reflect its new semantics.

  sub simple_query {
    my ($self, $input) = @_;
    my @items = split " ", $input;
    my @cqp_tokens = $self->Apply("simple_query_item", @items);
    return "@cqp_tokens";
  }

  # need to define single rule to parse all items of a list with nested bracketing



( run in 0.574 second using v1.01-cache-2.11-cpan-131fc08a04b )