Opinosis Text Summarization Web API

The Opinosis REST API is available to all academic researchers. You can use a command line tool like cURL to access the API or you can also easily access the API from any programming language using HTTP request and response libraries.

The nice thing with using the REST API version versus the Java jar file is that you can integrate the API into your code base, making evaluation and the ability to build on the API output much easier. Please follow these steps to start using the API:

1. Contact me to get your API Key (Please use "API-Key" as subject line)

  • Create a Mashape account. Mashape manages API keys and access.
  • Email: ganesan.kavita@gmail.com with your mashape username
  • Use "API-Key" as subject line
  • Also please describe your usage in the email. This version of API is only for academic research.
  • Please contact me if you have any questions about non-academic use

2. Start consuming the Opinosis Web API

Example JSON Input & Output: 

The Opinosis Web API accepts a JSON input and returns a JSON output.

Here is the sample request: JSON request.
This is the sample response for this request: JSON response 

{
    "results": [
        {
            "summary": "easy/jj to/to use/vb ,/, and/cc accurate/jj",
            "score": "3.69"
        },
        {
            "summary": "it/prp is/vbz always/rb accurate/jj",
            "score": "2.54"
        }
    ]
}

Example JSON Request using cURL

curl -X POST --include "https://rxnlp-opinosis.p.mashape.com/generateOpinosisSummaries" \
  -H "X-Mashape-Key: api_key" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  --data-binary "{'maxGap':'3','maxSentences':'5','minRedundancy':'2','doCollapse':'true','scoringFunction':'3','text':[{'sentence':'the/DT bathroom/NN was/VBD clean/JJ and/CC the/DT bed/NN was/VBD comfy/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD clean/JJ and/CC the/DT bed/NN was/VBD comfy/JJ ./.'},{'sentence':'the/DT bed/NN was/VBD comfy/JJ and/CC bathroom/NN was/VBD clean/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD too/RB dirty/JJ ./.'}]}" 


Example JSON Request using Python

# These code snippets use an open-source library. http://unirest.io/python
response = unirest.post("https://rxnlp-opinosis.p.mashape.com/generateOpinosisSummaries",
  headers={
    "X-Mashape-Key": "API-Key",
    "Content-Type": "application/json",
    "Accept": "application/json"
  },
  params=("{'maxGap':'3','maxSentences':'5','minRedundancy':'2','doCollapse':'true','scoringFunction':'3','text':[{'sentence':'the/DT bathroom/NN was/VBD clean/JJ and/CC the/DT bed/NN was/VBD comfy/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD clean/JJ and/CC the/DT bed/NN was/VBD comfy/JJ ./.'},{'sentence':'the/DT bed/NN was/VBD comfy/JJ and/CC bathroom/NN was/VBD clean/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD too/RB dirty/JJ ./.'}]}")
)


Example JSON Request using PHP

// These code snippets use an open-source library. http://unirest.io/php
$response = Unirest\Request::post("https://rxnlp-opinosis.p.mashape.com/generateOpinosisSummaries",
  array(
    "X-Mashape-Key" => "API-Key",
    "Content-Type" => "application/json",
    "Accept" => "application/json"
  )
  "{'maxGap':'3','maxSentences':'5','minRedundancy':'2','doCollapse':'true','scoringFunction':'3','text':[{'sentence':'the/DT bathroom/NN was/VBD clean/JJ and/CC the/DT bed/NN was/VBD comfy/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD clean/JJ and/CC the/DT bed/NN was/VBD comfy/JJ ./.'},{'sentence':'the/DT bed/NN was/VBD comfy/JJ and/CC bathroom/NN was/VBD clean/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD dirty/JJ ./.'},{'sentence':'the/DT bathroom/NN was/VBD too/RB dirty/JJ ./.'}]}"
);

Related Links