[CWB] CWB/Perl modules: where can it be downloaded?
Hardie, Andrew
a.hardie at lancaster.ac.uk
Sun Mar 9 22:36:45 CET 2008
Since several people said they would be interested in my PHP version, here it is. (attached zip, two files with one class per file).
A sample implementation would be as follows:
/* the classes need these definitions */
define("IN", 0);
define("OUT", 1);
define("ERR", 2);
require("cwb.inc.php");
require("cqp.inc.php");
/* create a CQP object and set it up for use */
$cqp = new CQP;
$cqp->set_error_handler("my_function_name");
$cqp->execute("set DataDirectory '/$cqp_save_directory'");
$cqp->execute("$corpus_name;");
/* run the query */
$cqp->execute("$query_name = $text_of_query");
$cqp->execute("save $query_name");
$num_of_solutions = $cqp->querysize($query_name);
/* print it */
$cqp->execute("set Context 10 words");
$cqp->execute("show +word +pos");
$array_of_lines_with_query_solutions = $cqp->execute("cat $query_name");
some_print_function($array_of_lines_with_query_solutions);
$cqp->disconnect();
Hope this of use to some people!
best
Andrew.
Andrew Hardie
Department of Linguistics
Bowland College
Lancaster University
Lancaster LA1 4YT
a.hardie at lancaster.ac.uk <mailto:a.hardie at lancaster.ac.uk>
________________________________
From: cwb-bounces at sslmit.unibo.it on behalf of Stefan Evert
Sent: Fri 07/03/2008 12:13
To: Open source development of the Corpus WorkBench
Subject: Re: [CWB] CWB/Perl modules: where can it be downloaded?
Hi everyone!
I'm not going to comment on Emiliano's misinterpretation of PHP as a
programming language. ;-)
Having CWB APIs for other languages than Perl would definitely be a
plus, though, so I'd like to encourage you to share any code you've
worked out. I hope to sort out the sf.net SVN soon, so that we can
coordinate further development of such interfaces there.
I know that some people have been working on a Python interface at
least for CQP -- we're currently working on our own implementation in
Osnabrück -- and I'd be interested in porting the C API for direct
corpus access from Perl to Python.
As far as the Perl APIs are concerned, the reason I haven't uploaded
them to sf.net is that the source code is currently in a mess and
waiting for a reimplementation (which I have to get done soon anyway
because of some other project). If you have downloaded the latest CWB
source code from sf.net, you'll notice that publically available
versions of the Perl API don't work any more ...
I attach the current messy version of the Perl modules, which anyone
interested in the Perl API should use as an interim solution until
the cleaned-up reimplementation becomes available on sf.net.
Sorry about the mess and continuing delays & best wishes,
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 15779 bytes
Desc: not available
Url : http://liste.sslmit.unibo.it/pipermail/cwb/attachments/20080309/92f4bf86/attachment.bin
More information about the CWB
mailing list