Skip to content

Commit 453f33e

Browse files
test: add test cases for contextual vectors
1 parent 11ae2b3 commit 453f33e

File tree

2 files changed

+84
-2
lines changed

2 files changed

+84
-2
lines changed

src/doc-v2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ var doc = function ( docData, addons ) {
537537
}
538538
}
539539

540-
}
540+
} else cv.size = Object.keys( cv.vectors ).length;
541541

542542
// Fill the balance space, if any, on the basis of wordVectorsLimit.
543543
for ( let i = 0; cv.size < wordVectorsLimit; i += 1 ) {
@@ -556,7 +556,7 @@ var doc = function ( docData, addons ) {
556556

557557
// Update the word index entry inside every vector.
558558
for ( let i = 0; i < cv.size; i += 1 ) cv.vectors[ cv.words[ i ] ][ cv.wordIndex ] = i;
559-
return JSON.stringify( cv, null, 2 );
559+
return JSON.stringify( cv );
560560
}; // contextualVectors()
561561

562562
// Published chainable methods.

test/contextual-vectors-specs.js

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)