Entity

  • Entity represents an extracted entity from a piece of text, such as an address, date, email, or flight number.

  • It provides methods to identify the entity's type (e.g., TYPE_EMAIL, TYPE_ADDRESS) and access its specific properties using convenience methods like asDateTimeEntity() or asFlightNumberEntity().

  • There are several known direct subclasses of Entity, including DateTimeEntity, FlightNumberEntity, IbanEntity, IsbnEntity, MoneyEntity, PaymentCardEntity, and TrackingNumberEntity, each representing a specific type of entity.

  • Each subclass offers specific methods for retrieving detailed information about the extracted entity, such as the date and time for DateTimeEntity or the currency and amount for MoneyEntity.

public class Entity extends Object
Known Direct Subclasses

An entity extracted from a piece of text.

Nested Class Summary

@interface Entity.Type The type of an extracted entity(e.g. 

Constant Summary

int TYPE_ADDRESS Identifies a physical address.
int TYPE_DATE_TIME Identifies a time reference that includes a specific time.
int TYPE_EMAIL Identifies an e-mail address.
int TYPE_FLIGHT_NUMBER Identifies a flight number in IATA format.
int TYPE_IBAN Identifies an International Bank Account Number (IBAN).
int TYPE_ISBN Identifies an International Standard Book Number (ISBN).
int TYPE_MONEY Identifies an amount of money.
int TYPE_PAYMENT_CARD Identifies a payment card.
int TYPE_PHONE Identifies a phone number.
int TYPE_TRACKING_NUMBER Identifies a shipment tracking number.
int TYPE_URL Identifies a URL.

Public Method Summary

DateTimeEntity
asDateTimeEntity()
Convenience method that returns the current entity cast to a DateTimeEntity.
FlightNumberEntity
asFlightNumberEntity()
Convenience method that returns the current entity cast to a FlightNumberEntity.
IbanEntity
asIbanEntity()
Convenience method that returns the current entity cast to a IbanEntity.
IsbnEntity
asIsbnEntity()
Convenience method that returns the current entity cast to a IsbnEntity.
MoneyEntity
asMoneyEntity()
Convenience method that returns the current entity cast to a MoneyEntity.
PaymentCardEntity
asPaymentCardEntity()
Convenience method that returns the current entity cast to a PaymentCardEntity.
TrackingNumberEntity
asTrackingNumberEntity()
Convenience method that returns the current entity cast to a TrackingNumberEntity.
int
getType()
Returns the type(e.g.
String

Inherited Method Summary

Constants

public static final int TYPE_ADDRESS

Identifies a physical address.

Constant Value: 1

public static final int TYPE_DATE_TIME

Identifies a time reference that includes a specific time. May be absolute such as "01/01/2000 5:30pm" or relative like "tomorrow".

Constant Value: 2

public static final int TYPE_EMAIL

Identifies an e-mail address.

Constant Value: 3

public static final int TYPE_FLIGHT_NUMBER

Identifies a flight number in IATA format.

Constant Value: 4

public static final int TYPE_IBAN

Identifies an International Bank Account Number (IBAN).

Constant Value: 5

public static final int TYPE_ISBN

Identifies an International Standard Book Number (ISBN).

Constant Value: 6

public static final int TYPE_MONEY

Identifies an amount of money.

Constant Value: 11

public static final int TYPE_PAYMENT_CARD

Identifies a payment card.

Constant Value: 7

public static final int TYPE_PHONE

Identifies a phone number.

Constant Value: 8

public static final int TYPE_TRACKING_NUMBER

Identifies a shipment tracking number.

Constant Value: 9

public static final int TYPE_URL

Identifies a URL.

Constant Value: 10

Public Methods

public DateTimeEntity asDateTimeEntity ()

Convenience method that returns the current entity cast to a DateTimeEntity. Returns null if the current entity is not of type DATE_TIME.

public FlightNumberEntity asFlightNumberEntity ()

Convenience method that returns the current entity cast to a FlightNumberEntity. Returns null if the current entity is not of type FLIGHT_NUMBER.

public IbanEntity asIbanEntity ()

Convenience method that returns the current entity cast to a IbanEntity. Returns null if the current entity is not of type IBAN.

public IsbnEntity asIsbnEntity ()

Convenience method that returns the current entity cast to a IsbnEntity. Returns null if the current entity is not of type ISBN.

public MoneyEntity asMoneyEntity ()

Convenience method that returns the current entity cast to a MoneyEntity. Returns null if the current entity is not of type MONEY.

public PaymentCardEntity asPaymentCardEntity ()

Convenience method that returns the current entity cast to a PaymentCardEntity. Returns null if the current entity is not of type PAYMENT_CARD.

public TrackingNumberEntity asTrackingNumberEntity ()

Convenience method that returns the current entity cast to a TrackingNumberEntity. Returns null if the current entity is not of type TRACKING_NUMBER.

public int getType ()

Returns the type(e.g. TYPE_EMAIL) of this entity.

public String toString ()