Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

orchestrator-core

Package Overview
Dependencies
Maintainers
5
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orchestrator-core - npm Package Compare versions

Comparing version 4.12.0-rc1.preview to 4.13.0-dev.20210223.19be149

49

oc_app.js

@@ -118,2 +118,46 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

// Add batch
var batch_json = `
{
"examples":
[
{
"text": "Is Not Time to Be Young showing at AMC threaters",
"intents":
[
{
"name": "movie",
"offset" : 0,
"length": 0
},
{
"name": "question",
"offset": 0,
"length": 0
}
],
"entities":
[
{
"name": "movie_name",
"offset": 3,
"length": 20
},
{
"name": "location_name",
"offset": 35,
"length": 13
}
]
}
]
}`
var num_new_elems = labeler.addBatch(batch_json);
console.log('---- Add Batch returned ' + num_new_elems)
var exles = labeler.getExamples();
console.log(util.inspect(exles, true, null, true /* enable colors */));
//

@@ -126,2 +170,7 @@ // Score

console.log('---- Scoring Batch')
var batch_text = [ 'hey', 'what is my schedule?', 'book a flight' ];
var batch_results = labeler.scoreBatch(batch_text, 1);
console.log(util.inspect(batch_results, true, null, true /* enable colors */));
//

@@ -128,0 +177,0 @@ // Score

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Orchestrator for Node.js",
"version": "4.12.0-rc1.preview",
"version": "4.13.0-dev.20210223.19be149",
"os": [

@@ -8,0 +8,0 @@ "darwin",

@@ -8,2 +8,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

require('fast-text-encoding');
const util = require('util')

@@ -420,3 +421,74 @@ // Finds onnx model

});
it('13) Add batch.', function () {
// Arrange
var labeler = this.orchestrator.createLabelResolver();
// Add batch
var batch_json = `
{
"examples":
[
{
"text": "Is Not Time to Be Young showing at AMC threaters",
"intents":
[
{
"name": "movie",
"offset" : 0,
"length": 0
},
{
"name": "question",
"offset": 0,
"length": 0
}
],
"entities":
[
{
"name": "movie_name",
"offset": 3,
"length": 20
},
{
"name": "location_name",
"offset": 35,
"length": 13
}
]
}
]
}`
// Test
var num_new_elems = labeler.addBatch(batch_json);
// Assert
assert.strictEqual(num_new_elems, 1, 'Failed to add batch');
var exles = labeler.getExamples();
assert.strictEqual(exles[0].text, 'Is Not Time to Be Young showing at AMC threaters', 'text not correct');
});
it('14) Batch score.', function () {
// Arrange
var labeler = this.orchestrator.createLabelResolver();
const example = {
label: 'travel',
text: 'book a flight to miami.',
};
const result = labeler.addExample(example);
// Act
var batch_text = [ 'hey', 'what is my schedule?', 'book a flight' ];
var batch_results = labeler.scoreBatch(batch_text, 1);
// Assert
// console.log(util.inspect(batch_results, true, null, true /* enable colors */));
assert.strictEqual(batch_results.length, 3, 'Not all results came back from batch score');
assert.strictEqual(batch_results[0][0].score == batch_results[1][0].score, false, 'Results should not be equal');
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc