Changeset 6968


Ignore:
Timestamp:
2004-03-08T15:39:43+13:00 (20 years ago)
Author:
kjdon
Message:

all classifiers now use BasClas.buttonname for their buttonname option description.
removed the old print_usage methods and old usage notes.
added in a test for $self->{'info_only'} in new(): if this is set, don't try and parse the arguments cos we are only running classinfo.pl.

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

Legend:

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

    r6940 r6968  
    6262    'reqd' => "yes" },
    6363      { 'name' => "buttonname",
    64     'desc' => "{AZCompactList.buttonname}",
     64    'desc' => "{BasClas.buttonname}",
    6565    'type' => "string",
    6666    'deft' => "{BasClas.metadata.deft}",
     
    127127    'args'     => $arguments };
    128128
    129 #  sub print_usage {
    130 #      print STDERR "
    131 #    usage: classify AZCompactList -metadata X [options]
    132 #    options:
    133 #     -metadata X            (required) Metadata field used for classification
    134 #     -buttonname X          Title to use on web pages (defaults to metadata)
    135 #     -removeprefix regex    pattern to remove from metadata before sorting
    136 #     -doclevel top|section  (Defaults to top)
    137 #     -freqsort              Sort by node frequency rather than alpha-numeric
    138 #     -mingroup N            Minimum num of documents required to form a new group
    139 #     -minnesting N          Minimum list size to become a nested list
    140 #     -mincompact N          Used in compact list
    141 #     -maxcompact N          Used in compact list
    142 #     -onlyfirst             Only use the first value if metadata is repeated.
    143 #     -recopt
    144 #  ";
    145 #  }
    146129
    147130sub new {
     
    153136    push( @{$option_list}, $options );
    154137
     138    if ($self->{'info_only'}) {
     139    # created from classinfo.pl - don't need to parse the arguments
     140    return bless $self, $class;
     141    }
    155142
    156143    my ($metaname, $title, $removeprefix, $removesuffix);
  • trunk/gsdl/perllib/classify/AZCompactSectionList.pm

    r6408 r6968  
    2929    my $option_list = $self->{'option_list'};
    3030    push( @{$option_list}, $options );
     31
     32    #if ($self->{'info_only'}) {
     33    # created from classinfo.pl - don't need to parse the arguments
     34    #return bless $self, $class;
     35    #}
    3136
    3237    return bless $self, $class;
  • trunk/gsdl/perllib/classify/AZList.pm

    r6961 r6968  
    4343    'reqd' => "yes" } ,
    4444      { 'name' => "buttonname",
    45     'desc' => "{AZList.buttonname}",
     45    'desc' => "{BasClas.buttonname}",
    4646    'type' => "string",
    4747    'deft' => "{BasClas.metadata.deft}",
     
    7373    push( @{$option_list}, $options );
    7474   
     75    if ($self->{'info_only'}) {
     76    # created from classinfo.pl - don't need to parse the arguments
     77    return bless $self, $class;
     78    }
    7579    my ($metadata, $title, $removeprefix, $removesuffix);
    7680   
  • trunk/gsdl/perllib/classify/AZSectionList.pm

    r6940 r6968  
    5151    'reqd' => "yes" },
    5252      { 'name' => "buttonname",
    53     'desc' => "{AZList.buttonname}",
     53    'desc' => "{BasClas.buttonname}",
    5454    'type' => "string",
    5555    'deft' => "{BasClas.metadata.deft}",
     
    6262        'args'     => $arguments };
    6363
    64 #  sub print_usage {
    65 #      print STDERR "
    66 #    usage: classify AZSectionList [options]
    67 #    options:
    68 
    69 #    -metadata X    (required) Metadata field used for classification,
    70 #                    list will be sorted by this element.
    71 
    72 #    -buttonname X  (OPTIONAL) Title field for this classification.
    73 #                    if not included title field will be Metaname.
    74 
    75 #    -removeprefix regex A prefix to ignore in the Metadata values
    76 #                        for the field when sorting.
    77 #  This is very similar to AZList except it sorts by section level metadata
    78 #  (excluding the top level) instead of just top level metadata.
    79 #  ";
    80 #  }
    8164
    8265sub new {
     
    8770    my $option_list = $self->{'option_list'};
    8871    push( @{$option_list}, $options );
     72   
     73    #if ($self->{'info_only'}) {
     74    # created from classinfo.pl - don't need to parse the arguments
     75    #   return bless $self, $class;
     76    #}
    8977
    9078    return bless $self, $class;
  • trunk/gsdl/perllib/classify/BasClas.pm

    r6956 r6968  
    219219   
    220220    $self->{'option_list'} = [ $options ];
     221    my $gsdlinfo;
    221222
    222223    # general options available to all classifiers
     
    226227             q^verbosity/\d/2^, \$self->{'verbosity'},
    227228             q^ignore_namespace^, \$self->{'ignore_namespace'},
     229             q^gsdlinfo^, \$gsdlinfo,
    228230             "allow_extra_options")) {
    229231
     
    233235    }
    234236
     237    if ($gsdlinfo) {
     238    # created from classinfo.pl - set this so subclasses don't need to
     239    # parse the arguments
     240    $self->{'info_only'} = 1;
     241    }
    235242    return bless $self, $class;
    236243}
  • trunk/gsdl/perllib/classify/Browse.pm

    r6408 r6968  
    4040        'inherits' => "yes" };
    4141
    42 #  sub print_usage {
    43 #      print STDERR "
    44 #    usage: classify Browse
    45 #    This classifier has no options (yet).
    46 #  ";
    47 #  }
    4842
    4943sub new {
     
    5448    my $option_list = $self->{'option_list'};
    5549    push( @{$option_list}, $options ); 
     50
     51    if ($self->{'info_only'}) {
     52    # created from classinfo.pl - don't need to parse the arguments
     53    return bless $self, $class;
     54    }
    5655
    5756    # classifier information
  • trunk/gsdl/perllib/classify/Collage.pm

    r6808 r6968  
    2424###########################################################################
    2525
    26 # simple list classifier plugin
    27 # options are:
    28 # metadata=Metaname -- (optional) all documents with Metaname metadata
    29 #                      will be included in list. if not included all documents
    30 #                      will be included in list.
    31 # sort=Meta         -- (optional) sort documents in list alphabetically by
    32 #                      Meta. by default it will sort by Metaname, if neither
    33 #                      are set documents will be in build (random) order.
    34 #                      Meta may be Filename to sort by original filename or
    35 #                      nosort to force not to sort
    36 # buttonname=Title  -- (optional) the title field for this classification.
    37 #                      if not included title field will be Metaname.
    38 #                      if metadata is also not included title will be 'List'
    39 
    40 # 12/05/02 Added usage datastructure - John Thompson
     26package Collage;
    4127
    4228use BasClas;
    43 package Collage;
    44 
    4529use sorttools;
    4630
     
    5135my $arguments =
    5236    [ { 'name' => "buttonname",
    53     'desc' => "{Collage.buttonname}",
     37    'desc' => "{BasClas.buttonname}",
    5438    'type' => "string",
    55     'deft' => "Metadata element specified with -metadata",
     39    'deft' => "Collage",
    5640    'reqd' => "no" }];
    5741
     
    6145        'args'     => $arguments };
    6246
    63 #  sub print_usage {
    64 #      print STDERR "
    65 #    usage: classify List [options]
    66 #    options:
    67 
    68 #     -buttonname X  (optional) Title field for this classification.
    69 #                    if not included title field will be Metaname.
    70 #  ";
    71 #  }
    7247
    7348sub new {
     
    7550    my $self = new BasClas($class, @_);
    7651
    77     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    7852    my $option_list = $self->{'option_list'};
    7953    push( @{$option_list}, $options );
     54
     55    if ($self->{'info_only'}) {
     56    # created from classinfo.pl - don't need to parse the arguments
     57    return bless $self, $class;
     58    }   
    8059
    8160    my ($title, $list);
  • trunk/gsdl/perllib/classify/DateList.pm

    r6635 r6968  
    8686    my $option_list = $self->{'option_list'};
    8787    push( @{$option_list}, $options );
     88
     89    if ($self->{'info_only'}) {
     90    # created from classinfo.pl - don't need to parse the arguments
     91    return bless $self, $class;
     92    }
    8893
    8994    $self->{'list'} = {};
  • trunk/gsdl/perllib/classify/HTML.pm

    r6408 r6968  
    2626# html classifier plugin - creates an empty classification
    2727# that's simply a link to a web page
    28 # options are:
    29 # buttonname=Title  -- (optional) the title field for this classification.
    30 #                      if not included title field 'Browse'
    31 # url=url           -- the url of the web page to link to
    32 
    33 # 12/05/02 Added usage datastructure - John Thompson
    3428
    3529package HTML;
     
    4741    'reqd' => "yes" } ,
    4842      { 'name' => "buttonname",
    49     'desc' => "{HTML.buttonname}",
     43    'desc' => "{BasClas.buttonname}",
    5044    'type' => "string",
    5145    'deft' => "Browse",
     
    5852        'args'     => $arguments };
    5953
    60 #  sub print_usage {
    61 #      print STDERR "
    62 #    usage: classify AZList [options]
    63 #    options:
    64 #     -url X         The url of the web page to link to.
    65 #     -buttonname X  (optional) the title field for this classification.
    66 #                    The default is 'Browse'
    67 
    68 #  HTML classifier plugin - creates classifier that is a link to a web page
    69 
    70 #  ";
    71 #  }
    7254
    7355sub new {
  • trunk/gsdl/perllib/classify/Hierarchy.pm

    r6761 r6968  
    2525
    2626# classifier plugin for generating hierarchical classifications
    27 
    28 # options for this classifier are:
    29 # -hfile file.txt    - classification file
    30 # -metadata Metaname - metadata field to test against file.txt
    31 # -sort Meta         - this option is optional (genious;-). by default this
    32 #                     classifier will sort documents within each section
    33 #                     alphabetically by Title. sort=nosort prevents sorting
    34 #                     (i.e. documents will end up in build order), sort=Meta
    35 #                     will sort each field alphabetically by Meta (Meta may
    36 #                     also be 'Filename' to sort by the original filename).
    37 # -buttonname Title  - another optional field. this is what will end up in the
    38 #                     Title field for this classification. if not present it
    39 #                     defaults to Metaname
    40 # -hlist_at_top      - use a horizontal list for the top level (i.e. display it
    41 #                     like an AZList classification)
    4227
    4328# 12/05/02 Added usage datastructure - John Thompson
     
    6651    'reqd' => "yes" },
    6752      { 'name' => "buttonname",
    68     'desc' => "{Hierarchy.buttonname}",
     53    'desc' => "{BasClas.buttonname}",
    6954    'type' => "string",
    7055    'deft' => "{BasClas.metadata.deft}",
     
    8772    'args'     => $arguments };
    8873
    89 #  sub print_usage {
    90 #      print STDERR "
    91 #    usage: classify Hierarchy [options]
    92 #    options:
    93 
    94 #     -buttonname X  Title field for this classification.
    95 #                    Defaults to metadata name.
    96 
    97 #     -metadata X    Metadata field used for classification,
    98 #                    list will be sorted by this element,
    99 #                    unless -sort is used.
    100 
    101 #     -hfile X       The classification structure file
    102 
    103 #     -sort X        Metadata field to sort by (defaults to -metadata)
    104 #                    use '-sort nosort' for no sorting.
    105 
    106 #     -hlist_at_top  Display the first level of the classification
    107 #                    horizontally.
    108 #  ";
    109 #  }
    110 
    11174
    11275sub new {
     
    11477    my $self = new BasClas($class, @_);
    11578 
    116     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    11779    my $option_list = $self->{'option_list'};
    11880    push( @{$option_list}, $options );
    119    
     81 
     82    if ($self->{'info_only'}) {
     83    # created from classinfo.pl - don't need to parse the arguments
     84    return bless $self, $class;
     85    }
     86 
    12087    my ($hfile, $metadata, $sortname, $title, $hlist_at_top);
    12188   
  • trunk/gsdl/perllib/classify/List.pm

    r6957 r6968  
    4242    'reqd' => "no" },
    4343      { 'name' => "buttonname",
    44     'desc' => "{List.buttonname}",
     44    'desc' => "{BasClas.buttonname}",
    4545    'type' => "string",
    4646    'deft' => "{BasClas.metadata.deft}",
     
    6666    my $option_list = $self->{'option_list'};
    6767    push( @{$option_list}, $options );
     68
     69    if ($self->{'info_only'}) {
     70    # created from classinfo.pl - don't need to parse the arguments
     71    return bless $self, $class;
     72    }
    6873
    6974    my ($metadata, $title, $sortname, $list);
  • trunk/gsdl/perllib/classify/Phind.pm

    r6408 r6968  
    9494    'deft' => "Title",
    9595    'reqd' => "no" },
    96       { 'name' => "button",
    97     'desc' => "{Phind.button}",
     96      { 'name' => "buttonname",
     97    'desc' => "{BasClas.buttonname}",
    9898    'type' => "string",
    9999    'deft' => "Phrase",
     
    134134        'args'     => $arguments };
    135135
    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 #  "; }
    175136
    176137# Phrase delimiter symbols - these should be abstracted out someplace
     
    193154    push( @{$option_list}, $options );
    194155
     156    if ($self->{'info_only'}) {
     157    # created from classinfo.pl - don't need to parse the arguments
     158    return bless $self, $class;
     159    }
     160
    195161    my $out = $self->{'outhandle'};
    196162
     
    210176             q^text/.*/section:Title,section:text^, \$self->{'indexes'},
    211177             q^title/.*/Title^, \$self->{'titlefield'},
    212              q^button/.*/Phrase^, \$self->{'buttonname'},
     178             q^buttonname/.*/Phrase^, \$self->{'buttonname'},
    213179             q^language/.*/en^, \$language,
    214180             q^builddir/.*/^, \$builddir,
Note: See TracChangeset for help on using the changeset viewer.