Skip to content

sparkica/zem-api-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wrapper service for Zemanta API

  • Supports NIF
  • Additional output formats for Zemanta: n3, ntriples, turtle
  • Supports GET, POST

Requirements

Check Getting started with Virtualenv and pip

Dependencies

  • Flask
  • rdflib
  • rdflib_rdfjson
  • simplejson

Install

  1. Set up and activate virtualenv

     virtualenv mywrapper
    
  2. Clone this repo in it

  3. Install dependencies using requirements.txt

     pip install -r requirements.txt
    

Run

To run the wrapper service run service.py. It starts by default on localhost on port 5000, but you can easily change this.

python service.py

Use

With default server and port: http://127.0.0.1:5000/service

Wrapper supports all Zemanta parameters and additional NIF parameters. You can set Zemanta api_key in the service.py or pass it as a parameter.

NIF parameters

Parametervalues
input-typetext
input<url encoded plain text>
formatrdfxml | ntriples | turtle | n3 | json
niftrue

Zemanta supports only plain text as an input, therefore nif parameter input-type is defaulted to text.

Using the service as a NIF wrapper

  • set parameter nif=true
  • use either input or text parameter for supplying text
  • specify nif output format (see values in the table above)
  • provide your api_key

Defaults for Zemanta API:

  • method=zemanta.suggest_markup
  • format=json (this is not the same output format that will be used for results)

Examples:

http://127.0.0.1:5000/service?input=I+Love+Berlin&format=n3&nif=true&api_key=your-api-key-here

http://127.0.0.1:5000/service?text=I+Love+Berlin&format=n3&nif=true&api_key=your-api-key-here

Using the service as a RDF wrapper

  • provide all required parameters specified in Zemanta API documentation
  • in addition to ouput formats specified there, you can also use n3, ntriples, or turtle

Example:

http://127.0.0.1:5000/service?text=I+Love+Berlin&format=n3&method=zemanta.suggest&api_key=your-api-key-here

About

NIF wrapper for Zemanta API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages