1

我一直在使用 Python 中的 Sickle 库,以便从开放存取期刊目录中访问 OAI-PMH 记录。我注意到,以下代码会在每次运行前 4000 篇文章中产生相似但略有不同的英文文章结果(尽管每次运行时,它会产生大约 2500-2600 篇)。在我之前为检索和下载全文文本而运行的另一段代码中,我注意到文章每次都在更改。这似乎 Sickle 不是每次都以相同的顺序抓取 OAI 记录,这让我想知道它们是否是按随机(ish)顺序抓取的?我是 OAI 格式的新手,所以我不确定这种(看似)随机排序是否是 OAI 记录通常如何存储的属性,

from sickle import Sickle
import time
from langdetect import detect

def get_time_estimate():
    sickle = Sickle('https://doaj.org/oai.article')
    records = sickle.ListRecords(metadataPrefix='oai_doaj')
    tot = 0
    num_eng = 0
    start_time = time.time()
    for rec in records:
        tot += 1
        metadata = rec.metadata
        if 'abstract' not in metadata:
            continue
        if 'fullTextUrl' not in metadata:
            continue
        abs = metadata['abstract'][0]
        full = metadata['fullTextUrl'][0]
        language = detect(abs)
        if language == 'en':
            num_eng += 1
        if tot == 4000:
            break
    print("Completed in %.2f seconds" % (time.time() - start_time))
    print("Number of English records: %s" % num_eng)
4

1 回答 1

1

我是 OAI 格式的新手,所以我不确定这种(看似)随机排序是否是 OAI 记录通常如何存储的属性,

是的,引用 OAI-PMH 规范:

该协议没有定义不完整性的语义。因此,收割者不应假定不完整列表中的成员符合某些选择标准(例如,日期排序)。

http://www.openarchives.org/OAI/openarchivesprotocol.html#FlowControl

您可以通过日期戳或集合使用选择性收获: http ://www.openarchives.org/OAI/openarchivesprotocol.html#SelectiveHarvesting

于 2020-04-13T17:45:18.590 回答