-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
166 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use strict"; | ||
|
||
var Api = require("../lib/Api"); | ||
var ArgumentParser = require("argparse").ArgumentParser; | ||
|
||
var parser = new ArgumentParser({ | ||
addHelp: true, | ||
description: "Get the syntactic dependencies 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 = "syntax_dependencies"; | ||
var syntax_dependencies_data = "Yoshinori Ohsumi, a Japanese cell biologist, was awarded the Nobel Prize in Physiology or Medicine on Monday."; | ||
|
||
api.parameters.content = syntax_dependencies_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)); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Rosette API. | ||
* | ||
* @copyright 2014-2015 Basis Technology Corporation. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is | ||
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and limitations under the License. | ||
**/ | ||
"use strict"; | ||
|
||
var URL = require("url"); | ||
|
||
var rosetteConstants = require("./rosetteConstants"); | ||
var RosetteException = require("./rosetteExceptions"); | ||
var rosetteRequest = require("./rosetteRequest"); | ||
|
||
/** | ||
* @class | ||
* | ||
* @copyright 2014-2015 Basis Technology Corporation. | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
function syntax_dependencies() { | ||
|
||
}; | ||
|
||
/** | ||
* Makes an HTTP request to the specified Rosette API endpoint and returns the result | ||
* @param {string} parameters - The Rosette API endpoint parameters | ||
* @param {string} userKey - The Rosette API user access key | ||
* @param {string} serviceURL - The base service URL to be used to access the Rosette API | ||
* @param {function} callback - Callback function to be exectuted after the function to which it is passed is complete | ||
*/ | ||
syntax_dependencies.prototype.getResults = function(parameters, userKey, protocol, serviceURL, callback) { | ||
|
||
if (parameters.documentFile != null) { | ||
parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, protocol, serviceURL, "syntax/dependencies", callback); | ||
|
||
} else { | ||
|
||
// validate parameters | ||
if (parameters.loadParams().content == null && parameters.loadParams().contentUri == null) { | ||
return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); | ||
} else if (parameters.loadParams().content != null && parameters.loadParams().contentUri != null) { | ||
return callback(new RosetteException("badArgument", "Cannot supply both Content and ContentUri", "bad arguments")); | ||
} else { | ||
// configure URL | ||
var urlParts = URL.parse(serviceURL + "syntax/dependencies"); | ||
} | ||
|
||
|
||
var req = new rosetteRequest(); | ||
req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); | ||
|
||
} | ||
|
||
}; | ||
|
||
module.exports = syntax_dependencies; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.