Class DetokenizationOperationTypeExtensions

Namespace
NOpenNLP.Tools.Tokenize
Assembly
NOpenNLP.Tools.dll

Extension methods for DetokenizationOperationType.

public static class DetokenizationOperationTypeExtensions
Inheritance
DetokenizationOperationTypeExtensions
Inherited Members

Remarks

NOpenNLP: upstream puts parse on the nested enum itself and relies on the Java enum's toString for the serialized form. C# enums cannot declare members, and the C#-cased names would not round-trip through the dictionary XML, so both directions are implemented here against the upstream Java constant names, which are the persisted format.

Methods

Parse(string?)

Parses the serialized form of an operation, as written in a detokenization dictionary.

public static DetokenizationOperationType? Parse(string? operation)

Parameters

operation string

the serialized operation name, or null

Returns

DetokenizationOperationType?

the parsed operation, or null if the name is not recognized.

ToOperationString(DetokenizationOperationType)

Retrieves the serialized form of an operation, as written in a detokenization dictionary. This is the upstream Java constant name, which is the persisted format, rather than the C# member name.

public static string ToOperationString(this DetokenizationOperationType operation)

Parameters

operation DetokenizationOperationType

the operation

Returns

string

the serialized operation name

Exceptions

ArgumentOutOfRangeException

The operation is not a defined DetokenizationOperationType.