semantria.pl

consumer_key(Key:text)[multifile]
Add a clause to this predicate to specify your Semantria API "consumer key".
secret_key_md5(MD5:text)[multifile]
Add a clause to this predicate to specify the MD5 hash of your Semantria API "secret key". The hash should use lower case hexadecimal encoding.

This hack is necessary because SWI Prolog doesn't seem to have a good MD5 implementation. Run `md5sum $secret_key` at a command prompt to get the value you need.

process_document(+Document:string, -Response:dict)
Queue Document for processing and block until a Response is available. This predicate is a synchronous convenience on top of Semantria's asynchronous API. A document ID is generated based on the document's content. Calling process_document/2 on a document that has already been processed returns immediately (using results cached on Semantria's server).
queue_document(+Document:string, ?Id:string) is det
Add Document to Semantria's queue for processing. If Id is ground, use that as the document's Id; otherwise, bind Id to a unique identifier for Document. Generated identifiers are guaranteed to be stable across invocations.
request_document(+Id:string, -Response:dict)
Request details about an already-queued document with Id. This predicate is usually called after calling queue_document/2.
request(+Method, +Path, Response:dict)
Low-level predicate for making authenticated API calls. Method specifies the HTTP method. Path indicates the path. It can be an atom or a term (like document/some_document_id). For example,
?- request(get, status, R).
R = _{api_version:"3.5", ...} .

For a POST request, make Method=post(Dict). The Dict is converted into a JSON object and included as the request body.