[CWB] Problem using CWB::CQP
Scott Sadowsky
ssadowsky at gmail.com
Wed Dec 8 16:17:38 CET 2010
Hi all,
I'm working on a Perl script to allow me to automate multiple queries
using CWB::CQP::More, and I've run into a problem. Specifically, all
searches seem to be treated as if they were on the field "word",
regardless of what I specify.
These are the results when I perform the queries inside CQP in
interactive mode:
[word = "importante"]; => 43 matches
[word = "importantes"]; => 18 matches
[lemma = "importante"]; => 61 matches
All is as it should be -- the first two words are lemmatized to
"importante", and searching on the lemma gives a number of hits that's
the sum of the word forms.
But this is what happens when I do the searches through the
CQB::CQP::More module:
word = "importante"; => 43 matches
word = "importantes"; => 18 matches
lemma = "importante"; => 43 matches
The number of lemmas here is equal *only* to the number of tokens of the
first word. I've done multiple tests, and this is invariably the case.
Since the lemma is identical to the singular form of the adj/noun (this
is Spanish, by the way), I'm assuming that for some reason the lemma
search is treated as a simple word search.
You'll notice that the queries passed through CQB::CQP::More don't have
brackets. That's because the query fails with an error if I add them.
Here are a few snippets of the code, in case it helps:
my $query_type = "lemma";
my $query_item = "importante";
my $query_to_send_to_cqp = "\[$query_type = \"$query_item\"\];";
$cqp->exec($query_to_send_to_cqp);
my $result_size = $cqp->size($query_type);
my @lines = $cqp->cat($query_type);
foreach (@lines) {print STDOUT "\n$_";}
I believe the brackets in the query are correctly escaped, since when I
print the value of $query_to_send_to_cqp right before the query is run,
it returns (in this case) the following:
[lemma = "importante"];
But, as I said, this throws an error and returns 0 results instead of
giving me 61 matches:
Use of uninitialized value $result_size in concatenation (.) or string
at ./IMS-CWB-Auto-Query_vnnn.pl line 88, <GEN1> line 1.
Any idea what I'm doing wrong here?
Thanks,
Scott
More information about the CWB
mailing list