Skip to content

collections.bibkeys

BIBKEY_MAX_NAMES module-attribute

BIBKEY_MAX_NAMES = 2

The maximum number of names to consider when generating bibkeys.

BibkeyIndex

Bases: SlottedDict[Paper]

Index object which collects citation keys for all papers.

Provides dictionary-like functionality mapping bibkeys to Paper objects in the Anthology.

Attributes:

Name Type Description
parent CollectionIndex

The parent CollectionIndex instance to which this index belongs.

is_data_loaded bool

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

build

build(show_progress=False)

Load the entire Anthology data and build an index of bibkeys.

Raises:

Type Description
AnthologyDuplicateIDError

If a non-unique bibkey is encountered. In case of multiple errors, only one exception is raised at the end, and all errors are sent to the logger.

generate_bibkey

generate_bibkey(paper)

Generate a unique bibkey for the given paper.

Parameters:

Name Type Description Default
paper Paper

The paper for which a bibkey should be generated.

required

Returns:

Type Description
str

The generated bibkey.

Important

Calling this function will not change the paper's bibkey nor add the bibkey to the index. Use Paper.refresh_bibkey() to automatically generate and set a bibkey for a paper.

load

load()

Load an index of bibkeys.

reset

reset()

Reset the index.