NlpServiceQuestionAnswering#

class squirro.lib.nlp.steps.external.NlpServiceQuestionAnswering(config)#

Bases: squirro.lib.nlp.steps.batched_step.BatchedStep

Step that uses an external API endpoint.

It sends a batch of Document in the shape of {“docs”:LIST_OF_DOCS, “fields”:LIST_OF_FIELDS} to spaCy and returns the annotated batch of Document

Parameters
  • type (str, "external") – remote_spacy

  • step (str, "nlp_service_qa") – remote_spacy

  • input_field__question (str, "qa_question") – input field containing the question

  • input_field__context (str, "qa_context") – input field containing the context

  • output_field__answer (str, "qa_answer") – output field

  • endpoint (str, None) – Custom NLP Service endpoint to be invoked. If not defined the default endpoint loaded from the ini file is used.

  • max_concurrent (int, 10) – maximum concurrent requests

  • language_processor_mapping (dict,{}) – Define what QA model should be used for the detected language (fields.language). Note: This option bypasses pipeline__field setting.

  • arg_field__config (str, None) – Programmatic selection of model configuration (read model config from given field). Uses default__model_config if empty.

  • default__config (str, None) – default model, if no arg_field__model_config specified or value is null

Example

{
    "name": "nlp_service_qa",
    "step": "nlp_service_qa",
    "type": "nlp_service_qa",
    language_processor_mapping": {
        "en": "en:accurate"
    },
    "default__config": "en:accurate"
}

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)