Class JsonScan
java.lang.Object
opennlp.dl.JsonScan
Reads the JSON files of the deep-learning components, vocabularies and model configurations.
Structure, whitespace, numbers, and string escapes follow
RFC 8259, with three additions:
- a byte order mark as the first character is skipped, as section 8.1 allows;
- the control characters
U+0000toU+001Fare accepted inside a string; - the values
NaN,Infinity, and-Infinityare accepted where a value is skipped, never where one is read.
IllegalArgumentException whose message names the
offset at which reading stopped.-
Method Summary
-
Method Details
-
stringObject
Reads a top-level member whose value is an object of strings, such as theid2labelmap of a model configuration. Keys and values are decoded from their escapes. A later entry for the same key replaces an earlier one, and a later member with the same name replaces an earlier one. A member with that name inside a nested value is not considered.- Parameters:
text- The JSON text: one object, or blank text (JSON whitespace only, after an optional byte order mark), which is read as an empty object. Must not benull.key- The unescaped name of the member. Must not benull.- Returns:
- The entries of that object, or an empty map if there is no such top-level member.
- Throws:
IllegalArgumentException- Thrown iftextorkeyisnull, iftextis neither blank nor a single well-formed JSON object, or if the member is not an object whose values are all strings. The message names the offset or the key.
-