Skip to content

collections.index

CollectionIndex

Bases: SlottedDict[Collection]

Index object through which all collections can be accessed.

Provides dictionary-like functionality mapping collection IDs to Collection objects in the Anthology.

Attributes:

Name Type Description
parent Anthology

The parent Anthology instance to which this index belongs.

bibkeys BibkeyIndex

A [BibkeyIndex](acl_anthology.collections.bibkeys.BibkeyIndex] instance.

is_data_loaded bool

A flag indicating whether the XML directory has already been indexed.

create

create(id)

Create a new Collection object.

Parameters:

Name Type Description Default
id str

The ID of the new collection.

required

Returns:

Type Description
Collection

The created Collection object.

Raises:

Type Description
AnthologyDuplicateIDError

If a collection with the given ID already exists.

AnthologyInvalidIDError

If the given ID is not well-formed.

load

load()

Find all XML data files and index them by their collection ID.

Note

Currently assumes that XML files are always named according to the collection ID they contain; i.e., a file named "L16.xml" must contain the collection with ID "L16".