Skip to content

Commit d18fd61

Browse files
authored
Merge pull request #83 from rosette-api/WS-3330-update-node-with-latest-changes
Ws 3330 update node with latest changes
2 parents 6065004 + a240d4e commit d18fd61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1100
-915
lines changed

.eslintrc.json

Lines changed: 0 additions & 131 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Dependency directory
22
node_modules
33

4+
coverage
5+
.nyc_output
46
target
57

68
.grunt

CI.Jenkinsfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
node ("docker-light") {
2+
def sourceDir = pwd()
3+
def nodeVersions = ["18", "20", "22", "23"]
4+
try {
5+
stage("Clean up") {
6+
step([$class: 'WsCleanup'])
7+
}
8+
stage("Checkout Code") {
9+
checkout scm
10+
}
11+
stage("Build And Test") {
12+
13+
withSonarQubeEnv {
14+
mySonarOpts="-Dsonar.login=${env.SONAR_AUTH_TOKEN} -Dsonar.host.url=${env.SONAR_HOST_URL}"
15+
if("${env.CHANGE_ID}" != "null"){
16+
mySonarOpts = "$mySonarOpts -Dsonar.pullrequest.key=${env.CHANGE_ID} -Dsonar.pullrequest.branch=${env.BRANCH_NAME}"
17+
} else {
18+
mySonarOpts = "$mySonarOpts -Dsonar.branch.name=${env.BRANCH_NAME}"
19+
}
20+
if ("${env.CHANGE_BRANCH}" != "null") {
21+
mySonarOpts="$mySonarOpts -Dsonar.pullrequest.base=${env.CHANGE_TARGET} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH}"
22+
}
23+
24+
nodeVersions.each { version ->
25+
if (version == "23") {
26+
sonarScannerVersion="6.2.1.4610-linux-x64"
27+
sonarExec="cd /root/ && \
28+
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${sonarScannerVersion}.zip && \
29+
unzip -q sonar-scanner-cli-${sonarScannerVersion}.zip && \
30+
cd /source && \
31+
/root/sonar-scanner-${sonarScannerVersion}/bin/sonar-scanner ${mySonarOpts}"
32+
} else {
33+
sonarExec="echo Skipping Sonar for this version."
34+
}
35+
36+
sh "docker run --rm \
37+
--pull always \
38+
--volume ${sourceDir}:/source \
39+
node:${version} \
40+
sh -c \"cd /source && \
41+
npm install && \
42+
npx grunt && \
43+
${sonarExec} && \
44+
chown -R 9960:9960 /source\""
45+
}
46+
}
47+
}
48+
postToTeams(true)
49+
} catch (e) {
50+
currentBuild.result = "FAILED"
51+
postToTeams(false)
52+
throw e
53+
}
54+
}
55+
56+
def postToTeams(boolean success) {
57+
def webhookUrl = "${env.TEAMS_PNC_JENKINS_WEBHOOK_URL}"
58+
def color = success ? "#00FF00" : "#FF0000"
59+
def status = success ? "SUCCESSFUL" : "FAILED"
60+
def message = "*" + status + ":* '${env.JOB_NAME}' - [${env.BUILD_NUMBER}] - ${env.BUILD_URL}"
61+
office365ConnectorSend(webhookUrl: webhookUrl, color: color, message: message, status: status)
62+
}

Gruntfile.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = function(grunt) {
2424
}
2525
}
2626
},
27-
mochaTest: {
27+
mochaTest: {
2828
test: {
2929
options: {
3030
reporter: 'spec',
@@ -34,6 +34,17 @@ module.exports = function(grunt) {
3434
src: ['tests/**/*.js']
3535
}
3636
},
37+
nyc: {
38+
cover: {
39+
options: {
40+
include: ['lib/**/*.js'],
41+
reporter: ['html', 'lcov'],
42+
reportDir: 'coverage'
43+
},
44+
cmd: false,
45+
args: ['grunt', 'mochaTest']
46+
}
47+
},
3748
'gh-pages': {
3849
options: {
3950
base: 'target/html'
@@ -54,14 +65,16 @@ module.exports = function(grunt) {
5465

5566
// These plugins provide necessary tasks.
5667
grunt.loadNpmTasks("grunt-contrib-clean");
57-
grunt.loadNpmTasks("grunt-contrib-watch");;
68+
grunt.loadNpmTasks("grunt-contrib-watch");
5869
grunt.loadNpmTasks("grunt-jsdoc");
5970
grunt.loadNpmTasks('grunt-mocha-test');
6071
grunt.loadNpmTasks('grunt-gh-pages');
72+
grunt.loadNpmTasks('grunt-simple-nyc');
6173

6274
// Task definitions.
6375
// run `grunt <task>` in command line and it will run the sequence in brackets
64-
grunt.registerTask("default", ["clean","jsdoc", "test"]);
76+
grunt.registerTask("default", ["clean","jsdoc", "nyc:cover"]);
6577
grunt.registerTask("doc", ["jsdoc", "gh-pages"]);
6678
grunt.registerTask("test", ["mochaTest"]);
79+
grunt.registerTask("coverage", ["nyc:cover"]);
6780
};

README.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,47 @@
1-
<a href="https://www.babelstreet.com/rosette"><img src="https://s3.amazonaws.com/styleguide.basistech.com/logos/rosette-logo.png" width="181" height="47" /></a>
1+
<a href="https://www.babelstreet.com/rosette">
2+
<picture>
3+
<source media="(prefers-color-scheme: light)" srcset="https://charts.babelstreet.com/icon-dark.png">
4+
<source media="(prefers-color-scheme: dark)" srcset="https://charts.babelstreet.com/icon-light.png">
5+
<img src="https://charts.babelstreet.com/icon-dark.png" alt="Babel Street Logo" width="48" height="48">
6+
</picture>
7+
</a>
28

39
---
410

511
[![npm version](https://badge.fury.io/js/rosette-api.svg)](https://badge.fury.io/js/rosette-api)
612
![node engine](https://img.shields.io/node/v/rosette-api.svg)
713

8-
## Rosette API
9-
The Rosette Text Analytics Platform uses natural language processing, statistical modeling, and machine learning to
10-
analyze unstructured and semi-structured text across 364 language-encoding-script combinations, revealing valuable
11-
information and actionable data. Rosette provides endpoints for extracting entities and relationships, translating and
12-
comparing the similarity of names, categorizing and adding linguistic tags to text and more.
14+
## Analytics by Babel Street
15+
Our product is a full text processing pipeline from data preparation to extracting the most relevant information and
16+
analysis utilizing precise, focused AI that has built-in human understanding. Text Analytics provides foundational
17+
linguistic analysis for identifying languages and relating words. The result is enriched and normalized text for
18+
high-speed search and processing without translation.
1319

14-
## Rosette API Access
15-
- Rosette Cloud [Sign Up](https://developer.rosette.com/signup)
20+
Text Analytics extracts events and entities — people, organizations, and places — from unstructured text and adds the
21+
structure of associating those entities into events that deliver only the necessary information for near real-time
22+
decision making. Accompanying tools shorten the process of training AI models to recognize domain-specific events.
23+
24+
The product delivers a multitude of ways to sharpen and expand search results. Semantic similarity expands search
25+
beyond keywords to words with the same meaning, even in other languages. Sentiment analysis and topic extraction help
26+
filter results to what’s relevant.
27+
28+
## Analytics API Access
29+
- Analytics Cloud [Sign Up](https://developer.babelstreet.com/signup)
1630

1731
## Quick Start
1832

1933
#### Installation
2034
`npm install rosette-api`
2135

2236
#### Examples
23-
View small example programs for each Rosette endpoint in the [examples](https://github.com/rosette-api/nodejs/tree/develop/examples) directory.
37+
View small example programs for each Analytics endpoint in the [examples](https://github.com/rosette-api/nodejs/tree/develop/examples) directory.
2438

2539
#### Documentation & Support
2640
- [Binding API](https://rosette-api.github.io/nodejs/)
27-
- [Rosette Platform API](https://developer.rosette.com/features-and-functions)
41+
- [Analytics Platform API](https://docs.babelstreet.com/API/en/index-en.html)
2842
- [Binding Release Notes](https://github.com/rosette-api/nodejs/wiki/Release-Notes)
29-
- [Rosette Platform Release Notes](https://support.rosette.com/hc/en-us/articles/360018354971-Release-Notes)
30-
- [Binding/Rosette Platform Compatibility](https://developer.rosette.com/features-and-functions?javascript#)
31-
- [Support](https://support.rosette.com)
43+
- [Analytics Platform Release Notes](https://docs.babelstreet.com/Release/en/rosette-cloud.html)
44+
- [Support](https://babelstreet.my.site.com/support/s/)
3245
- [Binding License: Apache 2.0](https://github.com/rosette-api/nodejs/blob/develop/LICENSE.txt)
3346

3447
## Binding Developer Information

eslint.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import globals from "globals";
2+
import pluginJs from "@eslint/js";
3+
4+
5+
/** @type {import('eslint').Linter.Config[]} */
6+
export default [
7+
{languageOptions: { globals: globals.node }},
8+
pluginJs.configs.recommended,
9+
];

examples/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
## Endpoint Examples
2-
Each example file demonstrates one of the capabilities of the Rosette Platform.
2+
Each example file demonstrates one of the capabilities of the Babel Street Analytics Platform.
33

44
Here are some methods for running the examples. Each example will also accept an optional `--url` parameter for
55
overriding the default URL.
66

7-
A note on prerequisites. Rosette API only supports TLS 1.2 so ensure your toolchain also supports it.
7+
A note on prerequisites. Analytics API only supports TLS 1.2 so ensure your toolchain also supports it.
88

99
#### Docker/Latest Release
1010
```

examples/address_similarity.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ var Api = require("../lib/Api");
44
var ArgumentParser = require("argparse").ArgumentParser;
55

66
var parser = new ArgumentParser({
7-
addHelp: true,
7+
add_help: true,
88
description: "Get the similarity score of two names"
99
});
10-
parser.addArgument(["--key"], {help: "Rosette API key", required: true});
11-
parser.addArgument(["--url"], {help: "Rosette API alt-url", required: false});
12-
var args = parser.parseArgs();
10+
parser.add_argument("--key", {help: "Analytics API key", required: true});
11+
parser.add_argument("--url", {help: "Analytics API alt-url", required: false});
12+
var args = parser.parse_args();
1313
var api = new Api(args.key, args.url);
1414
var endpoint = "addressSimilarity";
1515

examples/categories.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ var Api = require("../lib/Api");
44
var ArgumentParser = require("argparse").ArgumentParser;
55

66
var parser = new ArgumentParser({
7-
addHelp: true,
7+
add_help: true,
88
description: "Get the category of a piece of a document at a URL"
99
});
10-
parser.addArgument(["--key"], {help: "Rosette API key", required: true});
11-
parser.addArgument(["--url"], {help: "Rosette API alt-url", required: false});
12-
var args = parser.parseArgs();
10+
parser.add_argument("--key", {help: "Analytics API key", required: true});
11+
parser.add_argument("--url", {help: "Analytics API alt-url", required: false});
12+
var args = parser.parse_args();
1313
var api = new Api(args.key, args.url);
1414
var endpoint = "categories";
1515

examples/entities.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ var Api = require("../lib/Api");
44
var ArgumentParser = require("argparse").ArgumentParser;
55

66
var parser = new ArgumentParser({
7-
addHelp: true,
7+
add_help: true,
88
description: "Get the entities from a piece of text"
99
});
10-
parser.addArgument(["--key"], {help: "Rosette API key", required: true});
11-
parser.addArgument(["--url"], {help: "Rosette API alt-url", required: false});
12-
var args = parser.parseArgs();
10+
parser.add_argument("--key", {help: "Analytics API key", required: true});
11+
parser.add_argument("--url", {help: "Analytics API alt-url", required: false});
12+
var args = parser.parse_args();
1313

1414
var api = new Api(args.key, args.url);
1515
var endpoint = "entities";
@@ -18,9 +18,9 @@ var entities_text_data = "The Securities and Exchange Commission today announced
1818
api.parameters.content = entities_text_data;
1919

2020
api.rosette(endpoint, function(err, res){
21-
if(err){
22-
console.log(err);
23-
} else {
24-
console.log(JSON.stringify(res, null, 2));
25-
}
21+
if(err){
22+
console.log(err);
23+
} else {
24+
console.log(JSON.stringify(res, null, 2));
25+
}
2626
});

0 commit comments

Comments
 (0)