Returns a content profile computed on the fly, given the unstructured natural language text of an input document. The content profile can be customized using customer-specific whitelists and blacklists. Whitelists and blacklists are referenced via processing dictionary identifiers.
The user must be authenticated and have read access to any referenced dictionary identifiers.
Request
The request object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
Object |
Yes |
The input text to process. The keys are field names in the document, and a field's value is either a text block or a list of text blocks. The latter is beneficial for, e.g., fields that are composed of multiple paragraphs. The client can choose which field names to use, i.e., no special schema is enforced for this. All field values should be markup-free text, i.e., no HTML or XML. |
|
|
String |
No |
Deprecated. An optional document identifier. Gets echoed in the response. |
|
|
String |
No |
The language of the input document, expressed as a ISO 639-1 language code. If no language is specified, an algorithm for automatic language identification tries to infer the language. |
|
|
String |
No |
Deprecated. Use whitelistDictionaryIds instead. |
|
|
String |
No |
Deprecated. Use blacklistDictionaryIds instead. |
|
|
Object |
No |
Deprecated. Use whitelistDictionaryIds and blacklistDictionaryIds instead. |
|
|
Array of String |
No |
The set of whitelist dictionaries to use for custom processing of the input text, in addition to standard processing. All dictionaries are applied sequentially and independently of each other. A whitelist dictionary is typically configured to be consulted in |
|
|
Array of String |
No |
The set of blacklist dictionaries to use for custom processing of the input text, in addition to standard processing. A match in any of the specified blacklist dictionaries will suffice for blacklisting. A blacklist dictionary is typically configured to be consulted in |
|
|
Boolean |
No |
If |
The processing object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
Array of Object |
No |
Deprecated. Use whitelistDictionaryIds in request object instead. |
|
|
Array of Object |
No |
Deprecated. Use blacklistDictionaryIds in request object instead. |
"processing": {
"whitelist": [
{"dictionaryId": "1111111111111111"},
{"dictionaryId": "2222222222222222"}
],
"blacklist": [
{"dictionaryId": "3333333333333333"},
]
}
An individual whitelist or blacklist dictionary reference object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
String |
Yes |
Deprecated. Use whitelistDictionaryIds and blacklistDictionaryIds in request object instead. |
Whitelist and blacklist dictionaries can be defined and updated using the /processing/dictionary/update API. Dictionaries can be provided in JSON format or as Excel workbooks.
Don't mix this deprecated old-style fields (for example for the ESCENIC Semantic Plugin configuration):
-
documentId -
whitelistGroupId -
blacklistGroupId -
processing
with their new-style versions:
-
whitelistDictionaryIds -
blacklistDictionaryIds
You will get this error message in the API response:==> { "error": "Invalid request: Mixing of old and new request formats not allowed." }
Response
The response object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
Object |
The content profile computed from the input text. See /profile/content/fetch for documentation of the object structure. |
|
|
String |
Deprecated. Only used if the request specified documentId. |
|
|
String |
The [ISO 639-1](http://ISO 639-1) language code denoting the language that was assumed when the input text was processed. If no language code was explicitly specified as part of the request, this will then yield the result of the automatic language detection algorithm. |
|
|
Object |
Deprecated. Only used if the request specified |
|
|
String |
Deprecated. Only used if the request specified |
|
|
String |
Deprecated. Only used if the request specified |
Examples
$ # Note that 'title' and 'body' are arbitrary field names, that all input text is markup-free, and that fields with multiple paragraphs are best supplied as lists.
$ python cx.py /processing/linguistics/execute '{"document":{"title":"Inconceivable!", "body":["My name is Inigo Montoya. You killed my father.", "Prepare to die."]}}'
{
"profile": [
{
"item": "inigo montoya",
"groups": [
{
"count": 1,
"group": "person",
"weight": 1.0
}
]
},
{
"item": "en",
"groups": [
{
"count": 1,
"group": "language",
"weight": 0.1
}
]
}
],
"language": "en"
}
$ # Note that 'title' and 'body' are arbitrary field names, that all input text is markup-free, and that fields with multiple paragraphs are best supplied as lists. The caller has read access to the referenced dictionaries.
$ python cx.py /processing/linguistics/execute '{"document":{"title":"Great food", "body":["I like pastrami very much.", "Really, it is almost as good as bacon."]}, "customOnly":true, "whitelistDictionaryIds":["13579"], "blacklistDictionaryIds":["24680"]}'
{
"profile": [
{
"item": "pastrami",
"groups": [
{
"count": 1,
"group": "meat",
"weight": 1.0
}
]
}
]
}
The cx.py utility used in the examples above is available from here.