Пример #1
0
def create_as_data(dataset,
                   included_dataset=[],
                   excluded_dataset=[],
                   prior_dataset=[],
                   new=False):
    """Create ASReviewData object from multiple datasets."""
    if isinstance(dataset, (str, PurePath)):
        dataset = [dataset]

    if isinstance(included_dataset, (str, PurePath)):
        included_dataset = [included_dataset]

    if isinstance(excluded_dataset, (str, PurePath)):
        excluded_dataset = [excluded_dataset]

    if isinstance(prior_dataset, (str, PurePath)):
        prior_dataset = [prior_dataset]

    as_data = ASReviewData()
    # Find the URL of the datasets if the dataset is an example dataset.
    for data in dataset:
        as_data.append(ASReviewData.from_file(find_data(data)))

    if new:
        as_data.labels = np.full((len(as_data), ), LABEL_NA, dtype=int)
    for data in included_dataset:
        as_data.append(
            ASReviewData.from_file(find_data(data), data_type="included"))
    for data in excluded_dataset:
        as_data.append(
            ASReviewData.from_file(find_data(data), data_type="excluded"))
    for data in prior_dataset:
        as_data.append(
            ASReviewData.from_file(find_data(data), data_type="prior"))
    return as_data
Пример #2
0
def test_find_datasets(data_name):
    data = find_data(data_name)

    assert _dataset_url_exists(data)