Ignore:
Timestamp:
2005-07-06T15:27:45+12:00 (19 years ago)
Author:
kjdon
Message:

Jeffrey's new parsing modifications, committed approx 6 July, 15.16

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/classify/Phind.pm

    r8362 r10218  
    150150
    151151sub new {
    152     my $class = shift (@_);
    153     my $self = new BasClas($class, @_);
    154 
    155     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    156     my $option_list = $self->{'option_list'};
    157     push( @{$option_list}, $options );
    158 
    159     if ($self->{'info_only'}) {
    160     # created from classinfo.pl - don't need to parse the arguments
    161     return bless $self, $class;
    162     }
    163 
    164     my $out = $self->{'outhandle'};
     152    my ($class) = shift (@_);
     153    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     154    push(@$classifierslist, $class);
     155
     156    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     157    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     158
     159    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
    165160
    166161    # Ensure the Phind generate scripts are in place
     
    168163    $file1 .= ".exe" if $ENV{'GSDLOS'} =~ /^windows$/;
    169164    my $src = &util::filename_cat($ENV{'GSDLHOME'}, "src", "phind", "generate");
    170 
    171165    if (!(-e $file1)) {
    172166    print STDERR "Phind.pm: ERROR: The Phind \"suffix\" program is not installed.\n\n";
    173167    exit(1);
    174168    }
    175 
    176     # Parse classifier arguments
    177     my $builddir = "";
    178     if (!parsargv::parse(\@_,
    179              q^text/.*/section:Title,section:text^, \$self->{'indexes'},
    180              q^title/.*/Title^, \$self->{'titlefield'},
    181              q^buttonname/.*/Phrase^, \$self->{'buttonname'},
    182              q^language/.*/en^, \$language,
    183              q^savephrases/.*/^, \$self->{'savephrases'},
    184              q^suffixmode/\d/1^, \$self->{'suffixmode'},
    185              q^min_occurs/\d/2^, \$self->{'min_occurs'},
    186              q^thesaurus/.*/^, \$self->{'thesaurus'},
    187              q^untidy^, \$self->{'untidy'},
    188              "allow_extra_options")) {
    189    
    190     print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    191     $self->print_txt_usage("");  # Use default resource bundle
    192     die "\n";
    193     }
    194    
    195     # classifier information
    196     $self->{'collection'} = $ENV{'GSDLCOLLECTION'};
    197 
    198     # limit languages
    199     $self->{'language_exp'} = $language;
    200    
    201     # collection directories
    202     $self->{'collectiondir'} = $ENV{'GSDLCOLLECTDIR'};
    203 
     169   
     170    # Transfer value from Auto Parsing to the variable name that used in previous GreenStone.
     171    $self->{"indexes"} = $self->{"text"};
     172
     173    # Further setup
     174    $self->{'collection'} = $ENV{'GSDLCOLLECTION'}; # classifier information
     175    $self->{'collectiondir'} = $ENV{'GSDLCOLLECTDIR'}; # collection directories
    204176    if (! defined $self->{'builddir'}) {
    205177    $self->{'builddir'} = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "building");
    206178    }
    207 
    208179    $self->{'total'} = 0;
    209    
     180   
     181    # Clean out the unused keys
     182    delete $self->{"text"};
     183
    210184    return bless $self, $class;
    211185}
     
    265239    my $top_section = $doc_obj->get_top_section();
    266240
    267     my $titlefield = $self->{'titlefield'};
     241    my $titlefield = $self->{'title'};
    268242   
    269243    my $title = $doc_obj->get_metadata_element ($top_section, $titlefield);
     
    276250    # Only consider the file if it is in the correct language
    277251    my $doclanguage = $doc_obj->get_metadata_element ($top_section, "Language");
    278     my $phrlanguage = $self->{'language_exp'};
     252    my $phrlanguage = $self->{'language'};
    279253    return if ($doclanguage && ($doclanguage !~ /$phrlanguage/i));
    280254   
     
    282256    $self->{'total'} ++;
    283257    print "file $self->{'total'}: $file\n" if ($self->{'$verbosity'});
    284    
    285258
    286259    # Store document details
     
    698671    my $phinddir = $self->{'phinddir'};
    699672
    700     my $language_exp = $self->{'language_exp'};
     673    my $language_exp = $self->{'language'};
    701674
    702675    my ($w, $l, $line, $word);
Note: See TracChangeset for help on using the changeset viewer.