Postprocessing
The Postprocess endpoint performs a variety of operations that are useful for working with the outputs of an NLP (whether human or AI) system. These include:
- Fixing or restoring punctuation
- Fixing capitalization
- Fixing or restoring whitespace
- Splitting sentences into shorter sentences
Example use cases include repairing transcriptions or captions.
Looking for something not provided here? Contact us.
Postprocess POST
Request Parameters
https://api.sapling.ai/api/v1/postprocess
HTTP method: POST
The Postprocess API POST endpoint takes JSON parameters documented below:
key: String
32-character API key.
text: String
Text to postprocess
session_id: String
Unique name or UUID of document or portion of text that is being checked.
operations: String List
Operations to apply. The currently accepted operations are:
capitalize
punctuate
fixspaces
split
(Beta: please contact us if you encounter any issues)
auto_apply: Optional Boolean
Default is false. If true, result with have extra field applied_text
containing text with edits applied.
Example JSON body:
{
"key": "<api-key>",
"text": "Hey how are you doing",
"session_id": "test_session",
"operations": ["capitalize", "punctuate"]
}
Response Parameters
The Postprocess endpoint returns JSON following the same structure as the edits endpoint.
edits: Array
Array of Edit
objects for the text sent in the request.
Example output:
{
"edits": [
{
"end": 3,
"error_type": "M:PUNCT",
"general_error_type": "Punctuation",
"id": "b8d79060-d244-59ef-8dc8-9fdd02216454",
"replacement": "Hey,",
"sentence": "Hey how are you doing",
"sentence_start": 0,
"start": 0
},
{
"end": 21,
"error_type": "M:PUNCT",
"general_error_type": "Punctuation",
"id": "5b5f7598-91ef-55db-9359-0c88e11e5259",
"replacement": "doing?",
"sentence": "Hey how are you doing",
"sentence_start": 0,
"start": 16
}
]
}