compass.plugin.ordinance.BaseParser#

class BaseParser[source]#

Bases: ABC

Extract succinct extraction text from input

Methods

parse(text, jurisdiction)

Parse text and extract structured data

Attributes

IN_LABEL

Identifier for text ingested by this class

OUT_LABEL

Identifier for final structured data output

TASK_ID

ID to use for this extraction for linking with LLM configs

TASK_ID = 'data_extraction'#

ID to use for this extraction for linking with LLM configs

abstract property IN_LABEL#

Identifier for text ingested by this class

Type:

str

abstract property OUT_LABEL#

Identifier for final structured data output

Type:

str

abstractmethod async parse(text, jurisdiction)[source]#

Parse text and extract structured data

Parameters:
  • text (str) – Text which may or may not contain information relevant to the current extraction.

  • jurisdiction (Jurisdiction) – Jurisdiction object corresponding to the document being parsed. This is passed in case the system prompt needs any information about the jurisdiction to successfully extract values from the text.

Returns:

pandas.DataFrame or None – DataFrame containing structured extracted data. Can also be None if no relevant values can be parsed from the text.