ibm_watson.compare_comply_v1 module

IBM Watson™ Compare and Comply analyzes governing documents to provide details about critical aspects of the documents.

class CompareComplyV1(version, url='https://gateway.watsonplatform.net/compare-comply/api', iam_apikey=None, iam_access_token=None, iam_url=None)[source]

Bases: ibm_cloud_sdk_core.base_service.BaseService

The Compare Comply V1 service.

default_url = 'https://gateway.watsonplatform.net/compare-comply/api'
convert_to_html(file, filename=None, file_content_type=None, model=None, **kwargs)[source]

Convert document to HTML.

Converts a document to HTML.

Parameters
  • file (file) – The document to convert.

  • filename (str) – The filename for file.

  • file_content_type (str) – The content type of file.

  • model (str) – The analysis model to be used by the service. For the **Element

classification** and Compare two documents methods, the default is contracts. For the Extract tables method, the default is tables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests. :param dict headers: A dict containing the request headers :return: A DetailedResponse containing the result, headers and HTTP status code. :rtype: DetailedResponse

classify_elements(file, file_content_type=None, model=None, **kwargs)[source]

Classify the elements of a document.

Analyzes the structural and semantic elements of a document.

Parameters
  • file (file) – The document to classify.

  • file_content_type (str) – The content type of file.

  • model (str) – The analysis model to be used by the service. For the **Element

classification** and Compare two documents methods, the default is contracts. For the Extract tables method, the default is tables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests. :param dict headers: A dict containing the request headers :return: A DetailedResponse containing the result, headers and HTTP status code. :rtype: DetailedResponse

extract_tables(file, file_content_type=None, model=None, **kwargs)[source]

Extract a document’s tables.

Analyzes the tables in a document.

Parameters
  • file (file) – The document on which to run table extraction.

  • file_content_type (str) – The content type of file.

  • model (str) – The analysis model to be used by the service. For the **Element

classification** and Compare two documents methods, the default is contracts. For the Extract tables method, the default is tables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests. :param dict headers: A dict containing the request headers :return: A DetailedResponse containing the result, headers and HTTP status code. :rtype: DetailedResponse

compare_documents(file_1, file_2, file_1_content_type=None, file_2_content_type=None, file_1_label=None, file_2_label=None, model=None, **kwargs)[source]

Compare two documents.

Compares two input documents. Documents must be in the same format.

Parameters
  • file_1 (file) – The first document to compare.

  • file_2 (file) – The second document to compare.

  • file_1_content_type (str) – The content type of file_1.

  • file_2_content_type (str) – The content type of file_2.

  • file_1_label (str) – A text label for the first document.

  • file_2_label (str) – A text label for the second document.

  • model (str) – The analysis model to be used by the service. For the **Element

classification** and Compare two documents methods, the default is contracts. For the Extract tables method, the default is tables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests. :param dict headers: A dict containing the request headers :return: A DetailedResponse containing the result, headers and HTTP status code. :rtype: DetailedResponse

add_feedback(feedback_data, user_id=None, comment=None, **kwargs)[source]

Add feedback.

Adds feedback in the form of _labels_ from a subject-matter expert (SME) to a governing document. Important: Feedback is not immediately incorporated into the training model, nor is it guaranteed to be incorporated at a later date. Instead, submitted feedback is used to suggest future updates to the training model.

Parameters
  • feedback_data (FeedbackDataInput) – Feedback data for submission.

  • user_id (str) – An optional string identifying the user.

  • comment (str) – An optional comment on or description of the feedback.

  • headers (dict) – A dict containing the request headers

Returns

A DetailedResponse containing the result, headers and HTTP status code.

Return type

DetailedResponse

delete_feedback(feedback_id, model=None, **kwargs)[source]

Delete a specified feedback entry.

Deletes a feedback entry with a specified feedback_id.

Parameters

feedback_id (str) – A string that specifies the feedback entry to be deleted

from the document. :param str model: The analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is contracts. For the Extract tables method, the default is tables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests. :param dict headers: A dict containing the request headers :return: A DetailedResponse containing the result, headers and HTTP status code. :rtype: DetailedResponse

get_feedback(feedback_id, model=None, **kwargs)[source]

List a specified feedback entry.

Lists a feedback entry with a specified feedback_id.

Parameters

feedback_id (str) – A string that specifies the feedback entry to be included

in the output. :param str model: The analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is contracts. For the Extract tables method, the default is tables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests. :param dict headers: A dict containing the request headers :return: A DetailedResponse containing the result, headers and HTTP status code. :rtype: DetailedResponse

list_feedback(feedback_type=None, before=None, after=None, document_title=None, model_id=None, model_version=None, category_removed=None, category_added=None, category_not_changed=None, type_removed=None, type_added=None, type_not_changed=None, page_limit=None, cursor=None, sort=None, include_total=None, **kwargs)[source]

List the feedback in a document.

Lists the feedback in a document.

Parameters

feedback_type (str) – An optional string that filters the output to include

only feedback with the specified feedback type. The only permitted value is element_classification. :param date before: An optional string in the format YYYY-MM-DD that filters the output to include only feedback that was added before the specified date. :param date after: An optional string in the format YYYY-MM-DD that filters the output to include only feedback that was added after the specified date. :param str document_title: An optional string that filters the output to include only feedback from the document with the specified document_title. :param str model_id: An optional string that filters the output to include only feedback with the specified model_id. The only permitted value is contracts. :param str model_version: An optional string that filters the output to include only feedback with the specified model_version. :param str category_removed: An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list removed. :param str category_added: An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list added. :param str category_not_changed: An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list unchanged. :param str type_removed: An optional string of comma-separated nature:party pairs. If this is specified, the service filters the output to include only feedback that has at least one nature:party pair from the list removed. :param str type_added: An optional string of comma-separated nature:party pairs. If this is specified, the service filters the output to include only feedback that has at least one nature:party pair from the list removed. :param str type_not_changed: An optional string of comma-separated nature:party pairs. If this is specified, the service filters the output to include only feedback that has at least one nature:party pair from the list unchanged. :param int page_limit: An optional integer specifying the number of documents that you want the service to return. :param str cursor: An optional string that returns the set of documents after the previous set. Use this parameter with the page_limit parameter. :param str sort: An optional comma-separated list of fields in the document to sort on. You can optionally specify the sort direction by prefixing the value of the field with - for descending order or + for ascending order (the default). Currently permitted sorting fields are created, user_id, and document_title. :param bool include_total: An optional boolean value. If specified as true, the pagination object in the output includes a value called total that gives the total count of feedback created. :param dict headers: A dict containing the request headers :return: A DetailedResponse containing the result, headers and HTTP status code. :rtype: DetailedResponse

create_batch(function, input_credentials_file, input_bucket_location, input_bucket_name, output_credentials_file, output_bucket_location, output_bucket_name, model=None, **kwargs)[source]

Submit a batch-processing request.

Run Compare and Comply methods over a collection of input documents. Important: Batch processing requires the use of the [IBM Cloud Object Storage service](https://cloud.ibm.com/docs/services/cloud-object-storage/about-cos.html#about-ibm-cloud-object-storage). The use of IBM Cloud Object Storage with Compare and Comply is discussed at [Using batch processing](https://cloud.ibm.com/docs/services/compare-comply/batching.html#before-you-batch).

Parameters

function (str) – The Compare and Comply method to run across the submitted

input documents. :param file input_credentials_file: A JSON file containing the input Cloud Object Storage credentials. At a minimum, the credentials must enable READ permissions on the bucket defined by the input_bucket_name parameter. :param str input_bucket_location: The geographical location of the Cloud Object Storage input bucket as listed on the Endpoint tab of your Cloud Object Storage instance; for example, us-geo, eu-geo, or ap-geo. :param str input_bucket_name: The name of the Cloud Object Storage input bucket. :param file output_credentials_file: A JSON file that lists the Cloud Object Storage output credentials. At a minimum, the credentials must enable READ and WRITE permissions on the bucket defined by the output_bucket_name parameter. :param str output_bucket_location: The geographical location of the Cloud Object Storage output bucket as listed on the Endpoint tab of your Cloud Object Storage instance; for example, us-geo, eu-geo, or ap-geo. :param str output_bucket_name: The name of the Cloud Object Storage output bucket. :param str model: The analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is contracts. For the Extract tables method, the default is tables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests. :param dict headers: A dict containing the request headers :return: A DetailedResponse containing the result, headers and HTTP status code. :rtype: DetailedResponse

get_batch(batch_id, **kwargs)[source]

Get information about a specific batch-processing job.

Gets information about a batch-processing job with a specified ID.

Parameters

batch_id (str) – The ID of the batch-processing job whose information you want

to retrieve. :param dict headers: A dict containing the request headers :return: A DetailedResponse containing the result, headers and HTTP status code. :rtype: DetailedResponse

list_batches(**kwargs)[source]

List submitted batch-processing jobs.

Lists batch-processing jobs submitted by users.

Parameters

headers (dict) – A dict containing the request headers

Returns

A DetailedResponse containing the result, headers and HTTP status code.

Return type

DetailedResponse

update_batch(batch_id, action, model=None, **kwargs)[source]

Update a pending or active batch-processing job.

Updates a pending or active batch-processing job. You can rescan the input bucket to check for new documents or cancel a job.

Parameters
  • batch_id (str) – The ID of the batch-processing job you want to update.

  • action (str) – The action you want to perform on the specified

batch-processing job. :param str model: The analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is contracts. For the Extract tables method, the default is tables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests. :param dict headers: A dict containing the request headers :return: A DetailedResponse containing the result, headers and HTTP status code. :rtype: DetailedResponse

class Address(text=None, location=None)[source]

Bases: object

A party’s address.

Attr str text

(optional) A string listing the address.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end.

class AlignedElement(element_pair=None, identical_text=None, provenance_ids=None, significant_elements=None)[source]

Bases: object

AlignedElement.

Attr list[ElementPair] element_pair

(optional) Identifies two elements that

semantically align between the compared documents. :attr bool identical_text: (optional) Specifies whether the aligned element is identical. Elements are considered identical despite minor differences such as leading punctuation, end-of-sentence punctuation, whitespace, the presence or absence of definite or indefinite articles, and others. :attr list[str] provenance_ids: (optional) One or more hashed values that you can send to IBM to provide feedback or receive support. :attr bool significant_elements: (optional) Indicates that the elements aligned are contractual clauses of significance.

class Attribute(type=None, text=None, location=None)[source]

Bases: object

List of document attributes.

Attr str type

(optional) The type of attribute.

Attr str text

(optional) The text associated with the attribute.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end.

class BatchStatus(function=None, input_bucket_location=None, input_bucket_name=None, output_bucket_location=None, output_bucket_name=None, batch_id=None, document_counts=None, status=None, created=None, updated=None)[source]

Bases: object

The batch-request status.

Attr str function

(optional) The method to be run against the documents. Possible

values are html_conversion, element_classification, and tables. :attr str input_bucket_location: (optional) The geographical location of the Cloud Object Storage input bucket as listed on the Endpoint tab of your COS instance; for example, us-geo, eu-geo, or ap-geo. :attr str input_bucket_name: (optional) The name of the Cloud Object Storage input bucket. :attr str output_bucket_location: (optional) The geographical location of the Cloud Object Storage output bucket as listed on the Endpoint tab of your COS instance; for example, us-geo, eu-geo, or ap-geo. :attr str output_bucket_name: (optional) The name of the Cloud Object Storage output bucket. :attr str batch_id: (optional) The unique identifier for the batch request. :attr DocCounts document_counts: (optional) Document counts. :attr str status: (optional) The status of the batch request. :attr datetime created: (optional) The creation time of the batch request. :attr datetime updated: (optional) The time of the most recent update to the batch request.

class Batches(batches=None)[source]

Bases: object

The results of a successful GET /v1/batches request.

Attr list[BatchStatus] batches

(optional) A list of the status of all batch

requests.

class BodyCells(cell_id=None, location=None, text=None, row_index_begin=None, row_index_end=None, column_index_begin=None, column_index_end=None, row_header_ids=None, row_header_texts=None, row_header_texts_normalized=None, column_header_ids=None, column_header_texts=None, column_header_texts_normalized=None, attributes=None)[source]

Bases: object

Cells that are not table header, column header, or row header cells.

Attr str cell_id

(optional) The unique ID of the cell in the current table.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end. :attr str text: (optional) The textual contents of this cell from the input document without associated markup content. :attr int row_index_begin: (optional) The begin index of this cell’s row location in the current table. :attr int row_index_end: (optional) The end index of this cell’s row location in the current table. :attr int column_index_begin: (optional) The begin index of this cell’s column location in the current table. :attr int column_index_end: (optional) The end index of this cell’s column location in the current table. :attr list[RowHeaderIds] row_header_ids: (optional) :attr list[RowHeaderTexts] row_header_texts: (optional) :attr list[RowHeaderTextsNormalized] row_header_texts_normalized: (optional) :attr list[ColumnHeaderIds] column_header_ids: (optional) :attr list[ColumnHeaderTexts] column_header_texts: (optional) :attr list[ColumnHeaderTextsNormalized] column_header_texts_normalized: (optional) :attr list[Attribute] attributes: (optional)

class Category(label=None, provenance_ids=None)[source]

Bases: object

Information defining an element’s subject matter.

Attr str label

(optional) The category of the associated element.

Attr list[str] provenance_ids

(optional) One or more hashed values that you can send

to IBM to provide feedback or receive support.

class CategoryComparison(label=None)[source]

Bases: object

Information defining an element’s subject matter.

Attr str label

(optional) The category of the associated element.

class ClassifyReturn(document=None, model_id=None, model_version=None, elements=None, tables=None, document_structure=None, parties=None, effective_dates=None, contract_amounts=None, termination_dates=None, contract_type=None)[source]

Bases: object

The analysis of objects returned by the Element classification method.

Attr Document document

(optional) Basic information about the input document.

Attr str model_id

(optional) The analysis model used to classify the input document.

For the Element classification method, the only valid value is contracts. :attr str model_version: (optional) The version of the analysis model identified by the value of the model_id key. :attr list[Element] elements: (optional) Document elements identified by the service. :attr list[Tables] tables: (optional) Definition of tables identified in the input document. :attr DocStructure document_structure: (optional) The structure of the input document. :attr list[Parties] parties: (optional) Definitions of the parties identified in the input document. :attr list[EffectiveDates] effective_dates: (optional) The date or dates on which the document becomes effective. :attr list[ContractAmts] contract_amounts: (optional) The monetary amounts that identify the total amount of the contract that needs to be paid from one party to another. :attr list[TerminationDates] termination_dates: (optional) The date or dates on which the document is to be terminated. :attr list[ContractType] contract_type: (optional) The document’s contract type or types as declared in the document.

class ColumnHeaderIds(id=None)[source]

Bases: object

An array of values, each being the id value of a column header that is applicable to the current cell.

Attr str id

(optional) The id value of a column header.

class ColumnHeaderTexts(text=None)[source]

Bases: object

An array of values, each being the text value of a column header that is applicable to the current cell.

Attr str text

(optional) The text value of a column header.

class ColumnHeaderTextsNormalized(text_normalized=None)[source]

Bases: object

If you provide customization input, the normalized version of the column header texts according to the customization; otherwise, the same value as column_header_texts.

Attr str text_normalized

(optional) The normalized version of a column header text.

class ColumnHeaders(cell_id=None, location=None, text=None, text_normalized=None, row_index_begin=None, row_index_end=None, column_index_begin=None, column_index_end=None)[source]

Bases: object

Column-level cells, each applicable as a header to other cells in the same column as itself, of the current table.

Attr str cell_id

(optional) The unique ID of the cell in the current table.

Attr object location

(optional) The location of the column header cell in the

current table as defined by its begin and end offsets, respectfully, in the input document. :attr str text: (optional) The textual contents of this cell from the input document without associated markup content. :attr str text_normalized: (optional) If you provide customization input, the normalized version of the cell text according to the customization; otherwise, the same value as text. :attr int row_index_begin: (optional) The begin index of this cell’s row location in the current table. :attr int row_index_end: (optional) The end index of this cell’s row location in the current table. :attr int column_index_begin: (optional) The begin index of this cell’s column location in the current table. :attr int column_index_end: (optional) The end index of this cell’s column location in the current table.

class CompareReturn(model_id=None, model_version=None, documents=None, aligned_elements=None, unaligned_elements=None)[source]

Bases: object

The comparison of the two submitted documents.

Attr str model_id

(optional) The analysis model used to compare the input documents.

For the Compare two documents method, the only valid value is contracts. :attr str model_version: (optional) The version of the analysis model identified by the value of the model_id key. :attr list[Document] documents: (optional) Information about the documents being compared. :attr list[AlignedElement] aligned_elements: (optional) A list of pairs of elements that semantically align between the compared documents. :attr list[UnalignedElement] unaligned_elements: (optional) A list of elements that do not semantically align between the compared documents.

class Contact(name=None, role=None)[source]

Bases: object

A contact.

Attr str name

(optional) A string listing the name of the contact.

Attr str role

(optional) A string listing the role of the contact.

class ContractAmts(text=None, confidence_level=None, location=None)[source]

Bases: object

A monetary amount identified in the input document.

Attr str text

(optional) The monetary amount.

Attr str confidence_level

(optional) The confidence level in the identification of

the contract amount. :attr Location location: (optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.

class ContractType(text=None, confidence_level=None, location=None)[source]

Bases: object

The contract type identified in the input document.

Attr str text

(optional) The contract type.

Attr str confidence_level

(optional) The confidence level in the identification of

the termination date. :attr Location location: (optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.

class DocCounts(total=None, pending=None, successful=None, failed=None)[source]

Bases: object

Document counts.

Attr int total

(optional) Total number of documents.

Attr int pending

(optional) Number of pending documents.

Attr int successful

(optional) Number of documents successfully processed.

Attr int failed

(optional) Number of documents not successfully processed.

class DocInfo(html=None, title=None, hash=None)[source]

Bases: object

Information about the parsed input document.

Attr str html

(optional) The full text of the parsed document in HTML format.

Attr str title

(optional) The title of the parsed document. If the service did not

detect a title, the value of this element is null. :attr str hash: (optional) The MD5 hash of the input document.

class DocStructure(section_titles=None, leading_sentences=None)[source]

Bases: object

The structure of the input document.

Attr list[SectionTitles] section_titles

(optional) An array containing one object

per section or subsection identified in the input document. :attr list[LeadingSentence] leading_sentences: (optional) An array containing one object per section or subsection, in parallel with the section_titles array, that details the leading sentences in the corresponding section or subsection.

class Document(title=None, html=None, hash=None, label=None)[source]

Bases: object

Basic information about the input document.

Attr str title

(optional) Document title, if detected.

Attr str html

(optional) The input document converted into HTML format.

Attr str hash

(optional) The MD5 hash value of the input document.

Attr str label

(optional) The label applied to the input document with the calling

method’s file_1_label or file_2_label value. This field is specified only in the output of the Comparing two documents method.

class EffectiveDates(text=None, confidence_level=None, location=None)[source]

Bases: object

An effective date.

Attr str text

(optional) The effective date, listed as a string.

Attr str confidence_level

(optional) The confidence level in the identification of

the effective date. :attr Location location: (optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.

class Element(location=None, text=None, types=None, categories=None, attributes=None)[source]

Bases: object

A component part of the document.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end. :attr str text: (optional) The text of the element. :attr list[TypeLabel] types: (optional) Description of the action specified by the element and whom it affects. :attr list[Category] categories: (optional) List of functional categories into which the element falls; in other words, the subject matter of the element. :attr list[Attribute] attributes: (optional) List of document attributes.

class ElementLocations(begin=None, end=None)[source]

Bases: object

A list of begin and end indexes that indicate the locations of the elements in the input document.

Attr int begin

(optional) An integer that indicates the starting position of the

element in the input document. :attr int end: (optional) An integer that indicates the ending position of the element in the input document.

class ElementPair(document_label=None, text=None, location=None, types=None, categories=None, attributes=None)[source]

Bases: object

Details of semantically aligned elements.

Attr str document_label

(optional) The label of the document (that is, the value of

either the file_1_label or file_2_label parameters) in which the element occurs. :attr str text: (optional) The contents of the element. :attr Location location: (optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end. :attr list[TypeLabelComparison] types: (optional) Description of the action specified by the element and whom it affects. :attr list[CategoryComparison] categories: (optional) List of functional categories into which the element falls; in other words, the subject matter of the element. :attr list[Attribute] attributes: (optional) List of document attributes.

class FeedbackDataInput(feedback_type, location, text, original_labels, updated_labels, document=None, model_id=None, model_version=None)[source]

Bases: object

Feedback data for submission.

Attr str feedback_type

The type of feedback. The only permitted value is

element_classification. :attr ShortDoc document: (optional) Brief information about the input document. :attr str model_id: (optional) An optional string identifying the model ID. The only permitted value is contracts. :attr str model_version: (optional) An optional string identifying the version of the model used. :attr Location location: The numeric location of the identified element in the document, represented with two integers labeled begin and end. :attr str text: The text on which to submit feedback. :attr OriginalLabelsIn original_labels: The original labeling from the input document, without the submitted feedback. :attr UpdatedLabelsIn updated_labels: The updated labeling from the input document, accounting for the submitted feedback.

class FeedbackDataOutput(feedback_type=None, document=None, model_id=None, model_version=None, location=None, text=None, original_labels=None, updated_labels=None, pagination=None)[source]

Bases: object

Information returned from the POST /v1/feedback method.

Attr str feedback_type

(optional) A string identifying the user adding the feedback.

The only permitted value is element_classification. :attr ShortDoc document: (optional) Brief information about the input document. :attr str model_id: (optional) An optional string identifying the model ID. The only permitted value is contracts. :attr str model_version: (optional) An optional string identifying the version of the model used. :attr Location location: (optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end. :attr str text: (optional) The text to which the feedback applies. :attr OriginalLabelsOut original_labels: (optional) The original labeling from the input document, without the submitted feedback. :attr UpdatedLabelsOut updated_labels: (optional) The updated labeling from the input document, accounting for the submitted feedback. :attr Pagination pagination: (optional) Pagination details, if required by the length of the output.

class FeedbackDeleted(status=None, message=None)[source]

Bases: object

The status and message of the deletion request.

Attr int status

(optional) HTTP return code.

Attr str message

(optional) Status message returned from the service.

class FeedbackList(feedback=None)[source]

Bases: object

The results of a successful GET /v1/feedback request.

Attr list[GetFeedback] feedback

(optional) A list of all feedback for the document.

class FeedbackReturn(feedback_id=None, user_id=None, comment=None, created=None, feedback_data=None)[source]

Bases: object

Information about the document and the submitted feedback.

Attr str feedback_id

(optional) The unique ID of the feedback object.

Attr str user_id

(optional) An optional string identifying the person submitting

feedback. :attr str comment: (optional) An optional comment from the person submitting the feedback. :attr datetime created: (optional) Timestamp listing the creation time of the feedback submission. :attr FeedbackDataOutput feedback_data: (optional) Information returned from the POST /v1/feedback method.

class GetFeedback(feedback_id=None, created=None, comment=None, feedback_data=None)[source]

Bases: object

The results of a single feedback query.

Attr str feedback_id

(optional) A string uniquely identifying the feedback entry.

Attr datetime created

(optional) A timestamp identifying the creation time of the

feedback entry. :attr str comment: (optional) A string containing the user’s comment about the feedback entry. :attr FeedbackDataOutput feedback_data: (optional) Information returned from the POST /v1/feedback method.

class HTMLReturn(num_pages=None, author=None, publication_date=None, title=None, html=None)[source]

Bases: object

The HTML converted from an input document.

Attr str num_pages

(optional) The number of pages in the input document.

Attr str author

(optional) The author of the input document, if identified.

Attr str publication_date

(optional) The publication date of the input document, if

identified. :attr str title: (optional) The title of the input document, if identified. :attr str html: (optional) The HTML version of the input document.

class Key(cell_id=None, location=None, text=None)[source]

Bases: object

A key in a key-value pair.

Attr str cell_id

(optional) The unique ID of the key in the table.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end. :attr str text: (optional) The text content of the table cell without HTML markup.

class KeyValuePair(key=None, value=None)[source]

Bases: object

Key-value pairs detected across cell boundaries.

Attr Key key

(optional) A key in a key-value pair.

Attr Value value

(optional) A value in a key-value pair.

class Label(nature, party)[source]

Bases: object

A pair of nature and party objects. The nature object identifies the effect of the element on the identified party, and the party object identifies the affected party.

Attr str nature

The identified nature of the element.

Attr str party

The identified party of the element.

class LeadingSentence(text=None, location=None, element_locations=None)[source]

Bases: object

The leading sentences in a section or subsection of the input document.

Attr str text

(optional) The text of the leading sentence.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end. :attr list[ElementLocations] element_locations: (optional) An array of location objects that lists the locations of detected leading sentences.

class Location(begin, end)[source]

Bases: object

The numeric location of the identified element in the document, represented with two integers labeled begin and end.

Attr int begin

The element’s begin index.

Attr int end

The element’s end index.

class OriginalLabelsIn(types, categories)[source]

Bases: object

The original labeling from the input document, without the submitted feedback.

Attr list[TypeLabel] types

Description of the action specified by the element and

whom it affects. :attr list[Category] categories: List of functional categories into which the element falls; in other words, the subject matter of the element.

class OriginalLabelsOut(types=None, categories=None, modification=None)[source]

Bases: object

The original labeling from the input document, without the submitted feedback.

Attr list[TypeLabel] types

(optional) Description of the action specified by the

element and whom it affects. :attr list[Category] categories: (optional) List of functional categories into which the element falls; in other words, the subject matter of the element. :attr str modification: (optional) A string identifying the type of modification the feedback entry in the updated_labels array. Possible values are added, not_changed, and removed.

class Pagination(refresh_cursor=None, next_cursor=None, refresh_url=None, next_url=None, total=None)[source]

Bases: object

Pagination details, if required by the length of the output.

Attr str refresh_cursor

(optional) A token identifying the current page of results.

Attr str next_cursor

(optional) A token identifying the next page of results.

Attr str refresh_url

(optional) The URL that returns the current page of results.

Attr str next_url

(optional) The URL that returns the next page of results.

Attr int total

(optional) Reserved for future use.

class Parties(party=None, importance=None, role=None, addresses=None, contacts=None)[source]

Bases: object

A party and its corresponding role, including address and contact information if identified.

Attr str party

(optional) A string identifying the party.

Attr str importance

(optional) A string that identifies the importance of the party.

Attr str role

(optional) A string identifying the party’s role.

Attr list[Address] addresses

(optional) List of the party’s address or addresses.

Attr list[Contact] contacts

(optional) List of the names and roles of contacts

identified in the input document.

class RowHeaderIds(id=None)[source]

Bases: object

An array of values, each being the id value of a row header that is applicable to this body cell.

Attr str id

(optional) The id values of a row header.

class RowHeaderTexts(text=None)[source]

Bases: object

An array of values, each being the text value of a row header that is applicable to this body cell.

Attr str text

(optional) The text value of a row header.

class RowHeaderTextsNormalized(text_normalized=None)[source]

Bases: object

If you provide customization input, the normalized version of the row header texts according to the customization; otherwise, the same value as row_header_texts.

Attr str text_normalized

(optional) The normalized version of a row header text.

class RowHeaders(cell_id=None, location=None, text=None, text_normalized=None, row_index_begin=None, row_index_end=None, column_index_begin=None, column_index_end=None)[source]

Bases: object

Row-level cells, each applicable as a header to other cells in the same row as itself, of the current table.

Attr str cell_id

(optional) The unique ID of the cell in the current table.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end. :attr str text: (optional) The textual contents of this cell from the input document without associated markup content. :attr str text_normalized: (optional) If you provide customization input, the normalized version of the cell text according to the customization; otherwise, the same value as text. :attr int row_index_begin: (optional) The begin index of this cell’s row location in the current table. :attr int row_index_end: (optional) The end index of this cell’s row location in the current table. :attr int column_index_begin: (optional) The begin index of this cell’s column location in the current table. :attr int column_index_end: (optional) The end index of this cell’s column location in the current table.

class SectionTitle(text=None, location=None)[source]

Bases: object

The table’s section title, if identified.

Attr str text

(optional) The text of the section title, if identified.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end.

class SectionTitles(text=None, location=None, level=None, element_locations=None)[source]

Bases: object

An array containing one object per section or subsection detected in the input document. Sections and subsections are not nested; instead, they are flattened out and can be placed back in order by using the begin and end values of the element and the level value of the section.

Attr str text

(optional) The text of the section title, if identified.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end. :attr int level: (optional) An integer indicating the level at which the section is located in the input document. For example, 1 represents a top-level section, 2 represents a subsection within the level 1 section, and so forth. :attr list[ElementLocations] element_locations: (optional) An array of location objects that lists the locations of detected section titles.

class ShortDoc(title=None, hash=None)[source]

Bases: object

Brief information about the input document.

Attr str title

(optional) The title of the input document, if identified.

Attr str hash

(optional) The MD5 hash of the input document.

class TableHeaders(cell_id=None, location=None, text=None, row_index_begin=None, row_index_end=None, column_index_begin=None, column_index_end=None)[source]

Bases: object

The contents of the current table’s header.

Attr str cell_id

(optional) The unique ID of the cell in the current table.

Attr object location

(optional) The location of the table header cell in the current

table as defined by its begin and end offsets, respectfully, in the input document. :attr str text: (optional) The textual contents of the cell from the input document without associated markup content. :attr int row_index_begin: (optional) The begin index of this cell’s row location in the current table. :attr int row_index_end: (optional) The end index of this cell’s row location in the current table. :attr int column_index_begin: (optional) The begin index of this cell’s column location in the current table. :attr int column_index_end: (optional) The end index of this cell’s column location in the current table.

class TableReturn(document=None, model_id=None, model_version=None, tables=None)[source]

Bases: object

The analysis of the document’s tables.

Attr DocInfo document

(optional) Information about the parsed input document.

Attr str model_id

(optional) The ID of the model used to extract the table contents.

The value for table extraction is tables. :attr str model_version: (optional) The version of the tables model ID. :attr list[Tables] tables: (optional) Definitions of the tables identified in the input document.

class Tables(location=None, text=None, section_title=None, table_headers=None, row_headers=None, column_headers=None, key_value_pairs=None, body_cells=None)[source]

Bases: object

The contents of the tables extracted from a document.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end. :attr str text: (optional) The textual contents of the current table from the input document without associated markup content. :attr SectionTitle section_title: (optional) The table’s section title, if identified. :attr list[TableHeaders] table_headers: (optional) An array of table-level cells that apply as headers to all the other cells in the current table. :attr list[RowHeaders] row_headers: (optional) An array of row-level cells, each applicable as a header to other cells in the same row as itself, of the current table. :attr list[ColumnHeaders] column_headers: (optional) An array of column-level cells, each applicable as a header to other cells in the same column as itself, of the current table. :attr list[KeyValuePair] key_value_pairs: (optional) An array of key-value pairs identified in the current table. :attr list[BodyCells] body_cells: (optional) An array of cells that are neither table header nor column header nor row header cells, of the current table with corresponding row and column header associations.

class TerminationDates(text=None, confidence_level=None, location=None)[source]

Bases: object

Termination dates identified in the input document.

Attr str text

(optional) The termination date.

Attr str confidence_level

(optional) The confidence level in the identification of

the termination date. :attr Location location: (optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end.

class TypeLabel(label=None, provenance_ids=None)[source]

Bases: object

Identification of a specific type.

Attr Label label

(optional) A pair of nature and party objects. The nature

object identifies the effect of the element on the identified party, and the party object identifies the affected party. :attr list[str] provenance_ids: (optional) One or more hash values that you can send to IBM to provide feedback or receive support.

class TypeLabelComparison(label=None)[source]

Bases: object

Identification of a specific type.

Attr Label label

(optional) A pair of nature and party objects. The nature

object identifies the effect of the element on the identified party, and the party object identifies the affected party.

class UnalignedElement(document_label=None, location=None, text=None, types=None, categories=None, attributes=None)[source]

Bases: object

Element that does not align semantically between two compared documents.

Attr str document_label

(optional) The label assigned to the document by the value

of the file_1_label or file_2_label parameters on the Compare two documents method. :attr Location location: (optional) The numeric location of the identified element in the document, represented with two integers labeled begin and end. :attr str text: (optional) The text of the element. :attr list[TypeLabelComparison] types: (optional) Description of the action specified by the element and whom it affects. :attr list[CategoryComparison] categories: (optional) List of functional categories into which the element falls; in other words, the subject matter of the element. :attr list[Attribute] attributes: (optional) List of document attributes.

class UpdatedLabelsIn(types, categories)[source]

Bases: object

The updated labeling from the input document, accounting for the submitted feedback.

Attr list[TypeLabel] types

Description of the action specified by the element and

whom it affects. :attr list[Category] categories: List of functional categories into which the element falls; in other words, the subject matter of the element.

class UpdatedLabelsOut(types=None, categories=None, modification=None)[source]

Bases: object

The updated labeling from the input document, accounting for the submitted feedback.

Attr list[TypeLabel] types

(optional) Description of the action specified by the

element and whom it affects. :attr list[Category] categories: (optional) List of functional categories into which the element falls; in other words, the subject matter of the element. :attr str modification: (optional) The type of modification the feedback entry in the updated_labels array. Possible values are added, not_changed, and removed.

class Value(cell_id=None, location=None, text=None)[source]

Bases: object

A value in a key-value pair.

Attr str cell_id

(optional) The unique ID of the value in the table.

Attr Location location

(optional) The numeric location of the identified element in

the document, represented with two integers labeled begin and end. :attr str text: (optional) The text content of the table cell without HTML markup.