1
0
mirror of https://github.com/balkian/hook.io-spotlight.git synced 2024-09-28 15:01:42 +00:00

Initial commit

This commit is contained in:
J.Fernando Sánchez 2012-03-15 21:32:37 +01:00
commit 20a6d7c1cd
3 changed files with 40 additions and 0 deletions

18
README.md Normal file
View 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
View 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]

2
index.js Normal file
View File

@ -0,0 +1,2 @@
require('coffee-script')
require('./hook.io-spotlight')