Class FormatParameter<T>
A command line parameter of a corpus format.
public sealed class FormatParameter<T> : IFormatParameter
Type Parameters
Tthe value type; one of string, int, bool, FileInfo or Encoding, matching the types upstream's
ArgumentParseraccepts.
- Inheritance
-
FormatParameter<T>
- Implements
- Inherited Members
Remarks
Authored for NOpenNLP; not part of the Apache OpenNLP source. See IFormatParameter for why parameters are described as data here rather than by the annotated interfaces upstream reflects over.
Constructors
FormatParameter(string, string, string)
Declares a required parameter.
public FormatParameter(string name, string valueName, string description = "")
Parameters
namestringthe option including its leading dash, i.e.
-datavalueNamestringthe value placeholder shown in help
descriptionstringthe help text, or an empty string when upstream gives none
Properties
DefaultValue
The value used when an optional parameter is omitted, or null when
upstream declares no default.
public object? DefaultValue { get; }
Property Value
Description
The help text for this parameter, or an empty string when upstream gives none.
public string Description { get; }
Property Value
IsOptional
Whether the user may omit this parameter.
public bool IsOptional { get; }
Property Value
Name
The option as the user types it, including the leading dash, i.e. -data.
public string Name { get; }
Property Value
ValueName
The placeholder shown for the value in help, i.e. sampleData.
public string ValueName { get; }
Property Value
ValueType
The value type. One of string, int,
bool, FileInfo or
Encoding, matching the types upstream's
ArgumentParser accepts.
public Type ValueType { get; }
Property Value
Methods
Optional(string, string, string, T?)
Declares an optional parameter, with defaultValue used when the
user omits it. Pass default where upstream's @OptionalParameter
carries no defaultValue.
public static FormatParameter<T> Optional(string name, string valueName, string description = "", T? defaultValue = default)
Parameters
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.