medkit.text.ner.date_attribute
medkit.text.ner.date_attribute#
Classes:
|
Attribute representing an absolute date or time associated to a segment or entity. |
|
Attribute representing a time quantity associated to a segment or entity. |
|
Attribute representing a relative date or time associated to a segment or entity, ie a date/time offset from an (unknown) reference date/time, with a direction. |
|
Direction of a |
- class DateAttribute(label, year=None, month=None, day=None, hour=None, minute=None, second=None, metadata=None, uid=None)[source]#
Attribute representing an absolute date or time associated to a segment or entity.
The date or time can be incomplete: each date/time component is optional but at least one must be provided.
- Variables
uid (str) – Identifier of the attribute
label (str) – Label of the attribute
year (Optional[int]) – Year component of the date
month (Optional[int]) – Month component of the date
day (Optional[int]) – Day component of the date
hour (Optional[int]) – Hour component of the time
minute (Optional[int]) – Minute component of the time
second (Optional[int]) – Second component of the time
metadata (Dict[str, Any]) – Metadata of the attribute
Methods:
format()Return a string representation of the date with format YYYY-MM-DD for the date part and HH:MM:SS for the time part, if present.
- class DurationAttribute(label, years=0, months=0, weeks=0, days=0, hours=0, minutes=0, seconds=0, metadata=None, uid=None)[source]#
Attribute representing a time quantity associated to a segment or entity.
Each date/time component is optional but at least one must be provided.
- Variables
uid (str) – Identifier of the attribute
label (str) – Label of the attribute
direction – Direction the relative date. Ex: “2 years ago” correspond to the PAST direction and “in 2 weeks” to the FUTURE direction.
years (int) – Year component of the date quantity
months (int) – Month component of the date quantity
weeks (int) – Week component of the date quantity
days (int) – Day component of the date quantity
hours (int) – Hour component of the time quantity
minutes (int) – Minute component of the time quantity
seconds (int) – Second component of the time quantity
metadata (Dict[str, Any]) – Metadata of the attribute
Methods:
format()Return a string representation of the date/time offset.
- class RelativeDateAttribute(label, direction, years=0, months=0, weeks=0, days=0, hours=0, minutes=0, seconds=0, metadata=None, uid=None)[source]#
Attribute representing a relative date or time associated to a segment or entity, ie a date/time offset from an (unknown) reference date/time, with a direction.
At least one date/time component must be non-zero.
- Variables
uid (str) – Identifier of the attribute
label (str) – Label of the attribute
direction (medkit.text.ner.date_attribute.RelativeDateDirection) – Direction the relative date. Ex: “2 years ago” corresponds to the PAST direction and “in 2 weeks” to the FUTURE direction.
years (int) – Year component of the date offset
months (int) – Month component of the date offset
weeks (int) – Week component of the date offset
days (int) – Day component of the date offset
hours (int) – Hour component of the time offset
minutes (int) – Minute component of the time offset
seconds (int) – Second component of the time offset
metadata (Dict[str, Any]) – Metadata of the attribute
Methods:
format()Return a string representation of the date/time offset Ex: "+ 1 year 10 months 2 days"
- class RelativeDateDirection(value)[source]#
Direction of a
RelativeDateAttribute