- Supports NIF
- Additional output formats for Zemanta: n3, ntriples, turtle
- Supports GET, POST
- Zemanta API key: you can register at Zemanta's developer network http://developer.zemanta.com/member/register/
- virtualenv and pip
Check Getting started with Virtualenv and pip
- Flask
- rdflib
- rdflib_rdfjson
- simplejson
-
Set up and activate virtualenv
virtualenv mywrapper
-
Clone this repo in it
-
Install dependencies using requirements.txt
pip install -r requirements.txt
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
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.
Parameter | values |
---|---|
input-type | text |
input | <url encoded plain text> |
format | rdfxml | ntriples | turtle | n3 | json |
nif | true |
Zemanta supports only plain text as an input, therefore nif parameter input-type is defaulted to text.
- 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
- 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: