L2 Hub
Pontus
docs
Extract Docs

L2 Construct: extract_docs

docs extraction

Description

The document extraction L2 with query terms processes a collection of documents to identify and retrieve those containing specified search terms. It typically employs text indexing and retrieval algorithms to efficiently match query terms against document content. The l2 returns a list of relevant documents, often ranked by relevance, allowing users to quickly find information pertinent to their search criteria.

L2 Data

  1. Provider: pontus
  2. Module: docs
  3. Action: extract_docs

Example Step

{
  "name": "insert-your-step-name",
  "type": "l2",
  "l2_data": {
    "provider": "pontus",
    "module": "docs",
    "action": "extract_docs"
  }
}
 

Input

Example

{
  "doc": "The quick brown fox jumps over the lazy dog",
  "queries": [
    {
      "term_to_search": "color",
      "term_type": "string",
      "description": "The color of the object",
      "examples": ["red"],
      "similar_terms": ["hue"]
    }
  ]
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/docs/doc-extract-input",
  "$ref": "#/$defs/DocExtractInput",
  "$defs": {
    "DocExtractInput": {
      "properties": {
        "doc": {
          "type": "string"
        },
        "queries": {
          "items": {
            "$ref": "#/$defs/TermQuery"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["doc", "queries"]
    },
    "TermQuery": {
      "properties": {
        "term_to_search": {
          "type": "string"
        },
        "term_type": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "examples": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "similar_terms": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["term_to_search", "term_type", "description"]
    }
  }
}
 

Output

Example

{
  "terms": {
    "color": {
      "term": "brown",
      "term_type": "string",
      "found": true
    }
  }
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/docs/doc-extract-output",
  "$ref": "#/$defs/DocExtractOutput",
  "$defs": {
    "DocExtractOutput": {
      "properties": {
        "terms": {
          "$ref": "#/$defs/TermMap"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["terms"]
    },
    "TermMap": {
      "additionalProperties": {
        "$ref": "#/$defs/TermResult"
      },
      "type": "object"
    },
    "TermResult": {
      "properties": {
        "term": true,
        "term_type": {
          "type": "string"
        },
        "found": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["term", "term_type", "found"]
    }
  }
}