qxencoder

1.0.1 • Public • Published

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);
 
})();

/qxencoder/

    Package Sidebar

    Install

    npm i qxencoder

    Weekly Downloads

    2

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    3.06 kB

    Total Files

    5

    Last publish

    Collaborators

    • gafo