The Wowool Analysis Formatter
Project description
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'
| 'stem'
| '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 |
stem |
Stem 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'
| 'stem'
| '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 |
stem |
Stem 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", "stem": "s"},
},
]
)
document = pipeline(text)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wowool_analysis_formatter-2.1.2-py3-none-any.whl.
File metadata
- Download URL: wowool_analysis_formatter-2.1.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe13dbdd748f758a378533f69e9aad1274b3a9e6a99605995e90eb8ce53be109
|
|
| MD5 |
e3b449ddf2286736e4bd96301fcc22cf
|
|
| BLAKE2b-256 |
7548ad4aa22df657d913e5b0e3defe12301bf8e7f51d0d0bb47d78cc77284ead
|