SquirroItemSaver

class squirro.lib.nlp.steps.savers.SquirroItemSaver(config)

Bases: squirro.lib.nlp.steps.savers.Saver

Converts libNLP Document to Squirro items and saves them to a Squirrinstance

Note - The fields client_id, client_secret, cluster, token and project_id do not need to be set if it is used inside the Squirro machinelearning service

Parameters
  • type (str) – squirro_item

  • client_id (str, None) – Squirro client id

  • client_secret (str, None) – Squirro client secret

  • cluster (str) – Squirro cluster URL

  • token (str) – Squirro token

  • project_id (str) – id of Squirro project

  • create_facets (bool, True) – whether or not to create new facets of detected type

  • tracking_facet_name (str, 'ml_workflow') – Facet used to track whether or not an item has been seen

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

Example

{
    "step": "saver",
    "type": "squirro_item",
    "cluster": "CLUSTER",
    "token": "TOKEN",
    "project_id": "PROJECT_ID",
    "fields":["keywords.prediction"]
}

Methods Summary

process_batch(docs)

Process a batch of documents.

Methods Documentation

process_batch(docs)

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)