NCEntity
An entity is a collection if one or more tokens. An entity typically has a consistent semantic meaning and usually denotes a real-world object, such as persons, locations, number, date and time, organizations, products, etc. - where such objects can be abstract or have a physical existence. Entities are produced by NCEntityParser. See NCPipeline for documentation on the entities in the overall processing pipeline.
Note that both NCToken and NCEntity interfaces extend NCPropertyMap trait that allows them to store custom metadata properties. Parser, enrichers and validators for tokens and entities use this capability to store and check their properties in tokens and entities.
- See also:
- Source:
- NCEntity.scala
Value members
Abstract methods
Gets ID of the request this entity is part of.
Gets ID of the request this entity is part of.
- Returns:
ID of the request this entity is part of.
- Source:
- NCEntity.scala
Gets the list of tokens this entity is comprised of. Returned list is never empty or null
.
Gets the list of tokens this entity is comprised of. Returned list is never empty or null
.
- Returns:
List of tokens that are part of this entity.
- Source:
- NCEntity.scala
Concrete methods
Gets optional set of groups this entity belongs to. Groups can be used in NLPCraft IDL. They are designed for convenient search any entity which belongs to the same group.
Gets optional set of groups this entity belongs to. Groups can be used in NLPCraft IDL. They are designed for convenient search any entity which belongs to the same group.
- Returns:
Optional set of groups this entity belongs to. Returned set can be empty but never
null
. By default the entity belongs to a group of its own type.- Source:
- NCEntity.scala
Joins all tokens' text with trimming using space as a delimiter. This function does not cache the result and performs text construction on each call. Make sure to cache the result to avoid unnecessary parasitic workload if and when method getTokens does not change.
Joins all tokens' text with trimming using space as a delimiter. This function does not cache the result and performs text construction on each call. Make sure to cache the result to avoid unnecessary parasitic workload if and when method getTokens does not change.
- Returns:
Constructed text value representation of this entity. Note that returned value is not cached and created anew every time this method is called.
- Source:
- NCEntity.scala
Inherited methods
Returns the value to which the specified key is mapped, or null
if this map contains no mapping for the key.
Returns the value to which the specified key is mapped, or null
if this map contains no mapping for the key.
- Value parameters:
- key
The key whose associated value is to be returned.
- Returns:
The value to which the specified key is mapped, or
null
if this map contains no mapping for the key.- Inherited from:
- NCPropertyMap
- Source:
- NCPropertyMap.scala
Removes all of the mappings from this map. The map will be empty after this call returns.
Removes all of the mappings from this map. The map will be empty after this call returns.
- Inherited from:
- NCPropertyMap
- Source:
- NCPropertyMap.scala
Returns true
if this map contains a mapping for the specified key.
Returns true
if this map contains a mapping for the specified key.
- Returns:
true
if this map contains a mapping for the specified key.- Inherited from:
- NCPropertyMap
- Source:
- NCPropertyMap.scala
Returns the value to which the specified key is mapped.
Returns the value to which the specified key is mapped.
- Value parameters:
- key
The key whose associated value is to be returned.
- Returns:
The value to which the specified key is mapped as an optional.
- Inherited from:
- NCPropertyMap
- Source:
- NCPropertyMap.scala
Returns a set view of the keys contained in this map.
Returns a set view of the keys contained in this map.
- Returns:
A set view of the keys contained in this map.
- Inherited from:
- NCPropertyMap
- Source:
- NCPropertyMap.scala
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced by the specified value.
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced by the specified value.
- Value parameters:
- key
Key with which the specified value is to be associated.
- obj
Value to be associated with the specified key.
- Returns:
The previous value associated with key, or
null
if there was no mapping for key.- Inherited from:
- NCPropertyMap
- Source:
- NCPropertyMap.scala
If the specified key is not already associated with a value (or is mapped to null
) associates it with
the given value and returns null
, else returns the current value.
If the specified key is not already associated with a value (or is mapped to null
) associates it with
the given value and returns null
, else returns the current value.
- Value parameters:
- key
Key with which the specified value is to be associate
- obj
Value to be associated with the specified key
- Returns:
The previous value associated with the specified key, or
null
if there was no mapping for the key.- Inherited from:
- NCPropertyMap
- Source:
- NCPropertyMap.scala
Removes the entry for the specified key only if it is currently mapped to the specified value.
Removes the entry for the specified key only if it is currently mapped to the specified value.
- Value parameters:
- key
Key with which the specified value is associated value.
- obj
Value expected to be associated with the specified key.
- Returns:
true
if the value was removed.- Inherited from:
- NCPropertyMap
- Source:
- NCPropertyMap.scala
Removes the mapping for a key from this map if it is present.
Removes the mapping for a key from this map if it is present.
- Value parameters:
- key
Key whose mapping is to be removed from the map.
- Returns:
The previous value associated with key, or
null
if there was no mapping for key.- Inherited from:
- NCPropertyMap
- Source:
- NCPropertyMap.scala