Changeset 4786


Ignore:
Timestamp:
2003-06-24T14:52:26+12:00 (21 years ago)
Author:
mdewsnip
Message:

Commented out print_usage functions - classifiers should now call $self->print_txt_usage() to display their usage text. Updates to the options of a classifier should be made in the $options and $arguments data structures at the top of the classifier.

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

Legend:

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

    r4759 r4786  
    115115    'args'     => $arguments };
    116116
    117 sub print_usage {
    118     print STDERR "
    119   usage: classify AZCompactList -metadata X [options]
    120   options:
    121    -metadata X            (required) Metadata field used for classification
    122    -buttonname X          Title to use on web pages (defaults to metadata)
    123    -removeprefix regex    pattern to remove from metadata before sorting
    124    -doclevel top|section  (Defaults to top)
    125    -freqsort              Sort by node frequency rather than alpha-numeric
    126    -mingroup N            Minimum num of documents required to form a new group
    127    -minnesting N          Minimum list size to become a nested list
    128    -mincompact N          Used in compact list
    129    -maxcompact N          Used in compact list
    130    -onlyfirst             Only use the first value if metadata is repeated.
    131    -recopt
    132 ";
    133 }
     117sub print_usage {
     118    print STDERR "
     119  usage: classify AZCompactList -metadata X [options]
     120  options:
     121   -metadata X            (required) Metadata field used for classification
     122   -buttonname X          Title to use on web pages (defaults to metadata)
     123   -removeprefix regex    pattern to remove from metadata before sorting
     124   -doclevel top|section  (Defaults to top)
     125   -freqsort              Sort by node frequency rather than alpha-numeric
     126   -mingroup N            Minimum num of documents required to form a new group
     127   -minnesting N          Minimum list size to become a nested list
     128   -mincompact N          Used in compact list
     129   -maxcompact N          Used in compact list
     130   -onlyfirst             Only use the first value if metadata is repeated.
     131   -recopt
     132";
     133}
    134134
    135135sub new {
     
    168168   
    169169    print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    170     &print_usage();
     170    $self->print_txt_usage();
    171171    die "\n";
    172172    }
  • trunk/gsdl/perllib/classify/AZList.pm

    r4759 r4786  
    5757        'args'     => $arguments };
    5858
    59 sub print_usage {
    60     print STDERR "
    61   usage: classify AZList [options]
    62   options:
     59sub print_usage {
     60    print STDERR "
     61  usage: classify AZList [options]
     62  options:
    6363 
    64   -metadata X           (required) Metadata field used for classification.
    65                         List will be sorted by this element.
    66 
    67   -buttonname X         (optional) Button name for this classification.
    68                         defaults to metadata name.
    69 
    70   -removeprefix regex   (optional) A prefix to ignore in the Metadata values
    71                         for the field when sorting.
    72 ";
    73 }
     64  -metadata X           (required) Metadata field used for classification.
     65                        List will be sorted by this element.
     66
     67  -buttonname X         (optional) Button name for this classification.
     68                        defaults to metadata name.
     69
     70  -removeprefix regex   (optional) A prefix to ignore in the Metadata values
     71                        for the field when sorting.
     72";
     73}
    7474
    7575sub new {
     
    9090   
    9191    print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    92     &print_usage();
     92    $self->print_txt_usage();
    9393    die "\n";
    9494    }
    9595
    9696    if (!defined $metaname) {
    97     &print_usage;
     97    $self->print_txt_usage();
    9898    print STDERR "AZList used with no metadata name\n";
    9999    die "\n";
  • trunk/gsdl/perllib/classify/AZSectionList.pm

    r4759 r4786  
    6161        'args'     => $arguments };
    6262
    63 sub print_usage {
    64     print STDERR "
    65   usage: classify AZSectionList [options]
    66   options:
     63sub print_usage {
     64    print STDERR "
     65  usage: classify AZSectionList [options]
     66  options:
    6767
    68   -metadata X    (required) Metadata field used for classification,
    69                   list will be sorted by this element.
     68  -metadata X    (required) Metadata field used for classification,
     69                  list will be sorted by this element.
    7070
    71   -buttonname X  (OPTIONAL) Title field for this classification.
    72                   if not included title field will be Metaname.
     71  -buttonname X  (OPTIONAL) Title field for this classification.
     72                  if not included title field will be Metaname.
    7373
    74   -removeprefix regex A prefix to ignore in the Metadata values
    75                       for the field when sorting.
    76 This is very similar to AZList except it sorts by section level metadata
    77 (excluding the top level) instead of just top level metadata.
    78 ";
    79 }
     74  -removeprefix regex A prefix to ignore in the Metadata values
     75                      for the field when sorting.
     76This is very similar to AZList except it sorts by section level metadata
     77(excluding the top level) instead of just top level metadata.
     78";
     79}
    8080
    8181sub new {
  • trunk/gsdl/perllib/classify/BasClas.pm

    r4778 r4786  
    210210#  }
    211211
    212 # print_usage should be overridden for any sub-classes
    213212# sub print_usage {
    214213#     print STDERR "
     
    238237    print STDERR "(general options are those available to all classifiers).\n";
    239238    print STDERR "Check your collect.cfg configuration file.\n";
    240         # &print_general_usage($plugin_name);
    241239    &print_txt_usage();
    242240    die "\n";
  • trunk/gsdl/perllib/classify/Browse.pm

    r4759 r4786  
    3939        'inherits' => "Yes" };
    4040
    41 sub print_usage {
    42     print STDERR "
    43   usage: classify Browse
    44   This classifier has no options (yet).
    45 ";
    46 }
     41sub print_usage {
     42    print STDERR "
     43  usage: classify Browse
     44  This classifier has no options (yet).
     45";
     46}
    4747
    4848sub new {
  • trunk/gsdl/perllib/classify/DateList.pm

    r4759 r4786  
    5555        'args'     => $arguments };
    5656
    57 sub print_usage {
    58     print STDERR "
    59   usage: classify DateList [options]
    60   options:
    61     -bymonth  [or bymonth=1]    Classify by year and month
    62 
    63     Classifier plugin for sorting by date.
    64     Always sorts by 'Date' metadata.
    65     Date is assumed to be in the form yyyymmdd (all digits).
    66     By default dates are split by year - this should change.
    67 
    68     Any errors are Dana's problem.
    69 ";
    70 }
     57sub print_usage {
     58    print STDERR "
     59  usage: classify DateList [options]
     60  options:
     61 -bymonth  [or bymonth=1]    Classify by year and month
     62
     63 Classifier plugin for sorting by date.
     64 Always sorts by 'Date' metadata.
     65 Date is assumed to be in the form yyyymmdd (all digits).
     66 By default dates are split by year - this should change.
     67
     68 Any errors are Dana's problem.
     69";
     70}
    7171
    7272sub new {
     
    7474    my $self = new BasClas($class, @_);
    7575
    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 );
     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 );
    7979
    8080    $self->{'list'} = {};
     
    8282                         q^bymonth^, \$self->{'bymonth'},
    8383                         "allow_extra_options")) {
    84         &print_usage();
    85         die "\n";
     84    $self->print_txt_usage();
     85    die "\n";
    8686    }
    8787    return bless $self, $class;
  • trunk/gsdl/perllib/classify/HTML.pm

    r4759 r4786  
    5757        'args'     => $arguments };
    5858
    59 sub print_usage {
    60     print STDERR "
    61   usage: classify AZList [options]
    62   options:
    63    -url X         The url of the web page to link to.
    64    -buttonname X  (optional) the title field for this classification.
    65                   The default is 'Browse'
     59sub print_usage {
     60    print STDERR "
     61  usage: classify AZList [options]
     62  options:
     63   -url X         The url of the web page to link to.
     64   -buttonname X  (optional) the title field for this classification.
     65                  The default is 'Browse'
    6666
    67 HTML classifier plugin - creates classifier that is a link to a web page
     67HTML classifier plugin - creates classifier that is a link to a web page
    6868
    69 ";
    70 }
     69";
     70}
    7171
    7272sub new {
     
    8686   
    8787    print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    88     &print_usage();
     88    $self->print_txt_usage();
    8989    die "\n";
    9090    }
  • trunk/gsdl/perllib/classify/Hierarchy.pm

    r4759 r4786  
    8686    'args'     => $arguments };
    8787
    88 sub print_usage {
    89     print STDERR "
    90   usage: classify Hierarchy [options]
    91   options:
    92 
    93    -buttonname X  Title field for this classification.
    94                   Defaults to metadata name.
    95 
    96    -metadata X    Metadata field used for classification,
    97                   list will be sorted by this element,
    98                   unless -sort is used.
    99 
    100    -hfile X       The classification structure file
    101 
    102    -sort X        Metadata field to sort by (defaults to -metadata)
    103                   use '-sort nosort' for no sorting.
    104 
    105    -hlist_at_top  Display the first level of the classification
    106                   horizontally.
    107 ";
    108 }
     88sub print_usage {
     89    print STDERR "
     90  usage: classify Hierarchy [options]
     91  options:
     92
     93   -buttonname X  Title field for this classification.
     94                  Defaults to metadata name.
     95
     96   -metadata X    Metadata field used for classification,
     97                  list will be sorted by this element,
     98                  unless -sort is used.
     99
     100   -hfile X       The classification structure file
     101
     102   -sort X        Metadata field to sort by (defaults to -metadata)
     103                  use '-sort nosort' for no sorting.
     104
     105   -hlist_at_top  Display the first level of the classification
     106                  horizontally.
     107";
     108}
    109109
    110110
     
    151151        if (!-e $subjectfile) {
    152152        my $outhandle = $self->{'outhandle'};
    153         &print_usage;
     153        $self->print_txt_usage();
    154154        print STDERR "\nHierarchy Error: Can't locate subject file $hfile\n";
    155155        print STDERR "This file should be in $collfile or $subjectfile\n";
     
    175175    if(defined $self->{'construction_error'} || !defined $self->{'metaname'} || !defined $self->{'subjectfile'}) {
    176176    print STDERR "Error: " , $self->{'construction_error'} , "\n";
    177     &print_usage;
     177    $self->print_txt_usage();
    178178    die "\n";
    179179    }
  • trunk/gsdl/perllib/classify/List.pm

    r4759 r4786  
    7070        'args'     => $arguments };
    7171
    72 sub print_usage {
    73     print STDERR "
    74   usage: classify List [options]
    75   options:
    76 
    77    -metadata X    Metadata field used for classification,
    78                   list will be sorted by this element.
    79 
    80    -buttonname X  (optional) Title field for this classification.
    81                   if not included title field will be Metaname.
    82 
    83    -sort X        (optional) Sort documents in list by this metadata field.
    84                   By default it will sort by Metaname, or (if this is not
    85                   set) in build (random) order.
    86 ";
    87 }
     72sub print_usage {
     73    print STDERR "
     74  usage: classify List [options]
     75  options:
     76
     77   -metadata X    Metadata field used for classification,
     78                  list will be sorted by this element.
     79
     80   -buttonname X  (optional) Title field for this classification.
     81                  if not included title field will be Metaname.
     82
     83   -sort X        (optional) Sort documents in list by this metadata field.
     84                  By default it will sort by Metaname, or (if this is not
     85                  set) in build (random) order.
     86";
     87}
    8888
    8989sub new {
     
    104104   
    105105    print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    106     &print_usage();
     106    $self->print_txt_usage();
    107107    die "\n";
    108108    }
  • trunk/gsdl/perllib/classify/Phind.pm

    r4759 r4786  
    2828
    2929# The Phind clasifier plugin.
    30 # Options are dexcribed in the print_usage function.
    3130# Type "classinfo.pl Phind" at the command line for a summary.
    3231
     
    134133        'args'     => $arguments };
    135134
    136 sub print_usage {
    137     print STDERR "
    138   usage: classify Phind [options]
    139 
    140   options:
    141    -text Fields    The text used to build the phrase hierarchy.
    142                    (default: 'section:Title,section:text')
    143 
    144    -title Title    The metadata field used to describe each document.
    145                    (default: 'Title')
    146 
    147    -button Name    The label for the classifier screen and button in
    148                    navigation bar.
    149                    (default: 'Phrase')
    150 
    151    -language Regex Language or languages to use building hierarchy.
    152                    Languages are identified by two-letter country codes
    153                    like en (English), es (Spanish), and fr (French).
    154                    Language is a regular expression, so 'en|fr' (English or
    155                    French) and '..' (match any language) are valid.
    156                    (default: 'en'.)
    157 
    158    -savephrases File If set, the phrase infomation will be stored in
    159                      the given file as text. It is probably a good idea
    160                      to use an absolute path.
    161                      (default: not set)
    162 
    163    -suffixmode N   The smode parameter to the phrase extraction program.  A
    164                    value of 0 means that stopwords are ignored, and of 1
    165                    means that stopwords are used.
    166                    (default: 1)
    167 
    168    -thesaurus Name Name of a thesaurus stored in Phind format in the
    169                    collection's etc directory.
    170                    (default: not set)
    171 
    172    -untidy         Don't remove working files.
    173 
    174 "; }
     135sub print_usage {
     136    print STDERR "
     137  usage: classify Phind [options]
     138
     139  options:
     140   -text Fields    The text used to build the phrase hierarchy.
     141                   (default: 'section:Title,section:text')
     142
     143   -title Title    The metadata field used to describe each document.
     144                   (default: 'Title')
     145
     146   -button Name    The label for the classifier screen and button in
     147                   navigation bar.
     148                   (default: 'Phrase')
     149
     150   -language Regex Language or languages to use building hierarchy.
     151                   Languages are identified by two-letter country codes
     152                   like en (English), es (Spanish), and fr (French).
     153                   Language is a regular expression, so 'en|fr' (English or
     154                   French) and '..' (match any language) are valid.
     155                   (default: 'en'.)
     156
     157   -savephrases File If set, the phrase infomation will be stored in
     158                     the given file as text. It is probably a good idea
     159                     to use an absolute path.
     160                     (default: not set)
     161
     162   -suffixmode N   The smode parameter to the phrase extraction program.  A
     163                   value of 0 means that stopwords are ignored, and of 1
     164                   means that stopwords are used.
     165                   (default: 1)
     166
     167   -thesaurus Name Name of a thesaurus stored in Phind format in the
     168                   collection's etc directory.
     169                   (default: not set)
     170
     171   -untidy         Don't remove working files.
     172
     173"; }
    175174
    176175# Phrase delimiter symbols - these should be abstracted out someplace
     
    189188    my $self = new BasClas($class, @_);
    190189
    191     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    192     my $option_list = $self->{'option_list'};
    193     push( @{$option_list}, $options );
     190    # 14-05-02 To allow for proper inheritance of arguments - John Thompson
     191    my $option_list = $self->{'option_list'};
     192    push( @{$option_list}, $options );
    194193
    195194    my $out = $self->{'outhandle'};
     
    220219   
    221220    print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    222     &print_usage();
     221    $self->print_txt_usage();
    223222    die "\n";
    224223    }
  • trunk/gsdl/perllib/classify/SectionList.pm

    r4759 r4786  
    6060        'args'     => $arguments };
    6161
    62 sub print_usage {
    63     print STDERR "
    64   usage: classify SectionList [options]
    65   options:
     62sub print_usage {
     63    print STDERR "
     64  usage: classify SectionList [options]
     65  options:
    6666
    67    -metadata X    Metadata field used for classification,
    68                   list will be sorted by this element.
     67   -metadata X    Metadata field used for classification,
     68                  list will be sorted by this element.
    6969
    70    -buttonname X  (optional) Title field for this classification.
    71                   if not included title field will be Metaname.
     70   -buttonname X  (optional) Title field for this classification.
     71                  if not included title field will be Metaname.
    7272
    73    -sort X        (optional) Sort documents in list by this metadata field.
    74                   By default it will sort by Metaname, or (if this is not
    75                   set) in build (random) order.
     73   -sort X        (optional) Sort documents in list by this metadata field.
     74                  By default it will sort by Metaname, or (if this is not
     75                  set) in build (random) order.
    7676
    77 Same as List classifier but includes all sections of document
    78 (excluding top level) rather than just top level document.
    79 ";
    80 }
     77Same as List classifier but includes all sections of document
     78(excluding top level) rather than just top level document.
     79";
     80}
    8181
    8282sub new {
     
    8484    my $self = new List($class, @_);
    8585
    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 );
    89  
     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 );
     89
    9090    return bless $self, $class;
    9191}
Note: See TracChangeset for help on using the changeset viewer.