forked from rosette-api/nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentities.js
26 lines (22 loc) · 850 Bytes
/
entities.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"use strict";
var Api = require("../lib/Api");
var ArgumentParser = require("argparse").ArgumentParser;
var parser = new ArgumentParser({
addHelp: true,
description: "Get the entities from a piece of text"
});
parser.addArgument(["--key"], {help: "Rosette API key", required: true});
parser.addArgument(["--url"], {help: "Rosette API alt-url", required: false});
var args = parser.parseArgs();
var api = new Api(args.key, args.url);
var endpoint = "entities";
var entities_text_data = "Bill Murray will appear in new Ghostbusters film: Dr. Peter Venkman was spotted filming a cameo in Boston this… http://dlvr.it/BnsFfS";
api.parameters.content = entities_text_data;
api.parameters.genre = "social-media";
api.rosette(endpoint, function(err, res){
if(err){
console.log(err);
} else {
console.log(JSON.stringify(res, null, 2));
}
});