orchestrator-core
Advanced tools
Comparing version 4.11.2-dev.20201120.7bf4655 to 4.11.2-dev.20201124.2a8d3e7
@@ -5,3 +5,3 @@ { | ||
"description": "Orchestrator for Node.js", | ||
"version": "4.11.2-dev.20201120.7bf4655", | ||
"version": "4.11.2-dev.20201124.2a8d3e7", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
@@ -101,4 +101,4 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
it('0) Create BLU file example.', function () { | ||
this.timeout(1000000); | ||
it('00) Create BLU file example -- VA.txt', function () { | ||
this.timeout(10000000); | ||
// Arrange | ||
@@ -129,3 +129,2 @@ var orc = new oc.Orchestrator(); | ||
}; | ||
var result = labeler.addExample(example); | ||
@@ -141,3 +140,2 @@ } | ||
}); | ||
} catch(e) { | ||
@@ -147,2 +145,84 @@ console.log('Error:', e.stack); | ||
}); | ||
it('01) Create BLU file example -- Email.txt', function () { | ||
this.timeout(1000000); | ||
// Arrange | ||
var orc = new oc.Orchestrator(); | ||
var onnx_dir = findOnnxDir(1); | ||
orc.load(onnx_dir); | ||
var labeler = orc.createLabelResolver(); | ||
try { | ||
const snapshotPath = path.join(__dirname, 'snapshot', 'Email.txt'); | ||
var data = fs.readFileSync(snapshotPath, 'utf8'); | ||
console.log('OPENING FILE ' + snapshotPath); | ||
var lines = data.split(/\r?\n/); | ||
var skipfirst = false; | ||
for (let line of lines) { | ||
if (!line.trim()) { | ||
continue; | ||
} | ||
// console.log(line); | ||
tokens = line.split('\t'); | ||
if (skipfirst) | ||
skipfirst = false; | ||
else | ||
{ | ||
var example = { | ||
label: tokens[0], | ||
text: tokens[1], | ||
}; | ||
var result = labeler.addExample(example); | ||
} | ||
} | ||
var snapshot = labeler.createSnapshot(); | ||
console.log('Created snapshot!'); | ||
const outputSnapshotPath = path.join(__dirname, 'snapshot', 'Email_snapshot.blu'); | ||
fs.writeFile(outputSnapshotPath, snapshot, (err) => { | ||
if (err) { throw err; } | ||
console.log('Snapshot saved!' + outputSnapshotPath); | ||
}); | ||
} catch(e) { | ||
console.log('Error:', e.stack); | ||
} | ||
}); | ||
it('02) Create BLU file example -- EmailTest.txt', function () { | ||
this.timeout(1000000); | ||
// Arrange | ||
var orc = new oc.Orchestrator(); | ||
var onnx_dir = findOnnxDir(1); | ||
orc.load(onnx_dir); | ||
var labeler = orc.createLabelResolver(); | ||
try { | ||
const snapshotPath = path.join(__dirname, 'snapshot', 'EmailTest.txt'); | ||
var data = fs.readFileSync(snapshotPath, 'utf8'); | ||
console.log('OPENING FILE ' + snapshotPath); | ||
var lines = data.split(/\r?\n/); | ||
var skipfirst = false; | ||
for (let line of lines) { | ||
if (!line.trim()) { | ||
continue; | ||
} | ||
// console.log(line); | ||
tokens = line.split('\t'); | ||
if (skipfirst) | ||
skipfirst = false; | ||
else | ||
{ | ||
var example = { | ||
label: tokens[0], | ||
text: tokens[1], | ||
}; | ||
var result = labeler.addExample(example); | ||
} | ||
} | ||
var snapshot = labeler.createSnapshot(); | ||
console.log('Created snapshot!'); | ||
const outputSnapshotPath = path.join(__dirname, 'snapshot', 'EmailTest_snapshot.blu'); | ||
fs.writeFile(outputSnapshotPath, snapshot, (err) => { | ||
if (err) { throw err; } | ||
console.log('Snapshot saved!' + outputSnapshotPath); | ||
}); | ||
} catch(e) { | ||
console.log('Error:', e.stack); | ||
} | ||
}); | ||
@@ -276,3 +356,2 @@ it('1) should succeed creating orchestrator.', function () { | ||
}; | ||
// Test | ||
@@ -299,7 +378,5 @@ const result = labeler.addExample(example); | ||
fs.appendFileSync(snapshot_file, Buffer.from(snapshot)); | ||
// Act | ||
var labeler2 = this.orchestrator.createLabelResolver(); | ||
result = labeler2.addSnapshot(fs.readFileSync(snapshot_file, null)); | ||
// Assert | ||
@@ -319,3 +396,2 @@ assert.strictEqual(result, true, 'Failed to add snapshot'); | ||
}; | ||
// Test | ||
@@ -344,3 +420,2 @@ var result = labeler.addExample(example); | ||
length: 0 } } ] }; | ||
// Test | ||
@@ -347,0 +422,0 @@ var result = labeler.addExample(example); |
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
Sorry, the diff of this file is not supported yet
819427
680