added a scorer

This commit is contained in:
Martin Donnelly 2017-05-31 15:55:01 +01:00
parent 9bb6b18d0c
commit 1f0ad1c58c

View File

@ -246,7 +246,7 @@ function scoreEntry(s) {
let score = 0;
let used = [];
for(let t of s) {
//console.log(t);
console.log(`processing: ${t}`);
if (!corpus.hasOwnProperty(t)) {
corpus[t] = {score:0, common:1};
@ -263,7 +263,7 @@ function scoreEntry(s) {
return score;
}
function processJson(j) {
console.log(j);
// console.log(j);
for (let item of j.items) {
console.log(item.title);
@ -332,7 +332,8 @@ function loadCorpus() {
jsonfile.readFile(fileName, function(err, obj) {
corpus = obj;
console.log('Corpus loaded');
let entries = Object.keys(corpus).length;
console.log(`Corpus loaded (${entries} entries)`);
doFeeds();
});
}