public final class IntegerParser extends Object implements SlotParser
Only positive values are recognized.
A "range" property is expected in the slot's metadata; this property
represents a half-open interval of (start, end] for the range of values the
parser should accept. Regardless of the end of the interval, the maximum
value that will be parsed is Java's Integer.MAX_VALUE
; values greater
than this will result in an exception.
Constructor and Description |
---|
IntegerParser()
Create a new integer parser.
|
Modifier and Type | Method and Description |
---|---|
Object |
parse(Map<String,Object> metadata,
String rawValue)
Parse a raw string value from an utterance into a typed value for a
concrete slot.
|
public Object parse(Map<String,Object> metadata, String rawValue)
SlotParser
Implementers should throw an exception if the parsed value is invalid according to the supplied metadata.
parse
in interface SlotParser
metadata
- A map representing metadata for the particular slot being
parsed.rawValue
- The string from a user utterance that represents a slot
value.value
.Copyright © 2020. All rights reserved.