Changeset 23154 for main/trunk/greenstone2/perllib/classify/List.pm
- Timestamp:
- 2010-10-18T13:50:10+13:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/classify/List.pm
r23116 r23154 273 273 } 274 274 275 # An empty array for the document OIDs275 # An empty array for the document/section OIDs that we are classifying 276 276 $self->{'OIDs'} = []; 277 277 # A hash for all the doc ids that we have seen, so we don't classify something twice 278 $self->{'all_doc_OIDs'} = {}; 278 279 return bless $self, $class; 279 280 } … … 292 293 my ($doc_obj) = @_; 293 294 295 if (defined $self->{'all_doc_OIDs'}->{$doc_obj->get_OID()}) { 296 print STDERR "Warning, List classifier has already seen document ".$doc_obj->get_OID().", not classifying again\n"; 297 return; 298 } 299 $self->{'all_doc_OIDs'}->{$doc_obj->get_OID()} = 1; 294 300 # If "-classify_sections" is set, classify every section of the document 295 301 if ($self->{'classify_sections'}) { … … 304 310 $self->classify_section($doc_obj, $doc_obj->get_OID(), $doc_obj->get_top_section()); 305 311 } 306 } 307 312 313 } 308 314 309 315 sub classify_section … … 344 350 345 351 # Otherwise, include this section in the classifier 352 346 353 push(@{$self->{'OIDs'}}, $section_OID); 347 354 … … 419 426 my @OIDs = @{shift(@_)}; 420 427 my $classifier_node = shift(@_); 421 # print STDERR "\nAdding AZ list for " . $classifier_node->{'Title'} . "\n"; 422 428 423 429 my $metadata_group = $metadata_groups[0]; 424 # print STDERR "Processing metadata group: " . $metadata_group . "\n"; 425 # print STDERR "Number of OID values: " . @OIDs . "\n"; 426 430 427 431 if (!defined($self->{$metadata_group . ".list"})) { 428 432 print STDERR "Warning: No metadata values assigned to $metadata_group.\n"; … … 444 448 } 445 449 } 446 #print STDERR "Number of distinct values: " . scalar(keys %metadata_value_to_OIDs_hash) . "\n";450 #print STDERR "Number of distinct values: " . scalar(keys %metadata_value_to_OIDs_hash) . "\n"; 447 451 448 452 # Partition the values (if necessary) … … 778 782 { 779 783 my @OIDs = @{$metadata_value_to_OIDs_hash_ref->{$metadata_value}}; 780 781 784 # If there is only one item and 'bookshelf_type' is not always (ie. never or duplicate_only), add the item to the list 782 785 if (@OIDs == 1 && $self->{$metadata_group . ".bookshelf_type"} ne "always") {
Note:
See TracChangeset
for help on using the changeset viewer.