index ( handle, index_fn=None )
index(handle[, index_fn]) -> list of (PMID, MedlineID, start, end)
Index a Medline XML file. Returns where the records are, as
offsets from the beginning of the handle. index_fn is a callback
function with parameters (PMID, MedlineID, start, end) and is
called as soon as each record is indexes.
|
index_many (
files_or_paths,
index_fn,
nprocs=1,
)
index_many(files_or_paths, index_fn[, nprocs])
Index multiple Medline XML files. files_or_paths can be a single
file, a path, a list of files, or a list of paths.
index_fn is a callback function that should take the following
parameters:
index_fn(file, event, data)
where file is the file being indexed, event is one of "START",
"RECORD", "END", and data is extra data dependent upon the event.
"START" and "END" events are passed to indicate when a file is
being indexed. "RECORD" is passed whenever a new record has been
indexed. When a "RECORD" event is passed, then data is set to a
tuple of (pmid, medline_id, start, end). Otherwise it is None.
start and end indicate the location of the record as offsets from
the beginning of the file.
|