-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
129 lines (99 loc) · 4.03 KB
/
Main.java
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import api.twitter.TweetElaborator;
import controller.*;
import model.*;
import weka.clusterers.SimpleKMeans;
import java.util.ArrayList;
public class Main {
private static double sogliaMinimaLink = 0.2;
// settare a 0 se si vogliono salvare tutte le features
private static int sogliaCluster1 = 10;
private static int sogliaCluster2 = 6;
private static int sogliaCluster3 = 1;
// settare a 0 se si vogliono salvare tutte le parole
private static int sogliaMinimaWords = 10;
// settare a 0 se si vogliono salvare tutti gli hashtag
private static int sogliaMinimaHashtag = 100;
public static void main(String[] args) throws Exception {
System.out.println("\n------------------------\tSTART LEARNING TOPIC\t------------------------\n");
NewsController newsController = new NewsController();
ClusteringOneController clusteringOneController = new ClusteringOneController(sogliaCluster1);
ClusteringTwoController clusteringTwoController = new ClusteringTwoController(sogliaCluster2);
ClusteringThreeController clusteringThreeController = new ClusteringThreeController(sogliaCluster3);
FileController fileController = new FileController();
SimpleKMeans cluster0 = null;
SimpleKMeans cluster1 = null;
SimpleKMeans cluster2 = null;
SimpleKMeans cluster3 = null;
Cluster cluster2_matrix = null;
/*
* CLUSTERING 1
*/
if (false)
newsController.newsExtractionAndSave();
if (false)
newsController.newsCleaning();
if (false)
clusteringOneController.createMatrix();
if (false)
fileController.saveCluster(1);
// TODO execute
if (false)
cluster1 = clusteringOneController.executeCluster();
/*
* CLUSTERING 2
*/
if (false)
newsController.annotationsExtractionAndSave(sogliaMinimaLink);
if (false)
newsController.news2AnnCleaning();
if (false)
cluster2_matrix = clusteringTwoController.createMatrix(false);
if (false)
fileController.saveCluster(2);
// TODO execute
if (false)
cluster2 = clusteringTwoController.executeCluster();
/*
* CLUSTERING 3
*/
if (false)
clusteringThreeController.createMatrix0();
if (false)
fileController.saveCluster(0);
if (false)
cluster0 = clusteringThreeController.executeCluster0();
// for this is necessary steps 7 and 12 and to remove cluster3 on db
if (false)
clusteringThreeController.createMatrix(cluster0, cluster2_matrix);
if (false)
fileController.saveCluster(3);
// TODO execute
if (false)
cluster3 = clusteringThreeController.executeCluster();
System.out.println("\n------------------------\tEND LEARNING TOPIC\t------------------------\n");
System.out.println("\n------------------------\tSTART LEARNING TWEET\t------------------------\n");
TweetElaborator tweetElaborator = new TweetElaborator();
ArrayList<String> topics = null;
/*
* SMOOTHING STREAMS
*/
if (false) {
ClassifierController classifier = new ClassifierController(cluster3);
topics = classifier.getTopics();
}
if (false){
tweetElaborator.elaborateBackground();
tweetElaborator.createHashtag2vec(sogliaMinimaHashtag);
}
if (false){
String common = tweetElaborator.findCommonTopic(topics);
System.out.println("\n\tTOPIC TROVATO: " + common);
tweetElaborator.createBackgroundForTopic(common);
System.out.println("\n\tBACKGROUND CREATO su " + common);
}
if (false){
tweetElaborator.createWord2weight(sogliaMinimaWords);
}
System.out.println("\n------------------------\tEND LEARNING TWEET\t------------------------\n");
}
}