JSONLoader

class squirro.lib.nlp.steps.loaders.JSONLoader(config)

Bases: squirro.lib.nlp.steps.loaders.Loader

The JSON Loader loads JSON files and transforms the data into Document items.

Parameters
  • type (str) – json

  • per_line (bool, False) – indicates if each line represents a different item document

Example

{
    "step": "loader",
    "type": "json",
    "fields": [ "text", "label" ]
}

Methods Summary

process(directory)

Process a directory of json files and yield documents.

Methods Documentation

process(directory)

Process a directory of json files and yield documents.

Parameters

directory (str) – path to directory with *.json files

Returns

Generator of Documents read from JSON files

Return type

generator(Document)