readline = require('readline');
const fs = require('fs');
const crypto = require('crypto');

function hash(data) {
  return crypto.createHash("sha256").update(data).digest("base64");
}

const input = readline.createInterface({
  input: fs.createReadStream(process.argv[2])
});

var lines = []

input.on('line', line => {
  lines.push(line.trim());
});

input.on('close', () => {
  console.log(lines.join("\n"));
});


@@ -1,16 +1,22 @@
+const 
 readline = requi
@@ -189,231 +189,1578 @@
 %0A%7D%0A%0A
-const input = readline.createInterface(%7B%0A  input: fs.createReadStream(process.argv%5B2%5D)%0A%7D);%0A%0Avar lines = %5B%5D%0A%0Ainput.on('line', line =%3E %7B%0A  lines.push(line.trim());%0A%7D);%0A%0Ainput.on('close', () =%3E %7B%0A  console.log(lines.join(%22%5Cn%22)
+function getSentences(paragraph) %7B%0A  var sentences = %5B%5D;%0A  var currentSentence = '';%0A  var words = paragraph.split(' ');%0A  let word;%0A  while (word = words.shift()) %7B%0A    if (!word) %7B%0A      continue;%0A    %7D%0A    currentSentence += word + ' ';%0A    if ((word.endsWith('.') %7C%7C word.endsWith('!') %7C%7C word.endsWith('?')) &&%0A      word !== 'Mr.' && word !== 'Mrs.') %7B%0A      sentences.push(currentSentence.trim());%0A      currentSentence = '';%0A    %7D%0A  %7D%0A  return sentences;%0A%7D%0A%0Alet infile = process.argv%5B2%5D;%0Alet outfile = process.argv%5B3%5D;%0Aif (!infile) %7B%0A  console.error('no input file specified');%0A  process.exit(1);%0A%7D%0Aif (!outfile) %7B%0A  console.error('no output file specified');%0A  process.exit(1);%0A%7D%0A%0Alet lines = %5B%5D%0Alet currentParagraph = '';%0A%0Alet input = readline.createInterface(%7B%0A  input: fs.createReadStream(infile)%0A%7D);%0A%0Ainput.on('line', line =%3E %7B%0A  if (!line %7C%7C line.length %3C 1) %7B%0A    lines = lines.concat(getSentences(currentParagraph));%0A    currentParagraph = '';%0A    return;%0A  %7D%0A  currentParagraph += line;%0A%7D);%0A%0Ainput.on('close', () =%3E %7B%0A  lines = lines.filter(s =%3E %7B%0A    var words = s.split(' ');%0A    /*%0A    words.forEach(w =%3E %7B%0A      try %7B%0A        w && wordnet.lookup(w, (err, def) =%3E %7B%0A          if (err) %7B%0A            console.log('error', w, err);%0A          %7D%0A        %7D);%0A      %7D catch (err) %7B%0A        console.log('bad word', w, err);%0A      %7D%0A    %7D);%0A    */%0A%0A    var spaces = words.length - 1;%0A    if (spaces %3C 3 %7C%7C spaces %3E 15) %7B%0A      return false;%0A    %7D%0A%0A    return true;%0A  %7D);%0A  fs.writeFileSync(outfile, lines.join(%22%5Cn%22));%0A  console.log('wrote lines', lines.length
 );%0A%7D

update the sentence exractor