canary.corpora package

Corpora Package

download_corpus(corpus_id: str, overwrite_existing: bool = False, save_location: Optional[str] = None, aifdb_corpus=False, request_timeout=60) dict[source]

Downloads a corpus to be used for argumentation mining.

Parameters
corpus_id: str

the absolute path to the directory where the corpus should be saved

overwrite_existing: bool, default=False

Should the corpus be overwritten if already present?

save_location: str, optional

Where the corpus should be downloaded to. Defaults to the canary corpora directory.

aifdb_corpus: bool, False

A boolean value indicating if the corpus should be fetched from aifdb.

request_timeout: int, 60

How long Canary wait when trying to download a corpus from a remote resource such as aifdb.

Returns
dict

The details of the corpus provided as a dictionary

Notes

If aifdb_corpus is set to true, the corpora will be downloaded directly from aifdb.org. These corpora are provided at the discretion of the site owners and can disappear / be altered at anytime.

load_araucaria_corpus() dict[source]

Loads the araucaria corpus from aifdb

Returns
dict:

The araucaria corpus

load_corpus(corpus_id: str, download_if_missing=False) Optional[list][source]

Loads a corpus that has previously been downloaded

Parameters
corpus_id: str

The id of the corpus to load.

download_if_missing: bool, False

If the corpus is not present on disk, should Canary attempt to download it?

Returns
Union[list, None]

if a corpus can be loaded, a list of relevant dataset files will be returned. Otherwise nothing will be returned.

Raises
UserWarning

A warning is raised if the requested corpus cannot be found.

load_essay_corpus(purpose=None, merge_claims=False, version=2) Union[tuple, list][source]

Load the essay corpus.

Parameters
purpose: str

The purpose for which the corpus is required. Allowed values = [

None, ‘argument_detection’, ‘component_prediction’, “link_prediction”, ‘relation_prediction’, ‘sequence_labelling’

]

merge_claims: bool

Whether to merge claims and major claims. Only applies if component_prediction = “component_prediction”

version: int

The version of the essay corpus to load

Returns
Union[list, tuple]

The dataset as either tuple containing the training labels data or just the parsed essays.