
Lingua::DE::Wortschatz - wortschatz.uni-leipzig.de webservice client

use Lingua::DE::Wortschatz;
my $result=Lingua::DE::Wortschatz::use_service('T','toll');
$result->dump;
@lines=$result->hashrefs();
for (@lines) {
print $_->{Synonym},"\n";
}
print Lingua::DE::Wortschatz::help('T');
print Lingua::DE::Wortschatz::help('full');

This is a full featured client for the webservices at http://wortschatz.uni-leipzig.de. The script wsws.pl is a command line client that uses this lib. It is contained in this distribution.
The webservices at http://wortschatz.uni-leipzig.de provide access to a database of the german word pool. Available services include tools to reduce words to base form, find synonyms, significant neighbours, example sentences and more. All public services at http://wortschatz.uni-leipzig.de are available. See below for a detailed list.

The following functions can be exported or used via the full name.
Uses the webservice named $name with the arguments @args. Returns undef if not enough arguments for the desired service are supplied. Otherwise it returns a result object (see below).
All public services at http://wortschatz.uni-leipzig.de are available. Below is a list of service names and their parameters. Any parameter with = is optional and defaults to the given value. Service names can be abbreviated to the shortest unique form.
* ServiceOverview Name= * Cooccurrences Wort Mindestsignifikanz=1 Limit=10 * Baseform Wort * Sentences Wort Limit=10 * RightNeighbours Wort Limit=10 * LeftNeighbours Wort Limit=10 * Frequencies Wort Limit=10 * Synonyms Wort Limit=10 * Thesaurus Wort Limit=10 * Wordforms Word Limit=10 * Similarity Wort Limit=10 * LeftCollocationFinder Wort Wortart Limit=10 * RightCollocationFinder Wort Wortart Limit=10
A full list of available services, their parameters and additional information on what each service does can be obtained with the help function.
Returns a string containing information about the service with name $service. If no service name is given, a short list of all available services is returned. If $service eq 'full', a more detailed list is created.

The use_service function returns a result object of class Lingua::DE::Wortschatz::Result that holds the results.
This object offers methods to conveniently access the data.
$result->dump();
Pretty prints the data to STDOUT.
$service_name=$result->service();
Returns the name of the service that was used to obtain the data.
@column_headers=$result->names();
Returns a list of the names of the data columns.
@rows=$result->data();
Returns a list of datasets. Each dataset is a reference to a list of values.
@lines=$result->hashrefs();
Returns a list of datasets. Each dataset is a references to a hash. The hashkeys are the names of the return values and the values are the data.

I wrote this to understand SOAP better. It took me way too long, due to the lack of documentation.
I couldn't figure out how to make SOAP::Lite and SOAP::Data create the request parameters in the correct way. It appears to me that this would require me to create custom as_Datatype functions for all the used types.
I could neither make it work using the WSDL file. I think with the data format that wortschatz.u-l requires, WSDL is pretty useless.
So I decided to use a straightforward approach and create the XML request parameters myself. This is probably not the idea of that whole SOAP thing, but it's short and it works. But see it as a hack.


This is $Id: Wortschatz.pm,v 1.9 2005/11/21 13:58:07 manonegra Exp $.
Copyright 2005 Daniel Schröer (daniel@daimla1.de).
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.