Changeset 1393 for trunk/gsdl/perllib/plugins
- Timestamp:
- 2000-08-11T11:12:15+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/BasPlug.pm
r1384 r1393 67 67 print STDERR " file extensions.\n"; 68 68 print STDERR " -extract_acronyms Extract acronyms from within text and set as metadata\n\n"; 69 print STDERR " -markup_acronyms Added acronym metadata into document text\n\n"; 69 70 print STDERR " -extract_langauge Identify the language of the text and set as metadata\n\n"; 70 71 } … … 90 91 q^block_exp/.*/^, \$self->{'block_exp'}, 91 92 q^extract_acronyms^, \$self->{'extract_acronyms'}, 93 q^markup_acronyms^, \$self->{'markup_acronyms'}, 92 94 q^extract_language^, \$self->{'extract_language'}, 93 95 "allow_extra_options")) { … … 297 299 } 298 300 301 if ($self->{'markup_acronyms'}) { 302 my $thissection = $doc_obj->get_top_section(); 303 while (defined $thissection) { 304 my $text = $doc_obj->get_text($thissection); 305 $text = $self->markup_acronyms ($text, $doc_obj, $thissection); 306 $doc_obj->delete_text($thissection); 307 $doc_obj->add_text($thissection, $text); 308 $thissection = $doc_obj->get_next_section ($thissection); 309 } 310 } 311 299 312 if ($self->{'extract_language'}) { 300 313 my $thissection = $doc_obj->get_top_section(); … … 341 354 my ($textref, $doc_obj, $thissection) = @_; 342 355 343 print STDERR " checking foracronyms ...\n"356 print STDERR " extracting acronyms ...\n" 344 357 if ($self->{'verbosity'} >= 2); 345 358 … … 362 375 if ($seen_before eq "false") 363 376 { 377 #write it to the file ... 378 $acro->write_to_file(); 379 364 380 #do the normal acronym 365 381 $doc_obj->add_utf8_metadata($thissection, "Acronym", $acro->to_string()); … … 367 383 if ($self->{'verbosity'} >= 1); 368 384 369 # do the KWIC (Key Word In Context) acronym370 my @kwic = $acro->to_string_kwic();371 foreach my $kwic (@kwic) {372 $doc_obj->add_utf8_metadata($thissection, "AcronymKWIC", $kwic);373 print STDERR " adding ". $kwic . "\n"374 if ($self->{'verbosity'} >= 2);375 }376 } 377 } 378 print STDERR " done withacronyms. \n"385 # # do the KWIC (Key Word In Context) acronym 386 # my @kwic = $acro->to_string_kwic(); 387 # foreach my $kwic (@kwic) { 388 # $doc_obj->add_utf8_metadata($thissection, "AcronymKWIC", $kwic); 389 # print STDERR " adding ". $kwic . "\n" 390 # if ($self->{'verbosity'} >= 2); 391 # } 392 } 393 } 394 print STDERR " done extracting acronyms. \n" 379 395 if ($self->{'verbosity'} >= 2); 380 396 } 381 397 398 sub markup_acronyms { 399 my $self = shift (@_); 400 my ($text, $doc_obj, $thissection) = @_; 401 402 print STDERR " marking up acronyms ...\n" 403 if ($self->{'verbosity'} >= 2); 404 405 #self is passed in to check for verbosity ... 406 $text = &acronym::markup_acronyms($text, $self); 407 408 print STDERR " done marking up acronyms. \n" 409 if ($self->{'verbosity'} >= 2); 410 411 return $text; 412 } 413 382 414 1;
Note:
See TracChangeset
for help on using the changeset viewer.