Record Class DocumentCategorizerConfig
java.lang.Object
java.lang.Record
opennlp.dl.doccat.DocumentCategorizerConfig
- Record Components:
id2label- The labels by output index.
The part of a model configuration that a
DocumentCategorizerDL uses: the
id2label map of output index to label.-
Constructor Summary
ConstructorsConstructorDescriptionDocumentCategorizerConfig(Map<String, String> id2label) Creates an instance of aDocumentCategorizerConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static DocumentCategorizerConfigReads the top-levelid2labelmember of a model configuration, the object that maps each output index to its label in theconfig.jsonfiles that accompany classification models.final inthashCode()Returns a hash code value for this object.id2label()Returns the value of theid2labelrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
DocumentCategorizerConfig
-
-
Method Details
-
id2label
-
fromJson
Reads the top-levelid2labelmember of a model configuration, the object that maps each output index to its label in theconfig.jsonfiles that accompany classification models. Keys and labels are decoded from their escapes, and a later entry for the same key overwrites an earlier one. Anid2labelmember nested in another member is not the configuration's map.- Parameters:
json- The JSON text of the configuration. Blank text, with or without a leading byte order mark, is a configuration without labels. Must not benull.- Returns:
- The configuration, with an empty map if the configuration has no top-level
id2labelmember. - Throws:
IllegalArgumentException- Thrown ifjsonisnull, if the text is neither blank nor a single well-formed JSON object, ifid2labelis not an object, or if a label is not a string. The message names the offset or the key.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).
-