Logo
OpenText Developer Cloud public resources API Documentation

Learning Service

POST {{baseUrl}}/session/services/learning

The Learning service is used to learn to classify and/or extract a document using the Information Extraction recognition project. The document must previously have been processed with one of the services that classify and/or extract the document in order to generate the needed server-side data for learning. Extraction IDs (extractionId) returned by the following services cannot be used for learning: Classify, ClassifyExtractPage, and ExtractPage. However, extraction IDs that are returned from the following services can be used: ClassifyExtractDocument, and ExtractDocument. In other words, only extraction IDs coming from document level classify or extract services are valid. Now, there are two situations where learning IDs will be invalid. First, if you change the structure of the batch such as rearranging pages, deleting pages, or adding new pages after you have called those APIs for classification and extraction, then you will need to clear the Extraction IDs (extractionId) in the UIMData as they will be invalid for learning. Second, if you modify a page such as rotating or cropping it, supply null for that page's classification ID instead of the ID returned by the classification APIs as the change to the image invalidates its classification.

For more efficient processing, if a document classified or extracted with the Information Extraction project will not be learned, the learning service should still be called with the learning mode set to None. This will delete any temporary server-side data that would otherwise be used for learning.

Service Properties

  • Env - Metadata environment identifier. Value is one of D, T or P. Default value is P.

  • Project - String. Must be set to InformationExtraction for the Information Extraction project.

Number of Request Items

This Real-Time Service supports one or more items.

Values Per Request Item

  • Mode - String. Valid values:

    • Classify - Learn to classify the supplied document.
    • Extract - Learn to extract the supplied document.
    • ClassifyExtract - Learn to both classify and extract the supplied document.
    • None - Do not learn, but remove any temporary server-side data used for learning the supplied document.
  • UimData - Object. This is a UIM data information object to be used for learning to extract. Learning works best if the field values have location rectangles. The page IDs for the field values are 0-based page numbers in this call.

  • DocumentType String. The Document Type name to be used for learning to classify.

  • ClassificationPageIds - Array of strings. The array of server-generated IDs, one per page, returned by classification functions. The service will use these values to learn to classify. If the entire document was extracted, this is the ClassificationPageIds returned by the extraction call. If the document was extracted page-by-page, it is an array of the per-page classification IDs. The values in the list must have the same order as the pages in the document.

Files Per Request Item

Each item can have one or more files. It can either be an embedded file or a reference to a file ID previously posted to the Files Resource. The File Type property for the file is ignored for this service.

 

Body PARAM

Key Datatype Required Description 



HEADERS

Key Datatype Required Description 
Content-Type
string




RESPONSES

status OK

{ "returnStatus": { "status": 200, "code": "OK0000", "message": "", "server": "WS-Sbf77b6cf64a140c5ad4db11b8cdba56aIS" }, "licenseUsedPercent": 0, "id": "ReqCPEXTRAC_33B_0041250", "serviceName": "learning", "executionMilliSeconds": 128, "licensePagesUsed": 1, "licensePagesUsed2": 0, "resultItems": [ { "nodeId": 1, "errorCode": "", "errorMessage": "", "values": [], "files": [] } ] }



Curl
curl -X POST 'https://capture.ot2.opentext.com/cp-rest/v2/session/services/learning' -H 'Content-Type: application/hal+json' -d '{"serviceProps":[{"name":"Env","value":"D"},{"name":"Project","value":"InformationExtraction"}],"requestItems":[{"nodeId":1,"values":[{"name":"Mode","value":"ClassifyExtract"},{"name":"DocumentType","value":"TestWren"},{"name":"ClassificationPageIds","value":["d907a548196c4e35837dad51954cd3ed","748f4bfce54f4fc084ba19cee31bcccc"]},{"name":"UimData","value":{"docType":"TestWren","locale":"en-US","flaggedReason":null,"extractionId":"3aff08999e844ff6a31aff002b0fcb4a","nodeList":[{"name":"InvoiceNumber","isArray":false,"indexFieldType":"Number","labelText":"Invoice No.","isRequired":true,"controlType":"TextBox","data":[{"arrayIndex":0,"value":227628,"fieldError":{"errorCode":"ER2208","recoverable":false,"message":"Out of Bounds:Valid values: 1000 10210"},"mustConfirm":true,"choices":null,"locationRect":{"left":639,"top":144,"width":124,"height":30},"pageId":0,"confidence":100,"extractedCharacters":[{"values":[{"value":"2","confidence":100}]}]}]}]}}],"files":[{"name":"Wren","value":"F_30fd48db3ba14157ade16ba6b7f8c8a9TIF","contentType":"image/tiff","fileType":"tif"},{"name":"Wren_p2","value":"F_2061b933c8e5412aa563a1b9c7ebf337TIF","contentType":"image/tiff","fileType":"tif"}]}]}'

ENDPOINTS