Alt-CWB-ambs
view release on metacpan or search on metacpan
data/vrt/VeryShortStories.vrt view on Meta::CPAN
school NN school
boasts VBZ boast
a DT a
most RBS most
peculiar JJ peculiar
design NN design
. SENT .
</s>
<s>
It PP it
looks VBZ look
very RB very
much JJ much
like IN like
a DT a
big JJ big
hall NN hall
, , ,
serving VBG serve
both DT both
as IN as
lib/CWB/CEQL.pm view on Meta::CPAN
=cut
sub default {
return ceql_query(@_); # pass through directly to ceql_query(), without explicit Call()
}
sub ceql_query {
my ($self, $input) = @_;
$input =~ s/\s+/ /g; # change all whitespace to single blanks
$input =~ s/^\s+//; $input =~ s/\s+$//; # remove leading/trailing whitespace
# check whether there's something in the query that looks like a distance operator (same regexp as used in proximity_query rule)
if ($input =~ /(?<!\\)((<<|>>)[^<>\\ ]*(<<|>>))/) {
return $self->Call("proximity_query", $input);
}
else {
return $self->Call("phrase_query", $input);
}
}
=back
lib/CWB/CEQL/Parser.pm view on Meta::CPAN
By convention, the names of B<rule methods> are written in lowercase with
underscores (e.g., C<word_and_pos>), B<methods for users and grammar writers>
are written in mixed case (e.g., C<Parse> or C<SetParam>), and B<internal
methods> are written in mixed case starting with a lowercase letter (e.g.,
B<formatHtmlString>). If you need to define helper subroutines in your grammar
class, their names should begin with an underscore (e.g., C<_escape_regexp>)
to avoid confusion with grammar rules. The C<default> rule has to be
implemented by all grammars and will be applied to an input string if no
constituent type is specified. The basic skeleton of a DPP grammar therefore
looks like this:
package MyGrammar;
use base 'CWB::CEQL::Parser';
sub some_rule {
## body of grammar rule "some_rule" goes here
}
sub default {
## default rule will be called if parser is applied to string
lib/CWB/CEQL/Parser.pm view on Meta::CPAN
be adapted to the tagset used by a particular corpus)
=back
Named parameters have to be defined in the constructor (i.e. the B<new>
method) of a grammar by calling the B<NewParam> method, which also sets a
default value for the new parameter. They can then be modified or read out at
any time using the B<SetParam> and B<GetParam> methods. It is an error to
set or read the value of a parameter that hasn't previously been defined.
A typical skeletion of a DPP grammar with parameters looks as follows:
package MyGrammar;
use base 'CWB::CEQL::Parser';
sub new {
my $class = shift;
my $self = new CWB::CEQL::Parser;
$self->NewParam("pos_attribute", "pos");
return bless($self, $class);
}
script/cwb-regedit view on Meta::CPAN
}
}
## list attributes of specified type
sub list_attributes {
my $type = shift;
my @atts = $reg->list_attributes($type);
print "@atts\n";
}
## check whether next token looks like a command (without removing it)
sub is_command {
return( @ARGV and $ARGV[0] =~ /^:/ );
}
## match next token as command (without removing it) and return normalised name ("" if not a command)
sub match_command {
my $cmd = (@_) ? shift : $ARGV[0];
my $norm = "";
for ($cmd) {
last unless defined $cmd;
( run in 0.418 second using v1.01-cache-2.11-cpan-64827b87656 )