Skip to content

Instantly share code, notes, and snippets.

@mutatrum
Created January 30, 2021 15:14
Show Gist options
  • Save mutatrum/3c8f0cb65a7a9b10bd4acaa05358680f to your computer and use it in GitHub Desktop.
Save mutatrum/3c8f0cb65a7a9b10bd4acaa05358680f to your computer and use it in GitHub Desktop.
const fs = require('fs');
const readline = require('readline');
var english = fs.readFileSync('english.txt', 'utf8').split("\n")
const readInterface = readline.createInterface({
input: fs.createReadStream('coinbase.txt'),
console: false
});
var done = [];
readInterface.on('line', function(line) {
if (line.length < 5) return;
var split = line.toLowerCase().match(/(\b[a-z][a-z][a-z]+|\b[a-z][a-z]\b)/g);
if (split) {
var e = false;
var r = [];
for (var p of split) {
if (english.includes(p)) {
r.push(p);
}
}
if (r.length != 0) {
r.sort();
var t = r.join(' ');
if (!done.includes(t)) {
done.push(t);
console.log(line);
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment