Changeset 10218 for trunk/gsdl/perllib/classify/Phind.pm
- Timestamp:
- 2005-07-06T15:27:45+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/Phind.pm
r8362 r10218 150 150 151 151 sub 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); 165 160 166 161 # Ensure the Phind generate scripts are in place … … 168 163 $file1 .= ".exe" if $ENV{'GSDLOS'} =~ /^windows$/; 169 164 my $src = &util::filename_cat($ENV{'GSDLHOME'}, "src", "phind", "generate"); 170 171 165 if (!(-e $file1)) { 172 166 print STDERR "Phind.pm: ERROR: The Phind \"suffix\" program is not installed.\n\n"; 173 167 exit(1); 174 168 } 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 204 176 if (! defined $self->{'builddir'}) { 205 177 $self->{'builddir'} = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "building"); 206 178 } 207 208 179 $self->{'total'} = 0; 209 180 181 # Clean out the unused keys 182 delete $self->{"text"}; 183 210 184 return bless $self, $class; 211 185 } … … 265 239 my $top_section = $doc_obj->get_top_section(); 266 240 267 my $titlefield = $self->{'title field'};241 my $titlefield = $self->{'title'}; 268 242 269 243 my $title = $doc_obj->get_metadata_element ($top_section, $titlefield); … … 276 250 # Only consider the file if it is in the correct language 277 251 my $doclanguage = $doc_obj->get_metadata_element ($top_section, "Language"); 278 my $phrlanguage = $self->{'language _exp'};252 my $phrlanguage = $self->{'language'}; 279 253 return if ($doclanguage && ($doclanguage !~ /$phrlanguage/i)); 280 254 … … 282 256 $self->{'total'} ++; 283 257 print "file $self->{'total'}: $file\n" if ($self->{'$verbosity'}); 284 285 258 286 259 # Store document details … … 698 671 my $phinddir = $self->{'phinddir'}; 699 672 700 my $language_exp = $self->{'language _exp'};673 my $language_exp = $self->{'language'}; 701 674 702 675 my ($w, $l, $line, $word);
Note:
See TracChangeset
for help on using the changeset viewer.