Synopsis

:- use_module(library(semantria)).

% provide Semantria API credentials
:- multifile semantria:consumer_key/1,
             semantria:secret_key_md5/1.
semantria:consumer_key("...").
semantria:secret_key_md5("...").

main :-
    process_document("When in the course ...", R),
    format("Sentiment: ~s~n", [R.sentiment_polarity]).

Description

A thin wrapper around the Semantria API for natural language processing.

Changes in this Version

Installation

Using SWI-Prolog 7.1 or later:

?- pack_install(semantria).

This module uses semantic versioning.

Source code available and pull requests accepted at http://github.com/mndrix/semantria

author
- Michael Hendricks <michael@ndrix.org>
license
- BSD

Prolog files

semantria.pl
consumer_key/1Add a clause to this predicate to specify your Semantria API "consumer key".
process_document/2Queue Document for processing and block until a Response is available.
queue_document/2Add Document to Semantria's queue for processing.
request/3Low-level predicate for making authenticated API calls.
request_document/2Request details about an already-queued document with Id.
secret_key_md5/1Add a clause to this predicate to specify the MD5 hash of your Semantria API "secret key".