Skip to content

collections.collection

Collection

Bases: SlottedDict[Volume]

A collection of volumes and events, corresponding to an XML file in the data/xml/ directory of the Anthology repo.

Provides dictionary-like functionality mapping volume IDs to Volume objects in the collection.

Required Attributes:

Name Type Description
id str

The ID of this collection (e.g. "L06" or "2022.emnlp").

parent CollectionIndex

The parent CollectionIndex instance to which this collection belongs.

path Path

The path of the XML file representing this collection.

Non-Init Attributes:

Name Type Description
event Optional[Event]

An event represented by this collection.

is_data_loaded bool

A flag indicating whether the XML file has already been loaded.

root property

root

The Anthology instance to which this object belongs.

get_event

get_event()

An Event explicitly defined in this collection, if any.

load

load()

Loads the XML file belonging to this collection.

papers

papers()

An iterator over all Paper objects in all volumes in this collection.

save

save(path=None)

Saves this collection as an XML file.

Parameters:

Name Type Description Default
path Optional[PathLike[str]]

The filename to save to. If None, defaults to self.path.

None

validate_schema

validate_schema()

Validates the XML file belonging to this collection against the RelaxNG schema.

Raises:

Type Description
DocumentInvalid

If the XML file does not validate against the schema.

volumes

volumes()

An iterator over all Volume objects in this collection.