Changeset 1396 for trunk


Ignore:
Timestamp:
2000-08-11T13:46:39+12:00 (24 years ago)
Author:
say1
Message:

changed initialisation code for acronyms

Location:
trunk/gsdl/perllib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/acronym.pm

    r1393 r1396  
    5050#allow recusive acronyms
    5151my $allow_recursive = "";
     52#let definitions be all capitals
     53my $allow_all_caps = 0;
    5254
    5355my @stop_words = split / /, "OF AT THE IN TO AND";
     
    7577###########################################################################
    7678
    77 sub init_acronyms {
     79sub initialise_acronyms {
    7880   
    7981    my $file_text = "";
     
    102104    print ACRONYM_HANDLE "#minimum acronym length (raise to raise precision)\n";
    103105    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";
    104108    print ACRONYM_HANDLE "#minimum acronym length (raise to raise precision)\n";
    105109    print ACRONYM_HANDLE "\$min_acro_length = 3;\n\n";
     
    149153
    150154#close the list of accumulated acronyms
    151 END {
     155sub finalise_acronyms {
    152156    if ($writing_acronyms)
    153157    {
     
    160164sub read_all_acronyms_from_file {
    161165   
    162     my $file_text = "";
     166    my $file_text = " ";
    163167    if (open ACRONYM_HANDLE, "<$acronym_accumulate_file")
    164168    {
     
    415419#       "|" . $self->letters_in_acronym() .
    416420#       "|" . $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";
    417427    return 0;
    418428    }
     
    514524    $$processed_text =~ s/[^A-Za-z]/ /g;
    515525    $$processed_text =~ s/\s+/ /g;
     526    $$processed_text =~ s/(\n|\>)References.*/ /g;
     527    $$processed_text =~ s/(\n|\>)Bibliography.*/ /g;
    516528
    517529    #clear some global variables
     
    633645#&test();
    634646
    635 &init_acronyms();
    636 
    6376471;
    638648
  • trunk/gsdl/perllib/plugins/BasPlug.pm

    r1393 r1396  
    137137    my $self = shift (@_);
    138138    my ($pluginfo, $base_dir, $processor, $maxdocs) = @_;
     139    $self->initialise_extractors();
    139140}
    140141
    141142sub end {
    142143    my ($self) = @_;
     144    $self->finalise_extractors();
    143145}
    144146
     
    282284        $doc_obj->add_utf8_metadata ($cursection, $field, $metadata->{$field});
    283285    }
     286    }
     287}
     288
     289# initialise metadata extractors
     290sub 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
     299sub finalise_extractors {
     300    my $self = shift (@_);
     301
     302    if ($self->{'extract_acronyms'} || $self->{'markup_acronyms'}) {
     303    &acronym::finalise_acronyms();
    284304    }
    285305}
Note: See TracChangeset for help on using the changeset viewer.