How to use the asreview.ASReviewData.from_file function in asreview

To help you get started, we’ve selected a few asreview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github msdslab / automated-systematic-review / tests / test_data.py View on Github external
def test_fuzzy_finder(keywords, paper_id):
    fp = Path("tests", "demo_data", "embase.csv")
    as_data = ASReviewData.from_file(fp)

    assert as_data.fuzzy_find(keywords)[0] == paper_id
github msdslab / automated-systematic-review / tests / test_readers.py View on Github external
def test_reader(test_file, n_lines, labels, ignore_col):
    fp = Path("test", "demo_data", test_file)
    as_data = ASReviewData.from_file(fp)
    assert len(as_data) == n_lines

    cols = ['title', 'abstract', 'authors', 'keywords']
    cols = [col for col in cols if col not in ignore_col]
    if labels is not None:
        cols.append('final_included')
        assert np.array_equal(as_data.labels, labels)

    for col in cols:
        values = as_data.get(col)
        assert len(values) == n_lines
github msdslab / automated-systematic-review / tests / test_feature.py View on Github external
def test_features(feature_extraction, split_ta):
    embedding_fp = os.path.join("test", "demo_data", "generic.vec")
    data_fp = os.path.join("test", "demo_data", "generic.csv")

    as_data = ASReviewData.from_file(data_fp)
    texts = as_data.texts
    if feature_extraction.startswith("embedding-"):
        model = get_feature_model(feature_extraction, split_ta=split_ta,
                                  embedding_fp=embedding_fp)
    else:
        model = get_feature_model(feature_extraction, split_ta=split_ta)
    X = model.fit_transform(texts, titles=as_data.title,
                            abstracts=as_data.abstract)

    assert X.shape[0] == len(as_data.title)
    assert X.shape[1] > 0
    assert isinstance(model.param, dict)
    assert model.name == feature_extraction
github msdslab / automated-systematic-review / tests / test_readers.py View on Github external
def test_csv_write_data():
    fp_in = Path("test", "demo_data", "generic_labels.csv")
    fp_out = Path("test", "out_data", "generic_out.csv")
    asr_data = ASReviewData.from_file(fp_in)
    asr_data.to_csv(fp_out, labels=[0, 1, 0, 1, 0, 1])