Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@petitchevalroux/vector-bow-frequency

petitchevalroux26ISC1.13.0

Vectorize bag of words with words frequency

nlp, vector, bow, bag, of, words

readme

vector-bow-frequency

Vectorize bag of words with words frequency

Usage

const Corpus = require("@petitchevalroux/corpus"),
    corpus = new Corpus(),
    VectorBowFrequency = require("@petitchevalroux/vector-bow-frequency");

corpus.addBow(["one", "two", "three"])
    .then(() => {
        const vectorBowFrequency = new VectorBowFrequency();
        return vectorBowFrequency.getVector(["one", "three", "one", "four"], corpus);
    })
    .then(vector => {
        console.log(vector); // [2,0,1]
    });