lib/salient/graph/document.js
function(err, results) {
        if (err) {
            callback(err);
            return;
        }
        
        var keyFrequency = parseInt(results[0]);
        var docFrequency = parseInt(results[1]);
        var keyDocFrequency = results[2];

        // ensure that key frequency is relative to the given document (when appropriate)
        if (id && results.length == 4) {
            keyFrequency = parseInt(results[3]);
        }
        var tf = 1 + (Math.log(keyFrequency) / Math.LN10);
        var idf = Math.log(docFrequency / keyDocFrequency) / Math.LN10;

        var result = {};
        result.key = key;
        result.rawtf = keyFrequency;
        result.df = keyDocFrequency;
        result.n = docFrequency;
        result.idf = idf;
        result.tf = tf;
        result.tfidf = tf * idf;
        callback(null, result);
    }
function(err, results) {
        if (err) {
            callback(err);
            return;
        }
        
        var keyFrequency = parseInt(results[0]);
        var docFrequency = parseInt(results[1]);
        var keyDocFrequency = results[2];

        // ensure that key frequency is relative to the given document (when appropriate)
        if (id && results.length == 4) {
            keyFrequency = parseInt(results[3]);
        }
        var tf = 1 + (Math.log(keyFrequency) / Math.LN10);
        var idf = Math.log(docFrequency / keyDocFrequency) / Math.LN10;

        var result = {};
        result.key = key;
        result.rawtf = keyFrequency;
        result.df = keyDocFrequency;
        result.n = docFrequency;
        result.idf = idf;
        result.tf = tf;
        result.tfidf = tf * idf;
        callback(null, result);
    }
function ( err , results ) { if ( err ) { callback ( err ) ; return ; } var keyFrequency = parseInt ( results [ 0 ] ) ; var docFrequency = parseInt ( results [ 1 ] ) ; var keyDocFrequency = results [ 2 ] ; // ensure that key frequency is relative to the given document (when appropriate) if ( id && results . length == 4 ) { keyFrequency = parseInt ( results [ 3 ] ) ; } var tf = 1 + ( Math . log ( keyFrequency ) / Math . LN10 ) ; var idf = Math . log ( docFrequency / keyDocFrequency ) / Math . LN10 ; var result = { } ; result . key = key ; result . rawtf = keyFrequency ; result . df = keyDocFrequency ; result . n = docFrequency ; result . idf = idf ; result . tf = tf ; result . tfidf = tf * idf ; callback ( null , result ) ; }
Executes and handles results returned from the multi redis command below
Executes and handles results returned from the multi redis command below