-
Notifications
You must be signed in to change notification settings - Fork 4
/
CreateHeadlines.js
55 lines (45 loc) · 1.48 KB
/
CreateHeadlines.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
let sources = require("./data/sources.json");
let articles = require("./data/articles.json");
let Download = require('./Includes/Download.js');
let ArticleScanner = require('./Includes/ArticleScanner.js');
let LinkScanner = require('./Includes/LinkScanner.js');
let Article = require('./Includes/Article.js');
let Link = require('./Includes/Link.js');
let DataManager = require('./Includes/DataManager.js');
let DataAPI = require('./Includes/DataAPI.js');
let HeadlineWriter = require('./Includes/HeadlineWriter.js');
let config = require("./data/config.json");
//End imports
let dm = new DataManager(config.redisPort, function()
{
let api = new DataAPI(dm.client);
let hw = new HeadlineWriter(api);
hw.getClusteredWords(30, 1.2, 10, function(result)
{
let hls = [];
for(let i in result)
{
let hl = [];
for(let r = 0; r < result[i].relations.length; r++)
{
hl.push(result[i].relations[r].word);
}
hl.unshift(result[i].word);
let found = false;
for(let a in hls)
{
if(hw.getDistance(hls[a], hl) <= 1)
{
console.log("Same:");
console.log(hls[a]);
console.log(hl);
found = true;
break;
}
}
if(found == false)
hls.push(hl);
}
console.log(hls);
});
});