pixano.features.schemas.annotations.info_extraction
NamedEntity(created_at=None, updated_at=None, **data)
Bases: Annotation
Observation of a named-entity in a text.
Attributes:
Name | Type | Description |
---|---|---|
concept_id |
str
|
Id of the named-entity type. |
mention |
str
|
Named-entity observed mention. |
spans_start |
list[int]
|
List of start offsets of the spans in the text. |
spans_end |
list[int]
|
List of end offsets of the spans in the text. |
Raises ValidationError
if the input data cannot be
validated to form a valid model.
self
is explicitly positional-only to allow self
as a field name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
created_at
|
datetime | None
|
The creation date of the object. |
None
|
updated_at
|
datetime | None
|
The last modification date of the object. |
None
|
data
|
Any
|
The data of the object validated by Pydantic. |
{}
|
Source code in pixano/features/schemas/base_schema.py
spans: list[tuple[int, int]]
property
Get the list of zipped spans offsets (starts and ends).
spans_length: list[int]
property
Get the computed list of spans lengths.
none()
classmethod
Utility function to get a None
equivalent.
Should be removed as soon as Lance manages None
value.
Returns:
Type | Description |
---|---|
Self
|
"None" NamedEntity. |
Source code in pixano/features/schemas/annotations/info_extraction.py
Relation(created_at=None, updated_at=None, **data)
Bases: Annotation
Observation of a relation between two named entity in a text.
Attributes:
Name | Type | Description |
---|---|---|
predicate_id |
str
|
id of relation type. |
subject_id |
AnnotationRef
|
annotation_id of the subject named-entity |
object_id |
AnnotationRef
|
annotation_id of the object named-entity |
Raises ValidationError
if the input data cannot be
validated to form a valid model.
self
is explicitly positional-only to allow self
as a field name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
created_at
|
datetime | None
|
The creation date of the object. |
None
|
updated_at
|
datetime | None
|
The last modification date of the object. |
None
|
data
|
Any
|
The data of the object validated by Pydantic. |
{}
|
Source code in pixano/features/schemas/base_schema.py
none()
classmethod
Utility function to get a None
equivalent.
Should be removed as soon as Lance manages None
value.
Returns:
Type | Description |
---|---|
Self
|
"None" Relation. |
Source code in pixano/features/schemas/annotations/info_extraction.py
create_named_entity(concept_id, mention, spans_start, spans_end, id='', item_ref=ItemRef.none(), view_ref=ViewRef.none(), entity_ref=EntityRef.none(), source_ref=SourceRef.none())
Create a NamedEntity
instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
concept_id
|
str
|
Id of named-entity type. |
required |
mention
|
str
|
Named-entity observed mention. |
required |
spans_start
|
list[int]
|
List of start offsets of the spans in the text. |
required |
spans_end
|
list[int]
|
List of end offsets of the spans in the text. |
required |
id
|
str
|
|
''
|
item_ref
|
ItemRef
|
Item reference. |
none()
|
view_ref
|
ViewRef
|
View reference. |
none()
|
entity_ref
|
EntityRef
|
Entity reference. |
none()
|
source_ref
|
SourceRef
|
Source reference. |
none()
|
Returns:
Type | Description |
---|---|
NamedEntity
|
The created |
Source code in pixano/features/schemas/annotations/info_extraction.py
create_relation(predicate_id, subject_id=AnnotationRef.none(), object_id=AnnotationRef.none(), id='', item_ref=ItemRef.none(), view_ref=ViewRef.none(), entity_ref=EntityRef.none(), source_ref=SourceRef.none())
Create a Relation
instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
predicate_id
|
str
|
Id of relation type. |
required |
subject_id
|
AnnotationRef
|
Annotation_id of the subject named-entity |
none()
|
object_id
|
AnnotationRef
|
Annotation_id of the object named-entity |
none()
|
id
|
str
|
|
''
|
item_ref
|
ItemRef
|
Item reference. |
none()
|
view_ref
|
ViewRef
|
View reference. |
none()
|
entity_ref
|
EntityRef
|
Entity reference. |
none()
|
source_ref
|
SourceRef
|
Source reference. |
none()
|
Returns:
Type | Description |
---|---|
Relation
|
The created |
Source code in pixano/features/schemas/annotations/info_extraction.py
is_named_entity(cls, strict=False)
Check if a class is a NamedEntity
or subclass of NamedEntity
.
is_relation(cls, strict=False)
Check if a class is a Relation
or subclass of Relation
.