@petitchevalroux/vector-bow-one-hot

1.13.0 • Public • Published

#vector-bow-frequency Vectorize bag of words with words one hot

Usage

const Corpus = require("@petitchevalroux/corpus"),
    corpus = new Corpus(),
    VectorBowOneHot = require("@petitchevalroux/vector-bow-one-hot");

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

/@petitchevalroux/vector-bow-one-hot/

    Package Sidebar

    Install

    npm i @petitchevalroux/vector-bow-one-hot

    Weekly Downloads

    13

    Version

    1.13.0

    License

    ISC

    Unpacked Size

    58.1 kB

    Total Files

    18

    Last publish

    Collaborators

    • petitchevalroux