Explode#

class sycamore.transforms.explode.Explode(child: Node, **resource_args)[source]#

Bases: SingleThreadUser, NonGPUUser, Transform

The Explode transform converts the elements of each document into top-level documents. For example, if you explode a DocSet with a single document containing two elements, the resulting DocSet will have three documents – the original plus a new Document for each of the elements.

Parameters:
  • child – The source node or component that provides the hierarchical documents to be exploded.

  • resource_args – Additional resource-related arguments that can be passed to the explosion operation.

Example

source_node = ...  # Define a source node or component that provides hierarchical documents.
explode_transform = Explode(child=source_node)
exploded_dataset = explode_transform.execute()