JSONSaver#

class JSONSaver(config)#

Bases: Saver

Saves all Document to a specified output_file in JSON format

Parameters
  • type (str) – json

  • output_file (str) – path to output json file (relative to ml workflow path)

  • tracking_facet_name (str, 'ml_workflow') – facet used to track whether an item has been processed

  • tracking_facet_value (str, None) – Facet value to apply to tracking facet

Example

{
    "step": "saver",
    "type": "json",
    "fields": [ "text", "prediction" ],
    "output_file": "data.json"
}

Methods Summary

process_batch(batch)

Process a batch of documents.

Methods Documentation

process_batch(batch)#

Process a batch of documents. If not defined will default to using self.process_doc for each document in the batch.

Parameters

batch (list(Document)) – List of documents

Returns

List of processed documents

Return type

list(Document)