pixano.features.schemas.annotations.info_extraction
Relation(created_at=None, updated_at=None, **data)
Bases: Annotation
Observation of a relation between two annotations, for instance between text-spans in a text.
Attributes:
Name | Type | Description |
---|---|---|
predicate |
str
|
type of relation, as in semantic-web (OWL, RDF, etc) |
subject_ref |
AnnotationRef
|
annotation_ref to the subject Annotation (eg TextSpan) |
object_ref |
AnnotationRef
|
annotation_ref to the object Annotation (eg TextSpan) |
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
TextSpan(created_at=None, updated_at=None, **data)
Bases: Annotation
Designation of a Text-Span in a text, especially in the use-case of Named-Entity Recognition on a textual annotation having a str 'content' attribute .
Attributes:
Name | Type | Description |
---|---|---|
mention |
str
|
text-span assembled 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. |
annotation_ref |
AnnotationRef
|
Annotation reference toward an textual Annotation having a str 'content' attribute |
Source code in pixano/features/schemas/base_schema.py
spans
property
Get the list of zipped spans offsets (starts and ends).
spans_length
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" TextSpan. |
Source code in pixano/features/schemas/annotations/info_extraction.py
create_relation(predicate, subject_ref=AnnotationRef.none(), object_ref=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
|
str
|
type of relation |
required |
subject_ref
|
AnnotationRef
|
annotation_ref to the subject TextSpan |
none()
|
object_ref
|
AnnotationRef
|
annotation_ref to the object TextSpan |
none()
|
id
|
str
|
Relation ID. |
''
|
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
create_text_span(mention, spans_start, spans_end, id='', item_ref=ItemRef.none(), view_ref=ViewRef.none(), entity_ref=EntityRef.none(), source_ref=SourceRef.none(), annotation_ref=AnnotationRef.none())
Create a TextSpan instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mention
|
str
|
text-span 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
|
TextSpan ID. |
''
|
item_ref
|
ItemRef
|
Item reference. |
none()
|
view_ref
|
ViewRef
|
View reference. |
none()
|
entity_ref
|
EntityRef
|
Entity reference. |
none()
|
source_ref
|
SourceRef
|
Source reference. |
none()
|
annotation_ref
|
AnnotationRef
|
Annotation reference toward an textual Annotation having a str 'content' attribute |
none()
|
Returns:
Type | Description |
---|---|
TextSpan
|
The created |
Source code in pixano/features/schemas/annotations/info_extraction.py
is_relation(cls, strict=False)
Check if a class is a Relation
or subclass of Relation
.
is_text_span(cls, strict=False)
Check if a class is a TextSpan or subclass of TextSpan.