Class FormatParameter<T>

Namespace
NOpenNLP.Tools.Formats
Assembly
NOpenNLP.Tools.dll

A command line parameter of a corpus format.

public sealed class FormatParameter<T> : IFormatParameter

Type Parameters

T

the value type; one of string, int, bool, FileInfo or Encoding, matching the types upstream's ArgumentParser accepts.

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

name string

the option including its leading dash, i.e. -data

valueName string

the value placeholder shown in help

description string

the 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

object

Description

The help text for this parameter, or an empty string when upstream gives none.

public string Description { get; }

Property Value

string

IsOptional

Whether the user may omit this parameter.

public bool IsOptional { get; }

Property Value

bool

Name

The option as the user types it, including the leading dash, i.e. -data.

public string Name { get; }

Property Value

string

ValueName

The placeholder shown for the value in help, i.e. sampleData.

public string ValueName { get; }

Property Value

string

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

Type

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

name string
valueName string
description string
defaultValue T

Returns

FormatParameter<T>

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.