- Timestamp:
- 2000-08-11T13:46:39+12:00 (24 years ago)
- Location:
- trunk/gsdl/perllib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/acronym.pm
r1393 r1396 50 50 #allow recusive acronyms 51 51 my $allow_recursive = ""; 52 #let definitions be all capitals 53 my $allow_all_caps = 0; 52 54 53 55 my @stop_words = split / /, "OF AT THE IN TO AND"; … … 75 77 ########################################################################### 76 78 77 sub init _acronyms {79 sub initialise_acronyms { 78 80 79 81 my $file_text = ""; … … 102 104 print ACRONYM_HANDLE "#minimum acronym length (raise to raise precision)\n"; 103 105 print ACRONYM_HANDLE "\$min_def_length = 3;\n\n"; 106 print ACRONYM_HANDLE "#let definitions be all capitals\n"; 107 print ACRONYM_HANDLE "\$allow_all_caps = 0;\n\n"; 104 108 print ACRONYM_HANDLE "#minimum acronym length (raise to raise precision)\n"; 105 109 print ACRONYM_HANDLE "\$min_acro_length = 3;\n\n"; … … 149 153 150 154 #close the list of accumulated acronyms 151 END{155 sub finalise_acronyms { 152 156 if ($writing_acronyms) 153 157 { … … 160 164 sub read_all_acronyms_from_file { 161 165 162 my $file_text = " ";166 my $file_text = " "; 163 167 if (open ACRONYM_HANDLE, "<$acronym_accumulate_file") 164 168 { … … 415 419 # "|" . $self->letters_in_acronym() . 416 420 # "|" . $self->letters_in_acronym_definition() . "\n"; 421 return 0; 422 } 423 if (!$allow_all_caps && 424 $self->to_def_string() eq uc($self->to_def_string())) 425 { 426 # print "acronym " . $self->to_string() . " rejected (all upper)\n"; 417 427 return 0; 418 428 } … … 514 524 $$processed_text =~ s/[^A-Za-z]/ /g; 515 525 $$processed_text =~ s/\s+/ /g; 526 $$processed_text =~ s/(\n|\>)References.*/ /g; 527 $$processed_text =~ s/(\n|\>)Bibliography.*/ /g; 516 528 517 529 #clear some global variables … … 633 645 #&test(); 634 646 635 &init_acronyms();636 637 647 1; 638 648 -
trunk/gsdl/perllib/plugins/BasPlug.pm
r1393 r1396 137 137 my $self = shift (@_); 138 138 my ($pluginfo, $base_dir, $processor, $maxdocs) = @_; 139 $self->initialise_extractors(); 139 140 } 140 141 141 142 sub end { 142 143 my ($self) = @_; 144 $self->finalise_extractors(); 143 145 } 144 146 … … 282 284 $doc_obj->add_utf8_metadata ($cursection, $field, $metadata->{$field}); 283 285 } 286 } 287 } 288 289 # initialise metadata extractors 290 sub initialise_extractors { 291 my $self = shift (@_); 292 293 if ($self->{'extract_acronyms'} || $self->{'markup_acronyms'}) { 294 &acronym::initialise_acronyms(); 295 } 296 } 297 298 # finalise metadata extractors 299 sub finalise_extractors { 300 my $self = shift (@_); 301 302 if ($self->{'extract_acronyms'} || $self->{'markup_acronyms'}) { 303 &acronym::finalise_acronyms(); 284 304 } 285 305 }
Note:
See TracChangeset
for help on using the changeset viewer.