public class DateTimeVerifier extends EntityExtractor implements EntityVerifier
Constructor and Description |
---|
DateTimeVerifier()
Create a new DateTimeVerifier, with the normalized form specified by the
W3C.
|
DateTimeVerifier(java.lang.String normalizedForm)
Create a new DateTimeVerifier using the specified format as the
normalized form for date-time objects
|
Modifier and Type | Method and Description |
---|---|
EntityType |
determineType(java.lang.String term)
Determine the entity type for a particular term.
|
protected void |
extractEntities(java.lang.String text,
java.util.Map<java.lang.String,EntityTag> tokenMap)
Extract date-time entities.
|
java.util.Map<java.lang.String,java.lang.String> |
extractEntityRawTypes(java.lang.String text)
Retrieve the entities and the raw types for this entity extractor.
|
java.lang.String |
getModel()
Return the model for this verifier.
|
java.util.Set<EntityType> |
getSupportedTypes()
Get the supported types for this verifier.
|
java.lang.String |
normalize(java.lang.String term,
EntityType type)
Convert this term to a normalized date form.
|
java.util.Date |
normalizeDate(java.lang.String term)
Convert this term to a normalized date object.
|
void |
setModel(java.lang.String model)
Sets the model for this Verifier.
|
void |
setNormalizedForm(java.lang.String pattern)
Set the normalized form to write date-time entities.
|
void |
setRelativeReference(java.util.Date referenceDate,
RelativeDateFormat.RelativeType type)
Set relative reference information for inexact parsing
|
void |
setUseRelative(boolean flag)
Set the flag indicating whether this verifier will allow relative dates.
|
boolean |
verifyType(java.lang.String term,
EntityType type)
Verify if the term matches the entity type.
|
addTagFieldMapping, addTextField, augmentRecord, extract, extract, extract, extract, getDefaultTagField, isDebug, setDebug, setDefaultTagField
public DateTimeVerifier()
public DateTimeVerifier(java.lang.String normalizedForm)
normalizedForm
- the format that date-time objects are normalized
intopublic EntityType determineType(java.lang.String term)
determineType
in interface EntityVerifier
term
- the term to check. This is the extracted entityprotected void extractEntities(java.lang.String text, java.util.Map<java.lang.String,EntityTag> tokenMap)
extractEntities
in class EntityExtractor
text
- the text to extracttokenMap
- the map to contain the tokens in.public java.util.Map<java.lang.String,java.lang.String> extractEntityRawTypes(java.lang.String text)
extractEntityRawTypes
in class EntityExtractor
text
- the text to parse for entitiespublic java.lang.String getModel()
getModel
in interface EntityVerifier
getModel
in class EntityExtractor
public java.util.Set<EntityType> getSupportedTypes()
getSupportedTypes
in interface EntityVerifier
public java.lang.String normalize(java.lang.String term, EntityType type)
normalize
in interface EntityVerifier
term
- The term to normalizetype
- the entity type, which should be EntityType.DATE_TIMEpublic java.util.Date normalizeDate(java.lang.String term)
term
- The term to normalizepublic void setModel(java.lang.String model)
setModel
in interface EntityVerifier
setModel
in class EntityExtractor
model
- the new modelpublic void setNormalizedForm(java.lang.String pattern)
pattern
- the pattern for the date-time. This should conform to the
SimpleDateFormat patternpublic void setRelativeReference(java.util.Date referenceDate, RelativeDateFormat.RelativeType type)
referenceDate
- the reference date to use when parsing inexact
termstype
- the default relation typepublic void setUseRelative(boolean flag)
flag
- whether to allow relative dates or not.public boolean verifyType(java.lang.String term, EntityType type)
verifyType
in interface EntityVerifier
term
- the term to checktype
- the entity type