jina.executors.crafters

class jina.executors.crafters.BaseCrafter(*args, **kwargs)[source]

Bases: jina.executors.BaseExecutor

A BaseCrafter transforms the content of Document. It can be used for preprocessing, segmenting etc. It is an interface for Crafters which is a family of executors intended to apply transformations to single documents. The apply function is craft(), where the name of the arguments will be used as keys of the content.

Parameters
  • args – Additional positional arguments which are just used for the parent initialization

  • kwargs – Additional keyword arguments which are just used for the parent initialization

craft(*args, **kwargs)[source]

Apply function of this executor. The name of the arguments are used as keys, which are then used to tell Driver what information to extract from the protobuf request accordingly. The name of the arguments should be always valid keys defined in the protobuf.

Parameters
  • args – Extra variable length arguments

  • kwargs – Extra variable keyword arguments

Return type

Union[List[Dict], Dict]