Skip to main content

Customizing the API results format

The analysis formatter app is used to define a custom format for the results of a document analysis. This is useful if you only need a subset of the results, or would like to adapt the API results to conform to an existing format.

Options

AnalysisFormatterOptions

type AnalysisFormatterKeyword = 
    'uri'
  | 'canonical'
  | 'literal'
  | 'lemma'
  | 'attributes'
  | 'begin_offset'
  | 'end_offset'
  | 'begin_byte_offset'
  | 'end_byte_offset';
type AnalysisFormatterOptions = Record<string, AnalysisFormatterKeyword>;

where the record's keys define the properties of the results object, thereby replacing the default analysis results, and where the values are any of the supported keywords.

AnalysisFormatterKeyword

The following keywords are supported:

Keyword Description
uri URI of the entity
canonical Canonical of the entity if any, otherwise the literal representation
literal Literal representation of the entity
lemma Lemma representation of the entity
attributes Attributes of the entity
begin_offset Begin offset in the document
end_offset End offset in the document
begin_byte_offset Begin byte offset in the utf-8 input
end_byte_offset End byte offset in the utf-8 input

Examples

Customizing the API results format

The analysis formatter app is used to define a custom format for the results of a document analysis. This is useful if you only need a subset of the results, or would like to adapt the API results to conform to an existing format.

Options

AnalysisFormatterOptions

type AnalysisFormatterKeyword = 
    'uri'
  | 'canonical'
  | 'literal'
  | 'lemma'
  | 'attributes'
  | 'begin_offset'
  | 'end_offset'
  | 'begin_byte_offset'
  | 'end_byte_offset';
type AnalysisFormatterOptions = Record<string, AnalysisFormatterKeyword>;

where the record's keys define the properties of the results object, thereby replacing the default analysis results, and where the values are any of the supported keywords.

AnalysisFormatterKeyword

The following keywords are supported:

Keyword Description
uri URI of the entity
canonical Canonical of the entity if any, otherwise the literal representation
literal Literal representation of the entity
lemma Lemma representation of the entity
attributes Attributes of the entity
begin_offset Begin offset in the document
end_offset End offset in the document
begin_byte_offset Begin byte offset in the utf-8 input
end_byte_offset End byte offset in the utf-8 input

API

Examples

Formatting results

This code sets up and runs a text analysis pipeline that detects entities and formats the analysis results according to specified options.

from wowool.sdk import Pipeline

text = "John Smith works for Wowool."
pipeline = Pipeline(
    [
        "english",
        "entity",
        {
            "name": "analysis-formatter.app",
            "options": {"uri": "uri", "begin_offset": "bo", "lemma": "l"},
        },
    ]
)
document = pipeline(text)

License

In both cases you will need to acquirer a license file at https://www.wowool.com

Non-Commercial

This library is licensed under the GNU AGPLv3 for non-commercial use.  
For commercial use, a separate license must be purchased.  

Commercial license Terms

1. Grants the right to use this library in proprietary software.  
2. Requires a valid license key  
3. Redistribution in SaaS requires a commercial license.  

Metadata

Release files for wowool-analysis-formatter 2.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for wowool-analysis-formatter 2.3.1
File Interpreter ABI Platform Actions
wowool_analysis_formatter-2.3.1-py3-none-any.whl Python 3 none any Details for wowool_analysis_formatter-2.3.1-py3-none-any.whl

Release files / wowool_analysis_formatter-2.3.1-py3-none-any.whl

Download URL wowool_analysis_formatter-2.3.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea76ebd77b4dd75de86af07ff6993953f3bc4b00bb228566d01a180dac65c6af
BLAKE2b-256 checksum
How to use checksums
dccb7fe157099ede22f4b9176f785aa14da8c891b326c57ef3ed9615a8bace5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Security for wowool-analysis-formatter 2.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page