ChunkResult#

class scikitplot.corpus.ChunkResult(chunks, metadata=<factory>)[source]#

Container returned by every ChunkerProtocol implementation.

Parameters:
chunkslist[Chunk]

Ordered list of chunks produced from a single document. May be empty if no content passes filtering.

metadataMetadataDict

Aggregate metadata for the entire chunking run (e.g. chunker, backend, total_chunks, doc_id).

Parameters:

Notes

chunks is a plain list stored by value. Because frozen=True prevents re-assignment of the chunks attribute, the list itself must not be mutated after construction.

chunks: list[Chunk][source]#
is_empty()[source]#

Return True if no chunks were produced.

Returns:
bool
Return type:

bool

iter_chunks()[source]#

Yield chunks one at a time.

Yields:
Chunk
Return type:

Iterator[Chunk]

metadata: dict[str, Any][source]#
texts()[source]#

Return the text of every chunk as a plain list.

Returns:
list[str]
Return type:

list[str]

total_chars()[source]#

Return the total character count across all chunks.

Returns:
int

Sum of len(c.text) for all chunks.

Return type:

int