Changeset 4759


Ignore:
Timestamp:
2003-06-23T14:27:08+12:00 (21 years ago)
Author:
mdewsnip
Message:

Tidied up 'options' and 'arguments' structures (representing the options of the plugin) in preparation for removing the print_usage() routines.

Location:
trunk/gsdl/perllib/classify
Files:
11 edited

Legend:

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

    r4225 r4759  
    5151
    5252my $doclevel_list =
    53 [ { 'name' => "top",
     53    [ { 'name' => "top",
    5454    'desc' => "Whole document." } ,
    55 {   'name' => "section",
    56     'desc' => "By sections." }
    57 ];
     55      { 'name' => "section",
     56    'desc' => "By sections." } ];
    5857
    5958my $arguments =
    60 [ {     'name' => "metadata",
     59    [ { 'name' => "metadata",
    6160    'desc' => "Metadata field used for classification. List will be sorted by this element.",
    6261    'type' => "metadata",
    63     'reqd' => "yes" } ,
    64 {   'name' => "buttonname",
    65     'desc' => "Button name for this classification. Defaults to metadata name.",
     62    'reqd' => "yes" },
     63      { 'name' => "buttonname",
     64    'desc' => "Button name for this classification.",
    6665    'type' => "string",
    67     'reqd' => "no" } ,
    68 {   'name' => "mingroup",
     66    'deft' => "Metadata element specified with -metadata",
     67    'reqd' => "no" },
     68      { 'name' => "removeprefix",
     69    'desc' => "A prefix to ignore in the Metadata values for the field when sorting.",
     70    'type' => "string",
     71    'deft' => "",
     72    'reqd' => "no" },
     73      { 'name' => "mingroup",
    6974    'desc' => "The smallest value that will cause a group in the hierarchy to form.",
    7075    'type' => "int",
    71     'reqd' => "no" } ,
    72 {   'name' => "minnesting",
     76    'deft' => "2",
     77    'reqd' => "no" },
     78      { 'name' => "minnesting",
    7379    'desc' => "The smallest value that will cause a list to converted into nested list.",
    7480    'type' => "int",
    75     'reqd' => "no" } ,
    76 {   'name' => "mincompact",
    77     'desc' => "Used in compact list.",
     81    'deft' => "20",
     82    'reqd' => "no" },
     83      { 'name' => "mincompact",
     84    'desc' => "Minimum number of documents to be displayed per page.",
    7885    'type' => "int",
    79     'reqd' => "no" } ,
    80 {   'name' => "maxcompact",
    81     'desc' => "Used in compact list.",
     86    'deft' => "10",
     87    'reqd' => "no" },
     88      { 'name' => "maxcompact",
     89    'desc' => "Maximum number of documents to be displayed per page.",
    8290    'type' => "int",
    83     'reqd' => "no" } ,
    84 {   'name' => "doclevel",
     91    'deft' => "30",
     92    'reqd' => "no" },
     93      { 'name' => "doclevel",
    8594    'desc' => "Level to process document at.",
    8695    'type' => "enum",
    8796    'list' => $doclevel_list,
    88     'reqd' => "no" } ,
    89 {   'name' => "onlyfirst",
     97    'deft' => "top",
     98    'reqd' => "no" },
     99      { 'name' => "onlyfirst",
    90100    'desc' => "Control whether all or only first metadata value used from array of metadata.",
    91101    'type' => "flag",
    92     'reqd' => "no" }
    93 ];
     102    'reqd' => "no" },
     103      { 'name' => "freqsort",
     104    'desc' => "Sort by node frequency rather than alpha-numeric.",
     105    'type' => "flag"},
     106      { 'name' => "recopt",
     107    'desc' => "?",
     108    'type' => "string",
     109    'deft' => "" } ];
    94110
    95111my $options =
  • trunk/gsdl/perllib/classify/AZList.pm

    r3727 r4759  
    3636}
    3737
    38 my $arguments = [ { 'name' => "metadata",
    39             'desc' => "Metadata field used for classification. List will be sorted by this element.",
    40             'type' => "metadata",
    41             'reqd' => "yes" } ,
    42           { 'name' => "buttonname",
    43             'desc' => "Button name for this classification. Defaults to metadata name.",
    44             'type' => "string",
    45             'reqd' => "no" } ,
    46           { 'name' => "removeprefix",
    47             'desc' => "A prefix to ignore in the Metadata values for the field when sorting.",
    48             'type' => "string",
    49             'reqd' => "no" } ];
     38my $arguments =
     39    [ { 'name' => "metadata",
     40    'desc' => "Metadata field used for classification. List will be sorted by this element.",
     41    'type' => "metadata",
     42    'reqd' => "yes" } ,
     43      { 'name' => "buttonname",
     44    'desc' => "Button name for this classification.",
     45    'type' => "string",
     46    'deft' => "Metadata element specified with -metadata",
     47    'reqd' => "no" },
     48      { 'name' => "removeprefix",
     49    'desc' => "A prefix to ignore in the Metadata values for the field when sorting.",
     50    'type' => "string",
     51    'deft' => "",
     52    'reqd' => "no" } ];
    5053
    5154my $options = { 'name'     => "AZList",
    52                  'desc'     => "Classifier plugin for sorting alphabetically",
    53                      'inherits' => "Yes",
    54                      'args'     => $arguments };
     55        'desc'     => "Classifier plugin for sorting alphabetically",
     56        'inherits' => "Yes",
     57        'args'     => $arguments };
    5558
    5659sub print_usage {
  • trunk/gsdl/perllib/classify/AZSectionList.pm

    r3540 r4759  
    4646
    4747my $arguments =
    48 [ {     'name' => "metadata",
     48    [ { 'name' => "metadata",
    4949    'desc' => "Metadata field used for classification. List will be sorted by this element.",
    5050    'type' => "metadata",
    51     'reqd' => "yes" } ,
    52 {   'name' => "buttonname",
    53     'desc' => "Button name for this classification. Defaults to metadata name.",
     51    'reqd' => "yes" },
     52      { 'name' => "buttonname",
     53    'desc' => "Button name for this classification.",
    5454    'type' => "string",
    55     'reqd' => "no" }
    56 ];
     55    'deft' => "Metadata element specified with -metadata",
     56    'reqd' => "no" } ];
    5757
    58 my $options =
    59 {   'name'     => "AZSectionList",
    60     'desc'     => "Classifier plugin for sorting alphabetically. This is very similar to AZList except it sorts by section level metadata (excluding the top level) instead of just top level metadata. The only change is to the classify() subroutine which must now iterate through each section, adding each to the classification.",
    61     'inherits' => "Yes",
    62     'args'     => $arguments };
     58my $options = { 'name'     => "AZSectionList",
     59        'desc'     => "Classifier plugin for sorting alphabetically. This is very similar to AZList except it sorts by section level metadata (excluding the top level) instead of just top level metadata. The only change is to the classify() subroutine which must now iterate through each section, adding each to the classification.",
     60        'inherits' => "Yes",
     61        'args'     => $arguments };
    6362
    6463sub print_usage {
     
    8483    my $self = new AZList($class, @_);
    8584
    86     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    87     my $option_list = $self->{'option_list'};
    88     push( @{$option_list}, $options );
     85    # 14-05-02 To allow for proper inheritance of arguments - John Thompson
     86    my $option_list = $self->{'option_list'};
     87    push( @{$option_list}, $options );
    8988
    9089    return bless $self, $class;
  • trunk/gsdl/perllib/classify/BasClas.pm

    r3540 r4759  
    5555
    5656my $verbosity_list =
    57 [ {     'name' => "0",
    58     'desc' => "" } ,
    59 {   'name' => "1",
    60     'desc' => "" } ,
    61 {   'name' => "2",
    62     'desc' => "" } ,
    63 {   'name' => "3",
    64     'desc' => "" }
    65 ];
     57    [ { 'name' => "0",
     58    'desc' => "No output." },
     59      { 'name' => "1",
     60    'desc' => "A little bit of output." },
     61      { 'name' => "2",
     62    'desc' => "Some output." },
     63      { 'name' => "3",
     64    'desc' => "Lots of output." } ];
    6665
    6766my $arguments =
    68 [ {     'name' => "verbosity",
    69     'desc' => "",
     67    [ { 'name' => "builddir",
     68    'desc' => "Where to put the built indexes.",
     69    'type' => "string",
     70    'deft' => "" },
     71      { 'name' => "outhandle",
     72    'desc' => "The file handle to write output to.",
     73    'type' => "string",
     74    'deft' => "STDERR" },
     75      { 'name' => "verbosity",
     76    'desc' => "Controls the quantity of output.",
    7077    'type' => "enum",
    7178    'list' => $verbosity_list,
     
    7380    'reqd' => "no" } ];
    7481
    75 my $options =
    76 {   'name'     => "BasClas",
    77         'desc'     => "Base class for all the classifiers.",
    78     'inherits' => "No",
    79     'args'     => $arguments };
     82my $options = { 'name'     => "BasClas",
     83        'desc'     => "Base class for all the classifiers.",
     84        'inherits' => "No",
     85        'args'     => $arguments };
    8086
    8187sub print_xml_usage {
    82     my $self = shift (@_);
    83     print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n";
    84     $self->print_xml();
     88    my $self = shift (@_);
     89    print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n";
     90    $self->print_xml();
    8591}
    8692
    8793sub print_xml {
    8894    my $self = shift (@_);
    89      my $option_list = $self->{'option_list'};
    90      my $option = pop( @{$option_list} );
    91      if(defined $option)
    92      {
    93           print STDERR "<ClassInfo>\n";
    94           print STDERR "  <Name>$option->{'name'}</Name>\n";
    95           print STDERR "  <Desc>$option->{'desc'}</Desc>\n";
    96           print STDERR "  <Inherits>$option->{'inherits'}</Inherits>\n";
    97           print STDERR "  <Arguments>\n";
    98           if(defined $option->{'args'})
    99           {
    100                 my $args = $option->{'args'};
    101                 my $x;
    102                 foreach $x ( @{$args} )
    103                 {
    104                      print STDERR "    <Option>\n";
    105                      print STDERR "      <Name>$x->{'name'}</Name>\n";
    106                      print STDERR "      <Desc>$x->{'desc'}</Desc>\n";
    107                      print STDERR "      <Type>$x->{'type'}</Type>\n";
    108                      print STDERR "      <Required>$x->{'reqd'}</Required>\n";
    109                      if(defined $x->{'list'})
    110                      {
    111                           print STDERR "      <List>\n";
    112                           my $list = $x->{'list'};
    113                           my $y;
    114                           foreach $y ( @{$list} )
    115                           {
    116                                 print STDERR "        <Value>\n";
    117                                 print STDERR "          <Name>$y->{'name'}</Name>\n";
    118                                 print STDERR "          <Desc>$y->{'desc'}</Desc>\n";
    119                                 print STDERR "        </Value>\n";
    120                           }
    121                           # Special case of 'input_encoding'
    122                           if( $x->{'name'} =~ m/^input_encoding$/i ) {
    123                                 my $e = $encodings::encodings;
    124                                 foreach my $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) {
    125                                      print STDERR "        <Value>\n";
    126                                      print STDERR "          <Name>$enc</Name>\n";
    127                                      print STDERR "          <Desc>$e->{$enc}->{'name'}</Desc>\n";
    128                                      print STDERR "        </Value>\n";
    129                                 }
    130                           }
    131                           print STDERR "      </List>\n";
    132                      }
    133                      if(defined $x->{'deft'})
    134                      {
    135                           print STDERR "      <Default>$x->{'deft'}</Default>\n";
    136                      }
    137                      print STDERR "    </Option>\n";
    138                 }
    139           }
    140           if(defined $option_list) {
    141                 $self->print_xml();
    142           }
    143          
    144           print STDERR "  </Arguments>\n";
    145           print STDERR "</ClassInfo>\n";
    146      }
    147 }
     95    my $option_list = $self->{'option_list'};
     96    my $option = pop( @{$option_list} );
     97    if(defined $option)
     98    {
     99    print STDERR "<ClassInfo>\n";
     100    print STDERR "  <Name>$option->{'name'}</Name>\n";
     101    print STDERR "  <Desc>$option->{'desc'}</Desc>\n";
     102    print STDERR "  <Inherits>$option->{'inherits'}</Inherits>\n";
     103    print STDERR "  <Arguments>\n";
     104    if(defined $option->{'args'})
     105    {
     106        my $args = $option->{'args'};
     107        my $x;
     108        foreach $x ( @{$args} )
     109        {
     110        print STDERR "    <Option>\n";
     111        print STDERR "      <Name>$x->{'name'}</Name>\n";
     112        print STDERR "      <Desc>$x->{'desc'}</Desc>\n";
     113        print STDERR "      <Type>$x->{'type'}</Type>\n";
     114        print STDERR "      <Required>$x->{'reqd'}</Required>\n";
     115        if(defined $x->{'list'})
     116        {
     117            print STDERR "      <List>\n";
     118            my $list = $x->{'list'};
     119            my $y;
     120            foreach $y ( @{$list} )
     121            {
     122            print STDERR "        <Value>\n";
     123            print STDERR "          <Name>$y->{'name'}</Name>\n";
     124            print STDERR "          <Desc>$y->{'desc'}</Desc>\n";
     125            print STDERR "        </Value>\n";
     126            }
     127            # Special case of 'input_encoding'
     128            if( $x->{'name'} =~ m/^input_encoding$/i ) {
     129            my $e = $encodings::encodings;
     130            foreach my $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) {
     131                print STDERR "        <Value>\n";
     132                print STDERR "          <Name>$enc</Name>\n";
     133                print STDERR "          <Desc>$e->{$enc}->{'name'}</Desc>\n";
     134                print STDERR "        </Value>\n";
     135            }
     136            }
     137            print STDERR "      </List>\n";
     138        }
     139        if(defined $x->{'deft'})
     140        {
     141            print STDERR "      <Default>$x->{'deft'}</Default>\n";
     142        }
     143        print STDERR "    </Option>\n";
     144        }
     145    }
     146    if(defined $option_list) {
     147        $self->print_xml();
     148    }
     149
     150    print STDERR "  </Arguments>\n";
     151    print STDERR "</ClassInfo>\n";
     152    }
     153}
     154
     155
     156sub new_print_usage
     157{
     158    local $self = shift(@_);
     159
     160    # Print the usage message for a classifier (recursively)
     161    local $descoffset = $self->determine_description_offset(0);
     162    $self->print_classifier_usage($descoffset, 1);
     163}
     164
     165
     166sub determine_description_offset
     167{
     168    local $self = shift(@_);
     169    local $maxoffset = shift(@_);
     170
     171    local $optionlistref = $self->{'option_list'};
     172    local @optionlist = @$optionlistref;
     173    local $classifieroptions = pop(@$optionlistref);
     174    return $maxoffset if (!defined($classifieroptions));
     175
     176    # Find the length of the longest option string of this classifier
     177    local $classifierargs = $classifieroptions->{'args'};
     178    if (defined($classifierargs)) {
     179    foreach $option (@$classifierargs) {
     180        local $optionname = $option->{'name'};
     181        local $optiontype = $option->{'type'};
     182
     183        local $optiondescoffset = 3 + length($optionname);
     184        if ($optiontype ne "flag") {
     185        $optiondescoffset = $optiondescoffset + 2 + length($optiontype) + 1;
     186        }
     187
     188        # Remember the longest
     189        if ($optiondescoffset > $maxoffset) {
     190        $maxoffset = $optiondescoffset;
     191        }
     192    }
     193    }
     194
     195    # Recurse up the classifier hierarchy
     196    $maxoffset = $self->determine_description_offset($maxoffset);
     197    $self->{'option_list'} = \@optionlist;
     198    return $maxoffset;
     199}
     200
     201
     202sub print_classifier_usage
     203{
     204    local $self = shift(@_);
     205    local $descoffset = shift(@_);
     206    local $isleafclass = shift(@_);
     207
     208    local $optionlistref = $self->{'option_list'};
     209    local @optionlist = @$optionlistref;
     210    local $classifieroptions = pop(@$optionlistref);
     211    return if (!defined($classifieroptions));
     212
     213    local $classifiername = $classifieroptions->{'name'};
     214    local $classifierargs = $classifieroptions->{'args'};
     215
     216    # Produce the usage information using the data structure above
     217    if ($isleafclass) {
     218    print STDERR " usage: classify $classifiername [options]\n\n";
     219    }
     220
     221    # Display the classifier options, if there are some
     222    if (defined($classifierargs)) {
     223    # Calculate the column offset of the option descriptions
     224    local $optiondescoffset = $descoffset + 2;  # 2 spaces between options & descriptions
     225
     226    if ($isleafclass) {
     227        print STDERR " specific options:\n";
     228    }
     229    else {
     230        print STDERR " general options (from $classifiername):\n";
     231    }
     232
     233    # Display the classifier options
     234    foreach $option (@$classifierargs) {
     235        # Display option name
     236        local $optionname = $option->{'name'};
     237        print STDERR "  -$optionname";
     238        local $optionstringlength = length("  -$optionname");
     239
     240        # Display option type, if the option is not a flag
     241        local $optiontype = $option->{'type'};
     242        if ($optiontype ne "flag") {
     243        print STDERR " <$optiontype>";
     244        $optionstringlength = $optionstringlength + length(" <$optiontype>");
     245        }
     246
     247        # Display the option description
     248        local $optiondesc = $option->{'desc'};
     249        &display_text_in_column($optiondesc, $optiondescoffset, $optionstringlength, 80);
     250
     251        # Show the default value for the option, if there is one
     252        local $optiondefault = $option->{'deft'};
     253        if (defined($optiondefault)) {
     254        print STDERR " " x $optiondescoffset;
     255        print STDERR "Default: " . $optiondefault . "\n";
     256        }
     257
     258        # If the option has a list of possible values, display these
     259        local $optionvalueslist = $option->{'list'};
     260        if (defined($optionvalueslist)) {
     261        print STDERR "\n";
     262        foreach $optionvalue (@$optionvalueslist) {
     263            local $optionvaluename = $optionvalue->{'name'};
     264            print STDERR " " x $optiondescoffset;
     265            print STDERR "$optionvaluename:";
     266
     267            local $optionvaluedesc = $optionvalue->{'desc'};
     268            &display_text_in_column($optionvaluedesc, ($optiondescoffset + 2),
     269                        $optiondescoffset + length($optionvaluename), 80);
     270        }
     271        }
     272
     273        # Special case for 'input_encoding'
     274        if ($optionname =~ m/^input_encoding$/i) {
     275        my $e = $encodings::encodings;
     276        foreach $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) {
     277            local $encodingname = $enc;
     278            print STDERR " " x $optiondescoffset;
     279            print STDERR "$encodingname:";
     280
     281            local $encodingdesc = $e->{$enc}->{'name'};
     282            &display_text_in_column($encodingdesc, ($optiondescoffset + 2),
     283                        $optiondescoffset + length($encodingname), 80);
     284        }
     285        }
     286
     287        # Add a blank line to separate options
     288        print STDERR "\n";
     289    }
     290    }
     291
     292    # Recurse up the classifier hierarchy
     293    $self->print_classifier_usage($descoffset, 0);
     294    $self->{'option_list'} = \@optionlist;
     295}
     296
     297
     298sub display_text_in_column
     299{
     300    local ($text, $columnbeg, $firstlineoffset, $columnend) = @_;
     301
     302    # Spaces are put *before* words, so treat the column beginning as 1 smaller than it is
     303    $columnbeg = $columnbeg - 1;
     304
     305    # Add some padding (if needed) for the first line
     306    local $linelength = $columnbeg;
     307    if ($firstlineoffset < $columnbeg) {
     308    print STDERR " " x ($columnbeg - $firstlineoffset);
     309    }
     310    else {
     311    $linelength = $firstlineoffset;
     312    }
     313
     314    # Break the text into words, and display one at a time
     315    local @words = split(/ /, $text);
     316
     317    foreach $word (@words) {
     318    # Unescape '<' and '>' characters
     319    $word =~ s/&lt;/</g;
     320    $word =~ s/&gt;/>/g;
     321
     322    # If printing this word would except the column end, start a new line
     323    if (($linelength + length($word)) >= $columnend) {
     324        print STDERR "\n";
     325        print STDERR " " x $columnbeg;
     326        $linelength = $columnbeg;
     327    }
     328
     329    # Write the word
     330    print STDERR " $word";
     331    $linelength = $linelength + length(" $word");
     332    }
     333
     334    print STDERR "\n";
     335}
     336
    148337
    149338sub print_general_usage {
  • trunk/gsdl/perllib/classify/Browse.pm

    r3540 r4759  
    3535}
    3636
    37 my $options =
    38 {   'name'     => "Browse",
    39     'desc'     => "",
    40     'inherits' => "Yes" };
     37my $options = { 'name'     => "Browse",
     38        'desc'     => "",
     39        'inherits' => "Yes" };
    4140
    4241sub print_usage {
     
    5150    my $self = new BasClas($class, @_);
    5251 
    53      # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    54     my $option_list = $self->{'option_list'};
    55     push( @{$option_list}, $options ); 
    56    
     52   # 14-05-02 To allow for proper inheritance of arguments - John Thompson
     53    my $option_list = $self->{'option_list'};
     54    push( @{$option_list}, $options ); 
     55
    5756    # classifier information
    5857    $self->{'collection'} = $ENV{'GSDLCOLLECTION'};
  • trunk/gsdl/perllib/classify/DateList.pm

    r3540 r4759  
    4444}
    4545
    46 my $arguments = 
    47 [ {     'name' => "bymonth",
     46my $arguments =
     47    [ { 'name' => "bymonth",
    4848    'desc' => "Classify by year and month.",
    4949    'type' => "flag",
    50     'reqd' => "no" }
    51 ];
    52 
    53 my $options =
    54 {   'name'     => "DateList",
    55     'desc'     => "Classifier plugin for sorting by date. Always sorts by 'Date' metadata. Date is assumed to be in the form yyyymmdd.",
    56     'inherits' => "Yes",
    57     'args'     => $arguments };
     50    'reqd' => "no" } ];
     51
     52my $options = { 'name'     => "DateList",
     53        'desc'     => "Classifier plugin for sorting by date. Always sorts by 'Date' metadata. Date is assumed to be in the form yyyymmdd.",
     54        'inherits' => "Yes",
     55        'args'     => $arguments };
    5856
    5957sub print_usage {
  • trunk/gsdl/perllib/classify/HTML.pm

    r3540 r4759  
    4242
    4343my $arguments =
    44 [ {     'name' => "url",
     44    [ { 'name' => "url",
    4545    'desc' => "The url of the web page to link to.",
    4646    'type' => "string",
    4747    'reqd' => "yes" } ,
    48 {   'name' => "buttonname",
    49     'desc' => "The title field for this classification. If not included title field 'Browse'.",
     48      { 'name' => "buttonname",
     49    'desc' => "The title field for this classification.",
    5050    'type' => "string",
    51     'reqd' => "no" }
    52 ];
     51    'deft' => "Browse",
     52    'reqd' => "no" } ];
    5353
    54 my $options =
    55 {   'name'     => "HTML",
    56     'desc'     => "Creates an empty classification that's simply a link to a web page.",
    57     'inherits' => "Yes",
    58     'args'     => $arguments };
     54my $options = { 'name'     => "HTML",
     55        'desc'     => "Creates an empty classification that's simply a link to a web page.",
     56        'inherits' => "Yes",
     57        'args'     => $arguments };
    5958
    6059sub print_usage {
     
    7574    my $self = new BasClas($class, @_);
    7675
    77     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    78     my $option_list = $self->{'option_list'};
    79     push( @{$option_list}, $options );
    80    
     76    # 14-05-02 To allow for proper inheritance of arguments - John Thompson
     77    my $option_list = $self->{'option_list'};
     78    push( @{$option_list}, $options );
     79
    8180    my ($title, $url);
    8281   
  • trunk/gsdl/perllib/classify/Hierarchy.pm

    r3728 r4759  
    5555}
    5656
    57 my $arguments = 
    58 [ {     'name' => "metadata",
    59     'desc' => "Metadata field used for classification. List will be sorted by this element.",
     57my $arguments =
     58    [ { 'name' => "metadata",
     59    'desc' => "Metadata field used for classification. List will be sorted by this element, unless -sort is used.",
    6060    'type' => "metadata",
    61     'reqd' => "yes" } ,
    62 {   'name' => "buttonname",
    63     'desc' => "Button name for this classification. Defaults to metadata name.",
     61    'reqd' => "yes" },
     62      { 'name' => "buttonname",
     63    'desc' => "Title field for this classification.",
    6464    'type' => "string",
    65     'reqd' => "no" } ,
    66 {   'name' => "hfile",
     65    'deft' => "Metadata element specified with -metadata",
     66    'reqd' => "no" },
     67      { 'name' => "hfile",
    6768    'desc' => "The classification structure file.",
    6869    'type' => "string",
    69     'reqd' => "yes" } ,
    70 {   'name' => "sort",
    71     'desc' => "Metadata field to sort by (defaults to none).",
     70    'deft' => "",
     71    'reqd' => "yes" },
     72      { 'name' => "sort",
     73    'desc' => "Metadata field to sort by. Use '-sort nosort' for no sorting.",
    7274    'type' => "string",
    73     'reqd' => "no" } ,
    74 {   'name' => "hlist_at_top",
     75    'deft' => "Metadata field specified with -metadata",
     76    'reqd' => "no" },
     77      { 'name' => "hlist_at_top",
    7578    'desc' => "Display the first level of the classification horizontally.",
    7679    'type' => "flag",
    77     'reqd' => "no" }
    78 ];
     80    'reqd' => "no" } ];
    7981
    8082my $options =
  • trunk/gsdl/perllib/classify/List.pm

    r3728 r4759  
    5050
    5151my $arguments =
    52 [ {     'name' => "metadata",
     52    [ { 'name' => "metadata",
    5353    'desc' => "Metadata field used for classification. List will be sorted by this element.",
    5454    'type' => "metadata",
    5555    'reqd' => "yes" } ,
    56 {   'name' => "buttonname",
    57     'desc' => "Button name for this classification. Defaults to metadata name.",
     56      { 'name' => "buttonname",
     57    'desc' => "Button name for this classification.",
    5858    'type' => "string",
    59     'reqd' => "no" } ,
    60 {   'name' => "sort",
    61     'desc' => "Sort documents in list by this metadata field. By default it will sort by Metaname, or (if this is not set) in build (random) order.",
     59    'deft' => "Metadata element specified with -metadata",
     60    'reqd' => "no" },
     61      { 'name' => "sort",
     62    'desc' => "Metadata field to sort by. If not set, sorts in build (random) order.",
    6263    'type' => "string",
    63     'reqd' => "no" }
    64 ];
    65 
    66 my $options =
    67 {   'name'     => "List",
    68     'desc'     => "Simple list classifier plugin.",
    69     'inherits' => "Yes",
    70     'args'     => $arguments };
    71 
     64    'deft' => "Metadata field specified with -metadata",
     65    'reqd' => "no" } ];
     66
     67my $options = { 'name'     => "List",
     68        'desc'     => "Simple list classifier plugin.",
     69        'inherits' => "Yes",
     70        'args'     => $arguments };
    7271
    7372sub print_usage {
     
    9291    my $self = new BasClas($class, @_);
    9392
    94     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    95     my $option_list = $self->{'option_list'};
    96     push( @{$option_list}, $options );
    97    
     93    # 14-05-02 To allow for proper inheritance of arguments - John Thompson
     94    my $option_list = $self->{'option_list'};
     95    push( @{$option_list}, $options );
     96
    9897    my ($metaname, $title, $sortname, $list);
    9998
  • trunk/gsdl/perllib/classify/Phind.pm

    r3540 r4759  
    8484}
    8585
    86 my $arguments = 
    87 [ {     'name' => "text",
    88     'desc' => "The text used to build the phrase hierarchy (default: 'section:Title,section:text').",
     86my $arguments =
     87    [ { 'name' => "text",
     88    'desc' => "The text used to build the phrase hierarchy.",
    8989    'type' => "string",
    90     'reqd' => "no" } ,
    91 {   'name' => "title",
    92     'desc' => "The metadata field used to describe each document (default: 'Title').",
     90    'deft' => "section:Title,section:text",
     91    'reqd' => "no" },
     92      { 'name' => "title",
     93    'desc' => "The metadata field used to describe each document.",
    9394    'type' => "metadata",
    94     'reqd' => "no" } ,
    95 {   'name' => "button",
    96     'desc' => "The label for the classifier screen and button in navigation bar (default: 'Phrase').",
     95    'deft' => "Title",
     96    'reqd' => "no" },
     97      { 'name' => "button",
     98    'desc' => "The label for the classifier screen and button in navigation bar.",
    9799    'type' => "string",
    98     'reqd' => "no" } ,
    99 {   'name' => "language",
    100     'desc' => "Language or languages to use building hierarchy. Languages are identified by two-letter country codes like en (English), es (Spanish), and fr (French). Language is a regular expression, so 'en|fr' (English or French) and '..' (match any language) are valid (default: 'en').",
     100    'deft' => "Phrase",
     101    'reqd' => "no" },
     102      { 'name' => "language",
     103    'desc' => "Language or languages to use building hierarchy. Languages are identified by two-letter country codes like en (English), es (Spanish), and fr (French). Language is a regular expression, so 'en|fr' (English or French) and '..' (match any language) are valid.",
    101104    'type' => "language",
    102     'reqd' => "no" } ,
    103 {   'name' => "savephrases",
    104     'desc' => "If set, the phrase infomation will be stored in the given file as text. It is probably a good idea to use an absolute path (default: not set).",
     105    'deft' => "en",
     106    'reqd' => "no" },
     107      { 'name' => "savephrases",
     108    'desc' => "If set, the phrase infomation will be stored in the given file as text. It is probably a good idea to use an absolute path.",
    105109    'type' => "string",
    106     'reqd' => "no" } ,
    107 {   'name' => "suffixmode",
    108     'desc' => "The smode parameter to the phrase extraction program. A value of 0 means that stopwords are ignored, and of 1 means that stopwords are used (default: 1).",
     110    'deft' => "",
     111    'reqd' => "no" },
     112      { 'name' => "builddir",
     113    'desc' => "Where to put the built indexes.",
     114    'type' => "string",
     115    'deft' => "" },
     116      { 'name' => "suffixmode",
     117    'desc' => "The smode parameter to the phrase extraction program. A value of 0 means that stopwords are ignored, and of 1 means that stopwords are used.",
    109118    'type' => "int",
    110     'reqd' => "no" } ,
    111 {   'name' => "thesaurus",
    112     'desc' => "Name of a thesaurus stored in Phind format in the collection's etc directory (default: not set).",
     119    'deft' => "1",
     120    'reqd' => "no" },
     121      { 'name' => "thesaurus",
     122    'desc' => "Name of a thesaurus stored in Phind format in the collection's etc directory.",
    113123    'type' => "string",
    114     'reqd' => "no" } ,
    115 {   'name' => "untidy",
     124    'deft' => "",
     125    'reqd' => "no" },
     126      { 'name' => "untidy",
    116127    'desc' => "Don't remove working files.",
    117128    'type' => "flag",
    118     'reqd' => "no" }
    119 ];
    120 
    121 my $options =
    122 {   'name'     => "Phind",
    123     'desc'     => "The Phind clasifier plugin.",
    124     'inherits' => "Yes",
    125     'args'     => $arguments };
     129    'reqd' => "no" } ];
     130
     131my $options = { 'name'     => "Phind",
     132        'desc'     => "The Phind clasifier plugin.",
     133        'inherits' => "Yes",
     134        'args'     => $arguments };
    126135
    127136sub print_usage {
  • trunk/gsdl/perllib/classify/SectionList.pm

    r3540 r4759  
    4040
    4141my $arguments =
    42 [ {     'name' => "metadata",
     42    [ { 'name' => "metadata",
    4343    'desc' => "Metadata field used for classification. List will be sorted by this element.",
    4444    'type' => "metadata",
    4545    'reqd' => "yes" } ,
    46 {   'name' => "buttonname",
    47     'desc' => "Button name for this classification. Defaults to metadata name.",
     46      { 'name' => "buttonname",
     47    'desc' => "Button name for this classification.",
    4848    'type' => "string",
    49     'reqd' => "no" } ,
    50 {   'name' => "sort",
    51     'desc' => "Sort documents in list by this metadata field. By default it will sort by Metaname, or (if this is not set) in build (random) order.",
     49    'deft' => "Metadata element specified with -metadata",
     50    'reqd' => "no" },
     51      { 'name' => "sort",
     52    'desc' => "Metadata field to sort by. If not set, sorts in build (random) order.",
    5253    'type' => "string",
    53     'reqd' => "no" }
    54 ];
     54    'deft' => "Metadata field specified with -metadata",
     55    'reqd' => "no" } ];
    5556
    56 my $options =
    57 {   'name'     => "SectionList",
    58     'desc'     => "Same as List classifier but includes all sections of document (excluding top level) rather than just top level document itself.",
    59     'inherits' => "Yes",
    60     'args'     => $arguments };
     57my $options = { 'name'     => "SectionList",
     58        'desc'     => "Same as List classifier but includes all sections of document (excluding top level) rather than just top level document itself.",
     59        'inherits' => "Yes",
     60        'args'     => $arguments };
    6161
    6262sub print_usage {
Note: See TracChangeset for help on using the changeset viewer.