Word count

node v8.17.0
version: master
endpointsharetweet
var qm = require('qminer');
var base = new qm.Base({ mode: 'createClean', schema: [{ name: 'tweets', fields: [{ name: 'text', type: 'string' }] }] }); let tweetStore = base.store('tweets');
tweetStore.push({text: "This pen is green."}); tweetStore.push({text: "This pen is yellow."}); tweetStore.push({text: "This pen is blue."}); tweetStore.push({text: "This marker is yellow."}); var tweets = tweetStore.allRecords; 'got ' + tweets.length + ' tweets';
let distribution = tweets.aggr({ name: "test", type: "keywords", field: "text" })
distribution.keywords.forEach((el) => { console.log(el.keyword, el.weight); });
Loading…

no comments

    sign in to comment