From ad86ae33f718e485fc3a24a8982df688f3445c52 Mon Sep 17 00:00:00 2001 From: Seth Gransky Date: Mon, 22 Jan 2018 16:31:25 -0500 Subject: [PATCH 01/10] Bump to development version. --- lib/rosetteRequest.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rosetteRequest.js b/lib/rosetteRequest.js index c9f89a7..b137db4 100644 --- a/lib/rosetteRequest.js +++ b/lib/rosetteRequest.js @@ -28,7 +28,7 @@ var querystring = require('querystring'); * * @type string */ -var BINDING_VERSION = "1.9.0"; +var BINDING_VERSION = "1.9.1-devel"; var USER_AGENT = "rosetteapinode/" + BINDING_VERSION + "/" + process.version; /** diff --git a/package.json b/package.json index 2991f5b..4389808 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rosette-api", - "version": "1.9.0", + "version": "1.9.1-devel", "description": "Rosette API Node.js client SDK", "main": "index", "directories": { From 6687c9a8ccc79423e0f2987f0941709904ac152a Mon Sep 17 00:00:00 2001 From: Seth Gransky Date: Mon, 22 Jan 2018 16:43:59 -0500 Subject: [PATCH 02/10] Roll back devel version. Composer doesn't like it. --- lib/rosetteRequest.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rosetteRequest.js b/lib/rosetteRequest.js index b137db4..eb91bcd 100644 --- a/lib/rosetteRequest.js +++ b/lib/rosetteRequest.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -28,7 +28,7 @@ var querystring = require('querystring'); * * @type string */ -var BINDING_VERSION = "1.9.1-devel"; +var BINDING_VERSION = "1.9.0"; var USER_AGENT = "rosetteapinode/" + BINDING_VERSION + "/" + process.version; /** diff --git a/package.json b/package.json index 4389808..2991f5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rosette-api", - "version": "1.9.1-devel", + "version": "1.9.0", "description": "Rosette API Node.js client SDK", "main": "index", "directories": { From a4bb6ab95f6c0d837c1e2ac58923bc05e2d24df4 Mon Sep 17 00:00:00 2001 From: Seth Gransky Date: Mon, 22 Jan 2018 16:57:32 -0500 Subject: [PATCH 03/10] Mix up. Node was fine with the devel version. --- README.md | 2 +- lib/rosetteRequest.js | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4468cd7..fedb837 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/rosette-api/nodejs.svg?branch=master)](https://travis-ci.org/rosette-api/nodejs) +[![Build Status](https://travis-ci.org/rosette-api/nodejs.svg?branch=develop)](https://travis-ci.org/rosette-api/nodejs) # rosette-api diff --git a/lib/rosetteRequest.js b/lib/rosetteRequest.js index eb91bcd..418f554 100644 --- a/lib/rosetteRequest.js +++ b/lib/rosetteRequest.js @@ -28,7 +28,7 @@ var querystring = require('querystring'); * * @type string */ -var BINDING_VERSION = "1.9.0"; +var BINDING_VERSION = "1.9.1-devel"; var USER_AGENT = "rosetteapinode/" + BINDING_VERSION + "/" + process.version; /** diff --git a/package.json b/package.json index 2991f5b..4389808 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rosette-api", - "version": "1.9.0", + "version": "1.9.1-devel", "description": "Rosette API Node.js client SDK", "main": "index", "directories": { From 035e16513046368461c42bb0ea665723f90a65d8 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 25 Apr 2018 10:25:39 -0400 Subject: [PATCH 04/10] WS-1377 expanded-smoke-tests - route to docker-light --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 28b186e..18dbaf0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,4 @@ -node { +node ("docker-light") { def SOURCEDIR = pwd() try { stage("Clean up") { From c7722f5e1b0ac5f14d472bb87665e1fd65fb3de4 Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Tue, 27 Nov 2018 16:13:40 -0500 Subject: [PATCH 05/10] DOC-246 remove undocumented option --- examples/relationships.js | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/relationships.js b/examples/relationships.js index 2f44201..5897d97 100644 --- a/examples/relationships.js +++ b/examples/relationships.js @@ -18,7 +18,6 @@ var relationships_text_data = "FLIR Systems is headquartered in Oregon and produ var content = relationships_text_data; api.parameters.content = content; -api.parameters.options = { "accuracyMode": "PRECISION" }; api.rosette(endpoint, function(err, res) { if (err) { From 44aa13a6b3ef546629c62c2bb08e48f0b7428160 Mon Sep 17 00:00:00 2001 From: seth-basistech Date: Wed, 5 Dec 2018 12:04:03 -0500 Subject: [PATCH 06/10] Fix URL. --- examples/categories.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/categories.js b/examples/categories.js index 2932571..58b9897 100644 --- a/examples/categories.js +++ b/examples/categories.js @@ -13,7 +13,7 @@ var args = parser.parseArgs(); var api = new Api(args.key, args.url); var endpoint = "categories"; -var categories_url_data = "http://www.onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/"; +var categories_url_data = "https://onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/"; api.parameters.contentUri = categories_url_data; api.rosette(endpoint, function(err, res){ @@ -22,4 +22,4 @@ api.rosette(endpoint, function(err, res){ } else { console.log(JSON.stringify(res, null, 2)); } -}); \ No newline at end of file +}); From 083fa05d7e41c21a0531d4911b69f7263102f15e Mon Sep 17 00:00:00 2001 From: seth-basistech Date: Fri, 7 Dec 2018 13:36:07 -0500 Subject: [PATCH 07/10] DEVOPS-206: make eslint happy (#69) * DEVOPS-206: Endline normalize. Fix linter warnings. Copyright year. Tidying. node version additions and bumps. --- .eslintrc.json | 262 ++++++++++++++++++------------------- .travis.yml | 32 ++--- Gruntfile.js | 134 +++++++++---------- lib/.Rhistory | 0 lib/Api.js | 14 +- lib/categories.js | 8 +- lib/entities.js | 12 +- lib/info.js | 4 +- lib/language.js | 6 +- lib/morphology.js | 8 +- lib/nameDeduplication.js | 5 +- lib/nameSimilarity.js | 6 +- lib/nameTranslation.js | 6 +- lib/parameters.js | 4 +- lib/ping.js | 4 +- lib/relationships.js | 16 +-- lib/rosetteConstants.js | 2 +- lib/rosetteExceptions.js | 2 +- lib/rosetteRequest.js | 2 +- lib/sentences.js | 6 +- lib/sentiment.js | 6 +- lib/syntax_dependencies.js | 14 +- lib/textEmbedding.js | 8 +- lib/tokens.js | 6 +- lib/topics.js | 6 +- lib/transliteration.js | 7 +- 26 files changed, 273 insertions(+), 307 deletions(-) delete mode 100644 lib/.Rhistory diff --git a/.eslintrc.json b/.eslintrc.json index 24a713a..ba0b8da 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,131 +1,131 @@ -{ - "parserOptions": { - "ecmaVersion": 6, - "ecmaFeatures": { - "experimentalObjectRestSpread": true, - "jsx": true - }, - "sourceType": "module" - }, - - "env": { - "es6": true, - "node": true - }, - - "globals": { - "document": false, - "navigator": false, - "window": false - }, - - "rules": { - "accessor-pairs": 1, - "arrow-parens": [1, "always"], - "arrow-spacing": [1, { "before": true, "after": true }], - "block-spacing": [1, "always"], - "brace-style": [1, "1tbs", { "allowSingleLine": true }], - "comma-dangle": [1, "never"], - "comma-spacing": [1, { "before": false, "after": true }], - "comma-style": [1, "last"], - "constructor-super": 1, - "curly": [1, "multi-line"], - "dot-location": [1, "property"], - "eol-last": 0, - "eqeqeq": [0, "allow-null"], - "generator-star-spacing": [1, { "before": true, "after": true }], - "handle-callback-err": [1, "^(err|error)$" ], - "indent": [1, 4], - "jsx-quotes": [1, "prefer-single"], - "key-spacing": [1, { "beforeColon": false, "afterColon": true }], - "keyword-spacing": [1, { "before": true, "after": true }], - "new-cap": [1, { "newIsCap": false, "capIsNew": false }], - "new-parens": 1, - "no-array-constructor": 1, - "no-caller": 1, - "no-class-assign": 1, - "no-cond-assign": 1, - "no-const-assign": 1, - "no-control-regex": 1, - "no-debugger": 1, - "no-delete-var": 1, - "no-dupe-args": 1, - "no-dupe-class-members": 1, - "no-dupe-keys": 1, - "no-duplicate-case": 1, - "no-empty-character-class": 1, - "no-empty-pattern": 1, - "no-eval": 1, - "no-ex-assign": 1, - "no-extend-native": 1, - "no-extra-bind": 1, - "no-extra-boolean-cast": 1, - "no-extra-parens": [1, "functions"], - "no-fallthrough": 1, - "no-floating-decimal": 1, - "no-func-assign": 1, - "no-implied-eval": 1, - "no-inner-declarations": [1, "functions"], - "no-invalid-regexp": 1, - "no-irregular-whitespace": 1, - "no-iterator": 1, - "no-label-var": 1, - "no-labels": [1, { "allowLoop": false, "allowSwitch": false }], - "no-lone-blocks": 1, - "no-mixed-spaces-and-tabs": 1, - "no-multi-spaces": 1, - "no-multi-str": 1, - "no-multiple-empty-lines": [1, { "max": 1 }], - "no-native-reassign": 1, - "no-negated-in-lhs": 1, - "no-new": 1, - "no-new-func": 1, - "no-new-object": 1, - "no-new-require": 1, - "no-new-symbol": 1, - "no-new-wrappers": 1, - "no-obj-calls": 1, - "no-octal": 1, - "no-octal-escape": 1, - "no-path-concat": 1, - "no-proto": 1, - "no-redeclare": 1, - "no-regex-spaces": 1, - "no-return-assign": [1, "except-parens"], - "no-self-assign": 1, - "no-self-compare": 1, - "no-sequences": 1, - "no-shadow-restricted-names": 1, - "no-spaced-func": 1, - "no-sparse-arrays": 1, - "no-this-before-super": 1, - "no-throw-literal": 1, - "no-trailing-spaces": 0, - "no-undef": 1, - "no-undef-init": 1, - "no-unexpected-multiline": 1, - "no-unneeded-ternary": [1, { "defaultAssignment": false }], - "no-unreachable": 1, - "no-unused-vars": 0, - "no-useless-call": 1, - "no-useless-constructor": 1, - "no-with": 1, - "one-var": [1, { "initialized": "never" }], - "operator-linebreak": [1, "after", { "overrides": { "?": "before", ":": "before" } }], - "padded-blocks": [0, "never"], - "quotes": 0, - "semi": [0, "never"], - "semi-spacing": [1, { "before": false, "after": true }], - "space-before-blocks": [1, "always"], - "space-before-function-paren": 0, - "space-in-parens": [1, "never"], - "space-infix-ops": 1, - "space-unary-ops": [1, { "words": true, "nonwords": false }], - "spaced-comment": 0, - "template-curly-spacing": [1, "never"], - "use-isnan": 1, - "valid-typeof": 1, - "wrap-iife": [1, "any"], - "yield-star-spacing": [1, "both"] - } -} \ No newline at end of file +{ + "parserOptions": { + "ecmaVersion": 6, + "ecmaFeatures": { + "ecmaVersion": true, + "jsx": true + }, + "sourceType": "module" + }, + + "env": { + "es6": true, + "node": true + }, + + "globals": { + "document": false, + "navigator": false, + "window": false + }, + + "rules": { + "accessor-pairs": 1, + "arrow-parens": [1, "always"], + "arrow-spacing": [1, { "before": true, "after": true }], + "block-spacing": [1, "always"], + "brace-style": [1, "1tbs", { "allowSingleLine": true }], + "comma-dangle": [1, "never"], + "comma-spacing": [1, { "before": false, "after": true }], + "comma-style": [1, "last"], + "constructor-super": 1, + "curly": [1, "multi-line"], + "dot-location": [1, "property"], + "eol-last": 0, + "eqeqeq": [0, "allow-null"], + "generator-star-spacing": [1, { "before": true, "after": true }], + "handle-callback-err": [1, "^(err|error)$" ], + "indent": [1, 4], + "jsx-quotes": [1, "prefer-single"], + "key-spacing": [1, { "beforeColon": false, "afterColon": true }], + "keyword-spacing": [1, { "before": true, "after": true }], + "new-cap": [1, { "newIsCap": false, "capIsNew": false }], + "new-parens": 1, + "no-array-constructor": 1, + "no-caller": 1, + "no-class-assign": 1, + "no-cond-assign": 1, + "no-const-assign": 1, + "no-control-regex": 1, + "no-debugger": 1, + "no-delete-var": 1, + "no-dupe-args": 1, + "no-dupe-class-members": 1, + "no-dupe-keys": 1, + "no-duplicate-case": 1, + "no-empty-character-class": 1, + "no-empty-pattern": 1, + "no-eval": 1, + "no-ex-assign": 1, + "no-extend-native": 1, + "no-extra-bind": 1, + "no-extra-boolean-cast": 1, + "no-extra-parens": [1, "functions"], + "no-fallthrough": 1, + "no-floating-decimal": 1, + "no-func-assign": 1, + "no-implied-eval": 1, + "no-inner-declarations": [1, "functions"], + "no-invalid-regexp": 1, + "no-irregular-whitespace": 1, + "no-iterator": 1, + "no-label-var": 1, + "no-labels": [1, { "allowLoop": false, "allowSwitch": false }], + "no-lone-blocks": 1, + "no-mixed-spaces-and-tabs": 1, + "no-multi-spaces": 1, + "no-multi-str": 1, + "no-multiple-empty-lines": [1, { "max": 1 }], + "no-native-reassign": 1, + "no-negated-in-lhs": 1, + "no-new": 1, + "no-new-func": 1, + "no-new-object": 1, + "no-new-require": 1, + "no-new-symbol": 1, + "no-new-wrappers": 1, + "no-obj-calls": 1, + "no-octal": 1, + "no-octal-escape": 1, + "no-path-concat": 1, + "no-proto": 1, + "no-redeclare": 1, + "no-regex-spaces": 1, + "no-return-assign": [1, "except-parens"], + "no-self-assign": 1, + "no-self-compare": 1, + "no-sequences": 1, + "no-shadow-restricted-names": 1, + "no-spaced-func": 1, + "no-sparse-arrays": 1, + "no-this-before-super": 1, + "no-throw-literal": 1, + "no-trailing-spaces": 0, + "no-undef": 1, + "no-undef-init": 1, + "no-unexpected-multiline": 1, + "no-unneeded-ternary": [1, { "defaultAssignment": false }], + "no-unreachable": 1, + "no-unused-vars": 0, + "no-useless-call": 1, + "no-useless-constructor": 1, + "no-with": 1, + "one-var": [1, { "initialized": "never" }], + "operator-linebreak": [1, "after", { "overrides": { "?": "before", ":": "before" } }], + "padded-blocks": [0, "never"], + "quotes": 0, + "semi": [0, "never"], + "semi-spacing": [1, { "before": false, "after": true }], + "space-before-blocks": [1, "always"], + "space-before-function-paren": 0, + "space-in-parens": [1, "never"], + "space-infix-ops": 1, + "space-unary-ops": [1, { "words": true, "nonwords": false }], + "spaced-comment": 0, + "template-curly-spacing": [1, "never"], + "use-isnan": 1, + "valid-typeof": 1, + "wrap-iife": [1, "any"], + "yield-star-spacing": [1, "both"] + } +} diff --git a/.travis.yml b/.travis.yml index 93764f7..cda3e84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,17 @@ -language: node_js -node_js: - - "6.3.0" - - "7.2.0" - - "8.0.0" -before_install: - - npm install -g npm -before_script: - - npm install grunt-cli -g -script: grunt -notifications: - slack: - rooms: - - secure: 4FRaTAAiYyeUvgw2RhmblgbNiJO4wmd34OBgWcwURjP9oVmFfSwR9r1LNCdUGxrPOghexSY2DjXIuvIrfTfi/xYbhHb3Kw7PEAyB8IuBMlKtY4NSFou62S2VhYpxyg58T+C7P2zi0eDnDE06pwTCoGPaimxMZQY91yQ0yPYDPVXbwe5SjEgamzlwGBxlS/0A6w1iCPHg27/iO2hXtdW3oLS2I0F/Q8Q95RBkX9hpg6yqHlTV7jRbSqvQ9OFBqk/tXMHQvhoPDGgCgQDuykJuaAYx7g9d0YL0eEYYOh9B/TJ/kNOwdRFBu5kuQ2/nFS5Z0S3Y3UIhdYjUmm9gSMnwIbYnrW22EqDJLoT9Zi3Gv7Prg/8/fSkWsof7BJTMSuXUqO1AxDGKIxFv9uSF1daZoY+AC1ooU1xDu1nNvWVYPlkwEdDxxmHpFkGT3ESTZYccPovQl8Z5K0I1BBAVdJKDzm07lE6VHbxkKcvK6gG0TN3uLxnSlQtjkfJ+aVMq1kxeVsB9lEsKs9oezsKzzbftMm525aXPg+OAv+31CUFWxvT/p4ps8Q+AV6aZpoPHkpK8VryyNirUeZ/m4m4ebDHhD9vcN+JqE9gzshT+0U3g19SvLiUMQtbuZ2BUvrq2hh2LEGs03AFZaNg9AEUVA1PQRhV5NILyoS/lbiBYJPT39Sg= - +language: node_js +node_js: + - "6.15.1" + - "7.10.1" + - "8.14.0" + - "9.11.2" + - "10.14.1" + - "11.4.0" +before_install: + - npm install -g npm +before_script: + - npm install grunt-cli -g +script: grunt +notifications: + slack: + rooms: + - secure: 4FRaTAAiYyeUvgw2RhmblgbNiJO4wmd34OBgWcwURjP9oVmFfSwR9r1LNCdUGxrPOghexSY2DjXIuvIrfTfi/xYbhHb3Kw7PEAyB8IuBMlKtY4NSFou62S2VhYpxyg58T+C7P2zi0eDnDE06pwTCoGPaimxMZQY91yQ0yPYDPVXbwe5SjEgamzlwGBxlS/0A6w1iCPHg27/iO2hXtdW3oLS2I0F/Q8Q95RBkX9hpg6yqHlTV7jRbSqvQ9OFBqk/tXMHQvhoPDGgCgQDuykJuaAYx7g9d0YL0eEYYOh9B/TJ/kNOwdRFBu5kuQ2/nFS5Z0S3Y3UIhdYjUmm9gSMnwIbYnrW22EqDJLoT9Zi3Gv7Prg/8/fSkWsof7BJTMSuXUqO1AxDGKIxFv9uSF1daZoY+AC1ooU1xDu1nNvWVYPlkwEdDxxmHpFkGT3ESTZYccPovQl8Z5K0I1BBAVdJKDzm07lE6VHbxkKcvK6gG0TN3uLxnSlQtjkfJ+aVMq1kxeVsB9lEsKs9oezsKzzbftMm525aXPg+OAv+31CUFWxvT/p4ps8Q+AV6aZpoPHkpK8VryyNirUeZ/m4m4ebDHhD9vcN+JqE9gzshT+0U3g19SvLiUMQtbuZ2BUvrq2hh2LEGs03AFZaNg9AEUVA1PQRhV5NILyoS/lbiBYJPT39Sg= diff --git a/Gruntfile.js b/Gruntfile.js index caa3d19..f058449 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,67 +1,67 @@ -"use strict"; - -module.exports = function(grunt) { - - // Project configuration. - grunt.initConfig({ - clean: ["target"], - eslint: { - lib: { - src: ["lib/**/*.js"] - }, - options: { - configFile: "conf/eslint.json" - }, - gruntfile: { - src: "Gruntfile.js" - } - }, - jsdoc: { - dist: { - src: "lib/*.js", - options: { - destination: "target/html" - } - } - }, - mochaTest: { - test: { - options: { - reporter: 'spec', - quiet: false, // Optionally suppress output to standard out (defaults to false) - clearRequireCache: false // Optionally clear the require cache before running tests (defaults to false) - }, - src: ['tests/**/*.js'] - } - }, - 'gh-pages': { - options: { - base: 'target/html' - }, - src: ['**/*'] - }, - watch: { - gruntfile: { - files: "<%= eslint.gruntfile.lib %>", - tasks: ["eslint:gruntfile"] - }, - lib: { - files: "<%= eslint.lib.src %>", - tasks: ["eslint:lib"] - } - } - }); - - // These plugins provide necessary tasks. - grunt.loadNpmTasks("grunt-contrib-clean"); - grunt.loadNpmTasks("grunt-contrib-watch");; - grunt.loadNpmTasks("grunt-jsdoc"); - grunt.loadNpmTasks('grunt-mocha-test'); - grunt.loadNpmTasks('grunt-gh-pages'); - - // Task definitions. - // run `grunt ` in command line and it will run the sequence in brackets - grunt.registerTask("default", ["clean","jsdoc", "test"]); - grunt.registerTask("doc", ["jsdoc", "gh-pages"]); - grunt.registerTask("test", ["mochaTest"]); -}; +"use strict"; + +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + clean: ["target"], + eslint: { + lib: { + src: ["lib/**/*.js"] + }, + options: { + configFile: "conf/eslint.json" + }, + gruntfile: { + src: "Gruntfile.js" + } + }, + jsdoc: { + dist: { + src: "lib/*.js", + options: { + destination: "target/html" + } + } + }, + mochaTest: { + test: { + options: { + reporter: 'spec', + quiet: false, // Optionally suppress output to standard out (defaults to false) + clearRequireCache: false // Optionally clear the require cache before running tests (defaults to false) + }, + src: ['tests/**/*.js'] + } + }, + 'gh-pages': { + options: { + base: 'target/html' + }, + src: ['**/*'] + }, + watch: { + gruntfile: { + files: "<%= eslint.gruntfile.lib %>", + tasks: ["eslint:gruntfile"] + }, + lib: { + files: "<%= eslint.lib.src %>", + tasks: ["eslint:lib"] + } + } + }); + + // These plugins provide necessary tasks. + grunt.loadNpmTasks("grunt-contrib-clean"); + grunt.loadNpmTasks("grunt-contrib-watch");; + grunt.loadNpmTasks("grunt-jsdoc"); + grunt.loadNpmTasks('grunt-mocha-test'); + grunt.loadNpmTasks('grunt-gh-pages'); + + // Task definitions. + // run `grunt ` in command line and it will run the sequence in brackets + grunt.registerTask("default", ["clean","jsdoc", "test"]); + grunt.registerTask("doc", ["jsdoc", "gh-pages"]); + grunt.registerTask("test", ["mochaTest"]); +}; diff --git a/lib/.Rhistory b/lib/.Rhistory deleted file mode 100644 index e69de29..0000000 diff --git a/lib/Api.js b/lib/Api.js index 2412d20..f2d38ad 100644 --- a/lib/Api.js +++ b/lib/Api.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -26,18 +26,18 @@ var entities = require("./entities"); var info = require("./info"); var language = require("./language"); var matchedName = require("./nameSimilarity"); -var nameDeduplication = require("./nameDeduplication"); var morphology = require("./morphology"); +var nameDeduplication = require("./nameDeduplication"); var ping = require("./ping"); var relationships = require("./relationships"); var sentences = require("./sentences"); var sentiment = require("./sentiment"); +var syntax_dependencies = require("./syntax_dependencies"); var textEmbedding = require("./textEmbedding"); -var translatedName = require("./nameTranslation"); var tokens = require("./tokens"); -var syntax_dependencies = require("./syntax_dependencies"); -var transliteration = require("./transliteration"); var topics = require("./topics"); +var translatedName = require("./nameTranslation"); +var transliteration = require("./transliteration"); /** * @class @@ -47,7 +47,7 @@ var topics = require("./topics"); * Api server endpoints. * * @example var api = new API(userKey, serviceUrl); - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function Api(userKey, serviceURL) { @@ -102,7 +102,7 @@ Api.prototype.rosette = function(endpoint, callback) { endpoint = require("./" + endpoint); var e = new endpoint(); - // send parameters to the specified endpoint + // send parameters to the specified endpoint e.getResults(api.parameters, api.userKey, api.protocol, api.serviceURL, function(err, res) { if (err) { return callback(err); diff --git a/lib/categories.js b/lib/categories.js index c8c3424..760514e 100644 --- a/lib/categories.js +++ b/lib/categories.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function categories() { @@ -41,8 +41,7 @@ categories.prototype.getResults = function(parameters, userKey, protocol, servic if (parameters.documentFile != null) { parameters.loadFile(parameters.documentFile, parameters, userKey, protocol, serviceURL, "categories", callback); } else { - - // validate parameters + // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of content or contentUri", "bad arguments")); } else if (parameters.loadParams().content != null && parameters.loadParams().contentUri != null) { @@ -54,7 +53,6 @@ categories.prototype.getResults = function(parameters, userKey, protocol, servic req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } } - }; module.exports = categories; diff --git a/lib/entities.js b/lib/entities.js index 336711d..65037c8 100644 --- a/lib/entities.js +++ b/lib/entities.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function entities() { @@ -39,10 +39,9 @@ function entities() { entities.prototype.getResults = function(parameters, userKey, protocol, serviceURL, callback) { if (parameters.documentFile != null) { - parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, protocol, serviceURL, "entities", callback); + parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, protocol, serviceURL, "entities", callback); } else { - - // validate parameters + // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); } else if (parameters.loadParams().content && parameters.loadParams().contentUri) { @@ -50,13 +49,10 @@ entities.prototype.getResults = function(parameters, userKey, protocol, serviceU } else { // configure URL var urlParts = URL.parse(serviceURL + "entities"); - var req = new rosetteRequest(); req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); - } } - }; module.exports = entities; diff --git a/lib/info.js b/lib/info.js index 879b328..5c824c8 100644 --- a/lib/info.js +++ b/lib/info.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function info() { diff --git a/lib/language.js b/lib/language.js index d10baa7..a2083b3 100644 --- a/lib/language.js +++ b/lib/language.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function language() { @@ -41,7 +41,6 @@ language.prototype.getResults = function(parameters, userKey, protocol, serviceU if (parameters.documentFile != null) { parameters.loadFile(parameters.documentFile, parameters, userKey, protocol, serviceURL, "language", callback); } else { - // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); @@ -54,7 +53,6 @@ language.prototype.getResults = function(parameters, userKey, protocol, serviceU req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } } - }; module.exports = language; diff --git a/lib/morphology.js b/lib/morphology.js index 40d1491..f15e030 100644 --- a/lib/morphology.js +++ b/lib/morphology.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function morphology() { @@ -37,11 +37,10 @@ function morphology() { * @param {function} callback - Callback function to be exectuted after the function to which it is passed is complete */ morphology.prototype.getResults = function(parameters, userKey, protocol, serviceURL, callback) { - //console.log(parameters) + if (parameters.documentFile != null) { parameters.loadFile(parameters.documentFile, parameters, userKey, protocol, serviceURL, "morphology" + "/" + parameters.morphology, callback); } else { - // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); @@ -56,7 +55,6 @@ morphology.prototype.getResults = function(parameters, userKey, protocol, servic req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } } - }; module.exports = morphology; diff --git a/lib/nameDeduplication.js b/lib/nameDeduplication.js index 49c8284..486a957 100644 --- a/lib/nameDeduplication.js +++ b/lib/nameDeduplication.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function nameDeduplication() { @@ -51,7 +51,6 @@ nameDeduplication.prototype.getResults = function(parameters, userKey, protocol, req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } } - }; module.exports = nameDeduplication; diff --git a/lib/nameSimilarity.js b/lib/nameSimilarity.js index 58f8cc6..ea9228d 100644 --- a/lib/nameSimilarity.js +++ b/lib/nameSimilarity.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function nameSimilarity() { @@ -41,7 +41,6 @@ nameSimilarity.prototype.getResults = function(parameters, userKey, protocol, se if (parameters.documentFile != null) { return callback(new RosetteException("badArgument", "Name similarity does not support documentFile", "bad arguments")); } else { - // validate parameters if (!parameters.loadParams().name1 || !parameters.loadParams().name2) { return callback(new RosetteException("badArgument", "Must supply both name1 and name2 parameters to be matched.")); @@ -52,7 +51,6 @@ nameSimilarity.prototype.getResults = function(parameters, userKey, protocol, se req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } } - }; module.exports = nameSimilarity; diff --git a/lib/nameTranslation.js b/lib/nameTranslation.js index d6594a4..c2f4ccf 100644 --- a/lib/nameTranslation.js +++ b/lib/nameTranslation.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function nameTranslation() { @@ -41,7 +41,6 @@ nameTranslation.prototype.getResults = function(parameters, userKey, protocol, s if (parameters.documentFile != null) { return callback(new RosetteException("badArgument", "Name translation does not support documentFile", "bad arguments")); } else { - // validate parameters if (!parameters.loadParams().name) { return callback(new RosetteException("badArgument", "Must supply name parameter", "bad arguments")); @@ -54,7 +53,6 @@ nameTranslation.prototype.getResults = function(parameters, userKey, protocol, s req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } } - }; module.exports = nameTranslation; diff --git a/lib/parameters.js b/lib/parameters.js index 65dd743..ec4ce44 100644 --- a/lib/parameters.js +++ b/lib/parameters.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -35,7 +35,7 @@ var BINDING_VERSION = "1.1"; /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function parameters() { diff --git a/lib/ping.js b/lib/ping.js index 6730053..cada39b 100644 --- a/lib/ping.js +++ b/lib/ping.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function ping() { diff --git a/lib/relationships.js b/lib/relationships.js index 7df82cc..6c59105 100644 --- a/lib/relationships.js +++ b/lib/relationships.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function relationships() { @@ -41,20 +41,18 @@ relationships.prototype.getResults = function(parameters, userKey, protocol, ser if (parameters.documentFile != null) { parameters.loadFile(parameters.documentFile, parameters, userKey, protocol, serviceURL, "relationships", callback); } else { - // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); } else if (parameters.loadParams().content && parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Cannot supply both Content and ContentUri", "bad arguments")); + } else { + // configure URL + var urlParts = URL.parse(serviceURL + "relationships"); + var req = new rosetteRequest(); + req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } - - // configure URL - var urlParts = URL.parse(serviceURL + "relationships"); - var req = new rosetteRequest(); - req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } - }; module.exports = relationships; diff --git a/lib/rosetteConstants.js b/lib/rosetteConstants.js index c3c3fcc..6a920a7 100644 --- a/lib/rosetteConstants.js +++ b/lib/rosetteConstants.js @@ -1,7 +1,7 @@ /** * Container for the Rosette Constants. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 diff --git a/lib/rosetteExceptions.js b/lib/rosetteExceptions.js index e407a88..3b9841e 100644 --- a/lib/rosetteExceptions.js +++ b/lib/rosetteExceptions.js @@ -1,7 +1,7 @@ /** * RosetteException. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 diff --git a/lib/rosetteRequest.js b/lib/rosetteRequest.js index 418f554..c890807 100644 --- a/lib/rosetteRequest.js +++ b/lib/rosetteRequest.js @@ -34,7 +34,7 @@ var USER_AGENT = "rosetteapinode/" + BINDING_VERSION + "/" + process.version; /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function rosetteRequest() { diff --git a/lib/sentences.js b/lib/sentences.js index 874f12c..eba135b 100644 --- a/lib/sentences.js +++ b/lib/sentences.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function sentences() { @@ -41,7 +41,6 @@ sentences.prototype.getResults = function(parameters, userKey, protocol, service if (parameters.documentFile != null) { parameters.loadFile(parameters.documentFile, parameters, userKey, protocol, serviceURL, "sentences", callback); } else { - // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); @@ -54,7 +53,6 @@ sentences.prototype.getResults = function(parameters, userKey, protocol, service req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } } - }; module.exports = sentences; diff --git a/lib/sentiment.js b/lib/sentiment.js index fd6da04..118a03f 100644 --- a/lib/sentiment.js +++ b/lib/sentiment.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function sentiment() { @@ -41,14 +41,12 @@ sentiment.prototype.getResults = function(parameters, userKey, protocol, service if (parameters.documentFile != null) { parameters.loadFile(parameters.documentFile, parameters, userKey, protocol, serviceURL, "sentiment", callback); } else { - // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); } else if (parameters.loadParams().content && parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Cannot supply both Content and ContentUri", "bad arguments")); } else { - // configure URL var urlParts = URL.parse(serviceURL + "sentiment"); var req = new rosetteRequest(); diff --git a/lib/syntax_dependencies.js b/lib/syntax_dependencies.js index f327a14..9e59301 100644 --- a/lib/syntax_dependencies.js +++ b/lib/syntax_dependencies.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function syntax_dependencies() { @@ -40,10 +40,8 @@ syntax_dependencies.prototype.getResults = function(parameters, userKey, protoco if (parameters.documentFile != null) { parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, protocol, serviceURL, "syntax/dependencies", callback); - } else { - - // validate parameters + // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); } else if (parameters.loadParams().content && parameters.loadParams().contentUri) { @@ -51,14 +49,10 @@ syntax_dependencies.prototype.getResults = function(parameters, userKey, protoco } 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; diff --git a/lib/textEmbedding.js b/lib/textEmbedding.js index 4b1f69e..39c0e84 100644 --- a/lib/textEmbedding.js +++ b/lib/textEmbedding.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function textEmbedding() { @@ -41,8 +41,7 @@ textEmbedding.prototype.getResults = function(parameters, userKey, protocol, ser if (parameters.documentFile != null) { parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, protocol, serviceURL, "text-embedding", callback); } else { - - // validate parameters + // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); } else if (parameters.loadParams().content && parameters.loadParams().contentUri) { @@ -54,7 +53,6 @@ textEmbedding.prototype.getResults = function(parameters, userKey, protocol, ser req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } } - }; module.exports = textEmbedding; diff --git a/lib/tokens.js b/lib/tokens.js index 1b052ea..05c3797 100644 --- a/lib/tokens.js +++ b/lib/tokens.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function tokens() { @@ -41,7 +41,6 @@ tokens.prototype.getResults = function(parameters, userKey, protocol, serviceURL if (parameters.documentFile != null) { parameters.loadFile(parameters.documentFile, parameters, userKey, protocol, serviceURL, "tokens", callback); } else { - // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); @@ -54,7 +53,6 @@ tokens.prototype.getResults = function(parameters, userKey, protocol, serviceURL req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } } - }; module.exports = tokens; diff --git a/lib/topics.js b/lib/topics.js index 24b6f08..67d13c5 100644 --- a/lib/topics.js +++ b/lib/topics.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function topics() { @@ -41,7 +41,6 @@ topics.prototype.getResults = function(parameters, userKey, protocol, serviceURL if (parameters.documentFile != null) { parameters.loadFile(parameters.documentFile, parameters, userKey, protocol, serviceURL, "topics", callback); } else { - // validate parameters if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); @@ -54,7 +53,6 @@ topics.prototype.getResults = function(parameters, userKey, protocol, serviceURL req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } } - }; module.exports = topics; diff --git a/lib/transliteration.js b/lib/transliteration.js index 8e68700..c1ec87a 100644 --- a/lib/transliteration.js +++ b/lib/transliteration.js @@ -1,7 +1,7 @@ /** * Rosette API. * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 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 @@ -22,7 +22,7 @@ var rosetteRequest = require("./rosetteRequest"); /** * @class * - * @copyright 2016-2017 Basis Technology Corporation. + * @copyright 2016-2018 Basis Technology Corporation. * @license http://www.apache.org/licenses/LICENSE-2.0 */ function transliteration() { @@ -41,18 +41,15 @@ transliteration.prototype.getResults = function(parameters, userKey, protocol, s if (parameters.documentFile != null) { parameters.loadFile(parameters.documentFile, parameters, userKey, protocol, serviceURL, "transliteration", callback); } else { - // validate parameters if (!parameters.loadParams().content) { return callback(new RosetteException("badArgument", "Must supply Content", "bad arguments")); } - // configure URL var urlParts = URL.parse(serviceURL + "transliteration"); var req = new rosetteRequest(); req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); } - }; module.exports = transliteration; From cdff079de11b824f9a0fa5f37e8ae097d2bd359b Mon Sep 17 00:00:00 2001 From: Ian Redpath Date: Wed, 16 Jan 2019 17:49:59 -0500 Subject: [PATCH 08/10] RD-2427 related terms endpoint (#71) * RD-2427 related terms endpoint * RD-2427 relatedTerms -> similarTerms, support both textEmbeddings and semanticVectors --- ...{text_embedding.js => semantic_vectors.js} | 0 examples/similar_terms.js | 27 ++++++++ index.js | 4 ++ lib/Api.js | 2 + lib/semanticVectors.js | 58 ++++++++++++++++ lib/similarTerms.js | 58 ++++++++++++++++ tests/unittests.js | 67 +++++++++++++++++-- 7 files changed, 210 insertions(+), 6 deletions(-) rename examples/{text_embedding.js => semantic_vectors.js} (100%) create mode 100644 examples/similar_terms.js create mode 100644 lib/semanticVectors.js create mode 100644 lib/similarTerms.js diff --git a/examples/text_embedding.js b/examples/semantic_vectors.js similarity index 100% rename from examples/text_embedding.js rename to examples/semantic_vectors.js diff --git a/examples/similar_terms.js b/examples/similar_terms.js new file mode 100644 index 0000000..53f6f83 --- /dev/null +++ b/examples/similar_terms.js @@ -0,0 +1,27 @@ + "use strict"; + + var Api = require("../lib/Api"); + var ArgumentParser = require("argparse").ArgumentParser; + + var parser = new ArgumentParser({ + addHelp: true, + description: "Get the terms similar to an input in other languages" + }); + 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 = "similarTerms"; + var data = "spy" + var options = {"resultLanguages": ["spa", "deu", "jpn"]} + + api.parameters.content = data; + api.parameters.options = options; + api.rosette(endpoint, function(err, res){ + if(err){ + console.log(err); + } else { + console.log(JSON.stringify(res, null, 2)); + } + }); \ No newline at end of file diff --git a/index.js b/index.js index a30d3bf..2977b22 100644 --- a/index.js +++ b/index.js @@ -29,3 +29,7 @@ module.exports.tokens = require("./lib/tokens"); module.exports.translatedName = require("./lib/nameTranslation"); module.exports.syntax_dependencies = require("./lib/syntax_dependencies"); + +module.exports.similarTerms = require("./lib/similarTerms"); + +module.exports.semanticVectors = require("./lib/semanticVectors"); diff --git a/lib/Api.js b/lib/Api.js index f2d38ad..23787e3 100644 --- a/lib/Api.js +++ b/lib/Api.js @@ -30,8 +30,10 @@ var morphology = require("./morphology"); var nameDeduplication = require("./nameDeduplication"); var ping = require("./ping"); var relationships = require("./relationships"); +var semanticVectors = require("./semanticVectors"); var sentences = require("./sentences"); var sentiment = require("./sentiment"); +var similarTerms = require("./similarTerms"); var syntax_dependencies = require("./syntax_dependencies"); var textEmbedding = require("./textEmbedding"); var tokens = require("./tokens"); diff --git a/lib/semanticVectors.js b/lib/semanticVectors.js new file mode 100644 index 0000000..350dc22 --- /dev/null +++ b/lib/semanticVectors.js @@ -0,0 +1,58 @@ +/** + * Rosette API. + * + * @copyright 2016-2018 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 2016-2018 Basis Technology Corporation. + * @license http://www.apache.org/licenses/LICENSE-2.0 + */ +function semanticVectors() { + +}; + +/** + * 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 + */ +semanticVectors.prototype.getResults = function(parameters, userKey, protocol, serviceURL, callback) { + + if (parameters.documentFile != null) { + parameters.loadFile(parameters.loadParams().documentFile, parameters, userKey, protocol, serviceURL, "semantics/vector", callback); + } else { + // validate parameters + if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { + return callback(new RosetteException("badArgument", "Must supply one of Content or ContentUri", "bad arguments")); + } else if (parameters.loadParams().content && parameters.loadParams().contentUri) { + return callback(new RosetteException("badArgument", "Cannot supply both Content and ContentUri", "bad arguments")); + } else { + // configure URL + var urlParts = URL.parse(serviceURL + "semantics/vector"); + var req = new rosetteRequest(); + req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); + } + } +}; + +module.exports = semanticVectors; diff --git a/lib/similarTerms.js b/lib/similarTerms.js new file mode 100644 index 0000000..9ec2e8e --- /dev/null +++ b/lib/similarTerms.js @@ -0,0 +1,58 @@ +/** + * Rosette API. + * + * @copyright 2018 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 2018 Basis Technology Corporation. + * @license http://www.apache.org/licenses/LICENSE-2.0 + */ +function similarTerms() { + +}; + +/** + * 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 + */ +similarTerms.prototype.getResults = function(parameters, userKey, protocol, serviceURL, callback) { + + if (parameters.documentFile != null) { + parameters.loadFile(parameters.documentFile, parameters, userKey, protocol, serviceURL, "semantics/similar", callback); + } else { + // validate parameters + if (!parameters.loadParams().content && !parameters.loadParams().contentUri) { + 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 content and contentUri", "bad arguments")); + } else { + // configure URL + var urlParts = URL.parse(serviceURL + "semantics/similar"); + var req = new rosetteRequest(); + req.makeRequest('POST', userKey, protocol, urlParts, parameters, callback); + } + } +}; + +module.exports = similarTerms; \ No newline at end of file diff --git a/tests/unittests.js b/tests/unittests.js index c46f339..426358d 100644 --- a/tests/unittests.js +++ b/tests/unittests.js @@ -18,6 +18,8 @@ var morphology = require("../lib/morphology"); var tokens = require("../lib/tokens"); var topics = require("../lib/topics"); var sentences = require("../lib/sentences"); +var similarTerms = require("../lib/similarTerms"); +var semanticVectors = require("../lib/semanticVectors"); var info = require("../lib/info"); var ping = require("../lib/ping"); var syntax_dependencies = require("../lib/syntax_dependencies"); @@ -686,12 +688,65 @@ describe("Sentences Endpoint", function() { }); }); -describe("Text Embedding Endpoint", function() { +describe("Similar Terms Endpoint", function() { beforeEach(function(done) { var mockResponse = JSON.stringify({'name': 'Rosette API', 'versionChecked': true}); nock('https://api.rosette.com', {"encodedQueryParams": true }) - .post('/rest/v1/text-embedding') + .post('/rest/v1/semantics/similar') + .query({"clientVersion": "1.1"}) + .reply(200, JSON.parse(mockResponse)); + done() + }); + + afterEach(function(done) { + nock.cleanAll(); + done(); + }); + + it("successfully calls the similarTerms endpoint", function(done) { + var api = new Api('123456789', 'https://api.rosette.com/rest/v1'); + api.parameters.content = "Some Content"; + + api.rosette("similarTerms", function(err, res) { + chai.expect(err).to.be.null; + chai.expect(res.name).to.equal('Rosette API'); + done(); + }); + + }); + + it("detects content and contentUri are defined", function(done) { + var api = new Api('123456789', 'https://api.rosette.com/rest/v1'); + api.parameters.content = "Sample Content"; + api.parameters.contentUri = "http://some.url.com"; + + api.rosette("similarTerms", function(err, res) { + chai.expect(err).to.not.be.null; + chai.expect(err.name).to.equal('RosetteException'); + chai.expect(err.message).to.contain('badArgument'); + done(); + }); + }); + + it("detects neither content nor contentUri are defined", function(done) { + var api = new Api('123456789', 'https://api.rosette.com/rest/v1'); + + api.rosette("similarTerms", function(err, res) { + chai.expect(err).to.not.be.null; + chai.expect(err.name).to.equal('RosetteException'); + chai.expect(err.message).to.contain('badArgument'); + done(); + }); + }); +}); + +describe("Semantic Vectors Endpoint", function() { + beforeEach(function(done) { + var mockResponse = JSON.stringify({'name': 'Rosette API', 'versionChecked': true}); + + nock('https://api.rosette.com', {"encodedQueryParams": true }) + .post('/rest/v1/semantics/vector') .query({"clientVersion": "1.1"}) .reply(200, JSON.parse(mockResponse)); done(); @@ -702,11 +757,11 @@ describe("Text Embedding Endpoint", function() { done(); }); - it("successfully calls the textEmbedding endpoint", function(done) { + it("successfully calls the semanticVectors endpoint", function(done) { var api = new Api('123456789', 'https://api.rosette.com/rest/v1'); api.parameters.content = "Some Content"; - api.rosette("textEmbedding", function(err, res) { + api.rosette("semanticVectors", function(err, res) { chai.expect(err).to.be.null; chai.expect(res.name).to.equal('Rosette API'); done(); @@ -719,7 +774,7 @@ describe("Text Embedding Endpoint", function() { api.parameters.content = "Sample Content"; api.parameters.contentUri = "http://some.url.com"; - api.rosette("textEmbedding", function(err, res) { + api.rosette("semanticVectors", function(err, res) { chai.expect(err).to.not.be.null; chai.expect(err.name).to.equal('RosetteException'); chai.expect(err.message).to.contain('badArgument'); @@ -730,7 +785,7 @@ describe("Text Embedding Endpoint", function() { it("detects neither content nor contentUri are defined", function(done) { var api = new Api('123456789', 'https://api.rosette.com/rest/v1'); - api.rosette("textEmbedding", function(err, res) { + api.rosette("semanticVectors", function(err, res) { chai.expect(err).to.not.be.null; chai.expect(err.name).to.equal('RosetteException'); chai.expect(err.message).to.contain('badArgument'); From befa4787ca9186cde7f1fda0456e89b7460c3de3 Mon Sep 17 00:00:00 2001 From: seth-basistech Date: Tue, 22 Jan 2019 11:44:14 -0600 Subject: [PATCH 09/10] RD-2427: Example data replacement vars. (#72) --- examples/semantic_vectors.js | 4 ++-- examples/similar_terms.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/semantic_vectors.js b/examples/semantic_vectors.js index c042a5f..be66c41 100644 --- a/examples/semantic_vectors.js +++ b/examples/semantic_vectors.js @@ -13,9 +13,9 @@ var args = parser.parseArgs(); var api = new Api(args.key, args.url); var endpoint = "textEmbedding"; -var embeddings_data = "Cambridge, Massachusetts" +var semantic_vectors_data = "Cambridge, Massachusetts" -api.parameters.content = embeddings_data; +api.parameters.content = semantic_vectors_data; api.rosette(endpoint, function(err, res){ if(err){ console.log(err); diff --git a/examples/similar_terms.js b/examples/similar_terms.js index 53f6f83..199934f 100644 --- a/examples/similar_terms.js +++ b/examples/similar_terms.js @@ -13,10 +13,10 @@ var api = new Api(args.key, args.url); var endpoint = "similarTerms"; - var data = "spy" + var similar_terms_data = "spy" var options = {"resultLanguages": ["spa", "deu", "jpn"]} - api.parameters.content = data; + api.parameters.content = similar_terms_data; api.parameters.options = options; api.rosette(endpoint, function(err, res){ if(err){ From 4303bd8adb08903ffb69ea413002ebfa1d2216d2 Mon Sep 17 00:00:00 2001 From: Seth Gransky Date: Wed, 6 Feb 2019 22:52:14 +0000 Subject: [PATCH 10/10] Version 1.12.1 --- lib/rosetteRequest.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rosetteRequest.js b/lib/rosetteRequest.js index c890807..5e38619 100644 --- a/lib/rosetteRequest.js +++ b/lib/rosetteRequest.js @@ -28,7 +28,7 @@ var querystring = require('querystring'); * * @type string */ -var BINDING_VERSION = "1.9.1-devel"; +var BINDING_VERSION = "1.12.1"; var USER_AGENT = "rosetteapinode/" + BINDING_VERSION + "/" + process.version; /** diff --git a/package.json b/package.json index 4389808..3163e65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rosette-api", - "version": "1.9.1-devel", + "version": "1.12.1", "description": "Rosette API Node.js client SDK", "main": "index", "directories": {