qxencoder
v1.0.1
Published
Wrapper around tensorflowjs universal sentence encoder.
Downloads
1
Readme
qxencoder
Wrapper around tensorflowjs universal sentence encoder.
Installation
npm i qxencoder
Usage
const { encode, Encoder } = require('qxencoder');
(async () => {
const sentences = ['Hello', 'Bye'];
// Simple encoding
var embeddings = await encode(sentences);
console.log(embeddings.map(e => e.length));
// [ 512, 512 ]
// Encoder usage
// Works the same as above, but only load model once so slightly faster
var encoder = new Encoder();
await encoder.load();
embeddings = encoder.encode(sentences);
})();