var Markov = require('./markov');

var sentenceStream = require('./stream/sentence');

function extract(options, stream, callback) {
    if (typeof stream === 'function') {
        callback = stream;
        stream = options;
        options = null;
    }
    var ss = sentenceStream(stream);
    var markov = new Markov(options);
    ss.on('data', function(sentence) {
        if (sentence.length > markov.stateSize) markov.addTokens(sentence);
    });
    ss.on('error', callback);
    ss.on('end', function() {
        callback(null, markov);
    });
}

module.exports = extract;

@@ -550,16 +550,556 @@
  %7D);%0A%7D%0A%0A
+extract.many = function(manyOptions, stream, callback) %7B%0A    var ss = sentenceStream(stream);%0A    var n = manyOptions.length;%0A    var markovs = new Array(n);%0A    for (var i=0; i%3Cn; i++) markovs%5Bi%5D = new Markov(manyOptions%5Bi%5D);%0A    ss.on('data', function(sentence) %7B%0A        for (var i=0; i%3Cn; i++) %7B%0A            var markov = markovs%5Bi%5D;%0A            if (sentence.length %3E markov.stateSize) markov.addTokens(sentence);%0A        %7D%0A    %7D);%0A    ss.on('error', callback);%0A    ss.on('end', function() %7B%0A        callback(null, markovs);%0A    %7D);%0A%7D;%0A%0A
 module.e

add many path