lisc.io.io.load_object

lisc.io.io.load_object(file_name, directory=None, reload_results=False)[source]

Load a custom object, from a pickle file.

Parameters
file_namestr

File name of the object to be loaded.

directorystr or Path or SCDB, optional

Folder or database object specifying the location to load from.

reload_resultsbool, optional, default: False

Whether to reload individual results into the loaded object. Only applies if loading a Words object.

Returns
custom_object

Custom object loaded from pickle file.

Examples

Load a Counts object, using a temporary directory:

>>> from tempfile import TemporaryDirectory
>>> from lisc.objects import Counts
>>> with TemporaryDirectory() as dirpath:
...     save_object(Counts(), 'counts.p', directory=dirpath)
...     counts = load_object('counts.p', directory=dirpath)