load_documents#
- scikitplot.corpus.load_documents(path, fmt=None, *, trusted=False)[source]#
Load
CorpusDocumentinstances from a previously exported file.Supported round-trip formats:
ExportFormat.PICKLE,ExportFormat.JOBLIB. For all other formats, returns an empty list with a warning (full deserialization from CSV/JSON/Parquet is handled separately by the pipeline).- Parameters:
- pathpathlib.Path
Path to the exported file.
- fmtExportFormat or None, optional
Format hint. When
None, the format is inferred from the file extension (.pkl→ PICKLE,.joblib→ JOBLIB).- trustedbool
Whether the user has explicitly opted in to unsafe loading.
- Returns:
- list of CorpusDocument
- Raises:
- ImportError
If
joblibis not installed and the file is a joblib dump.- OSError
If the file cannot be read.
- Parameters:
- Return type:
list[CorpusDocument]
Examples
>>> docs = load_documents(Path("corpus.pkl")) >>> len(docs) 312