NAME
DDC::Hit - Hit structure for DDC query utilities
SYNOPSIS
use DDC::Hit;
$hit = DDC::Hit->new(keywords=>\%keyword2undef,context=>$context_str,%bibl);
@sents = $hit->parseContext(undef, %opts);
@sents = DTA::Hit->parseContext($context_str, %opts);
DESCRIPTION
DDC::Hit is the underlying structure for hits returned by DDC::Client.
Methods
- new
-
$hit = $CLASS_OR_OBJ->new(%args);
Object structure / accepted keyword %args:
keywords => \@keywords, ##-- keyword list context => $context_str, ##-- context string $bibl_key => $bibl_val, ##-- bibliographic data
- parseContext
-
@sents = $hit->parseContext($context_str,%opts); ##-- object method in list context; \@sents = $hit->parseContext($context_str,%opts); ##-- object method in scalar context @sents = DDC::Hit->parseContext($context_str,%opts); ##-- class method in list context \@sents = DDC::Hit->parseContext($context_str,%opts); ##-- class method in scalar context
Parse a $context_str as returned by DDC::Client into perl data structures. If called as an object method, $context_str may be passed as undef, and defaults to $hit->{context}. Known options %opts:
wordSeparator => $wordSeparatorRegex, ##-- default=' ' fieldSeparator => $fieldSeparatorRegex, ##-- default="\x{a7}" (U+00A7 : Latin-1 Supplement / SECTION SIGN : §) fieldNames => \@fieldNames, ##-- default=undef (none)
returns a list of parsed sentences (list context) or a reference to such a list (scalar context)
@sents = ($sents[0], ..., $sents[$#s])
where each element $s=$sents[$i] is an ARRAY ref of words
$s = $sents[$i] = [ $s->[0], ..., $s->[$#$s] ]
and each word $w=$s->[$j] is either:
a simple scalar: if $opts{fieldSeparator} was undefined or only 1 field was returned
a ARRAY ref: if multiple fields were returned and $opts{fieldNames} was undefined
a HASH ref: if multiple fields were returned and $opts{fieldNames} was defined. The keys of the HASH are the elements of $opts{fieldNames} and their values are the corresponding values in the token-data list returned by DDC. In general, $opts{fieldNames} should contain a list of the token field names from the
Indices
line of the DDC server's *.opt file in the order specified by the DDCIndicesToShow
option.
AUTHOR
Bryan Jurish <moocow@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2006-2011 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 139:
Non-ASCII character seen before =encoding in '§)'. Assuming CP1252