lib/natural/classifiers/classifier.js
function(err) {
        if (err) {
            threadPool.destroy();
            return callback(err);
        }

        for (var j = self.lastAdded; j < totalDocs; j++) {
            self.classifier.addExample(docFeatures[j], self.docs[j].label);
            self.events.emit('trainedWithDocument', {
                index: j,
                total: totalDocs,
                doc: self.docs[j]
            });
            self.lastAdded++;
        }

        self.events.emit('doneTraining', true);
        self.classifier.train();

        threadPool.destroy();
        callback(null);
    }
function(err) {
        if (err) {
            threadPool.destroy();
            return callback(err);
        }

        for (var j = self.lastAdded; j < totalDocs; j++) {
            self.classifier.addExample(docFeatures[j], self.docs[j].label);
            self.events.emit('trainedWithDocument', {
                index: j,
                total: totalDocs,
                doc: self.docs[j]
            });
            self.lastAdded++;
        }

        self.events.emit('doneTraining', true);
        self.classifier.train();

        threadPool.destroy();
        callback(null);
    }
function ( err ) { if ( err ) { threadPool . destroy ( ) ; return callback ( err ) ; } for ( var j = self . lastAdded ; j < totalDocs ; j ++ ) { self . classifier . addExample ( docFeatures [ j ] , self . docs [ j ] . label ) ; self . events . emit ( 'trainedWithDocument' , { index : j , total : totalDocs , doc : self . docs [ j ] } ) ; self . lastAdded ++ ; } self . events . emit ( 'doneTraining' , true ) ; self . classifier . train ( ) ; threadPool . destroy ( ) ; callback ( null ) ; }
Called when all batches finish processing
Called when all batches finish processing