mirror of
https://github.com/balkian/hook.io-spotlight.git
synced 2025-01-05 02:41:29 +00:00
Initial commit
This commit is contained in:
commit
20a6d7c1cd
18
README.md
Normal file
18
README.md
Normal file
@ -0,0 +1,18 @@
|
||||
![GSI Logo](http://gsi.dit.upm.es/templates/jgsi/images/logo.png)
|
||||
[Web 4.0](http://gsi.dit.upm.es)
|
||||
==================================
|
||||
|
||||
Description
|
||||
---------------------
|
||||
This module is part of the Web4.0 project.
|
||||
|
||||
You can use it to query the spotlight endpoint in order to tag text.
|
||||
|
||||
Dependencies
|
||||
--------------------
|
||||
To run this project, you will need to install the following dependencies through npm:
|
||||
|
||||
- coffee-script
|
||||
- request
|
||||
- querify
|
||||
- hook.io
|
20
hook.io-spotlight.coffee
Normal file
20
hook.io-spotlight.coffee
Normal file
@ -0,0 +1,20 @@
|
||||
request = require 'request'
|
||||
querystring = require 'querystring'
|
||||
|
||||
cb = console.log
|
||||
|
||||
query = "I like indie music"
|
||||
#console.log " http://spotlight.dbpedia.org/rest/annotate?" + querystring.stringify({confidence:-1,"support":-1,text:query})
|
||||
|
||||
opts =
|
||||
uri: "http://spotlight.dbpedia.org/rest/annotate?" + querystring.stringify({text:query,confidence:0.0,support:-1})
|
||||
headers: {"Accept": 'application/json'}
|
||||
encoding: 'utf8'
|
||||
request.get opts, (err, res, body) ->
|
||||
if res?.statusCode is 200
|
||||
# cb? "Response: #{body}"
|
||||
cb? null, JSON.parse body
|
||||
else
|
||||
cb? "Something went wrong"
|
||||
cb? [err, res, body]
|
||||
|
Loading…
Reference in New Issue
Block a user