@@ -49,17 +49,16 @@ public class TweetGenerator extends TextGenerator {
49
49
private DistributionKey hashtag ;
50
50
private DistributionKey sentiment ;
51
51
private DistributionKey popularword ;
52
- //distribution popular,negative, neutral tweets
53
- private DistributionKey lengthsentence ; // sentece length and sentences per tweet
52
+ // distribution of popular, negative, and neutral tweets
53
+ private DistributionKey lengthsentence ; // sentence length and sentences per tweet
54
54
private DistributionKey lengthtweet ;
55
55
56
56
public TweetGenerator (Random random , TagDictionary tagDic ) throws NumberFormatException , IOException {
57
57
super (random , tagDic );
58
- //input de fitxers i crea els 4 maps
58
+ // load the input files and create 5 maps
59
59
hashtag = new DistributionKey (DatagenParams .SPARKBENCH_DIRECTORY + "/hashtags.csv" );
60
60
sentiment = new DistributionKey (DatagenParams .SPARKBENCH_DIRECTORY + "/sentiment.csv" );
61
61
popularword = new DistributionKey (DatagenParams .SPARKBENCH_DIRECTORY + "/words.csv" );
62
- //proportion = new DistributionKey(DatagenParams.SPARKBENCH_DIRECTORY + "/sentiment.csv");
63
62
lengthsentence = new DistributionKey (DatagenParams .SPARKBENCH_DIRECTORY + "/sentence_lengths.csv" );
64
63
lengthtweet = new DistributionKey (DatagenParams .SPARKBENCH_DIRECTORY + "/sentence_count.csv" );
65
64
}
@@ -72,18 +71,17 @@ protected void load() {
72
71
@ Override
73
72
public String generateText (PersonSummary member , TreeSet <Integer > tags , Properties prop ) {
74
73
StringBuffer content = null ;
75
- //mirar num de frases
74
+ // determine the number of sentences
76
75
Double numsentences = Double .valueOf (lengthtweet .nextDouble (this .random ));
77
76
for (int i = 0 ; i < numsentences ; ++i ) {
78
77
Double numwords = Double .valueOf (lengthsentence .nextDouble (this .random ));
79
- // depenen de la distribució de number hashtags per sentence int numhashtags;
80
- //int numhashtags = funciondistribuciohashtags(numwords);
78
+ // the number of hashtages depends on the number of words in the
79
+ // sentence
81
80
int numhashtags = (int ) (numwords * 0.4 );
82
81
for (int j = 0 ; j < numhashtags ; ++j ) {
83
82
content .append (" " + hashtag .nextDouble (this .random ));
84
83
}
85
- // depenen de la distribució de number sentiment words per sentence int numhashtags;
86
- //int numsentimentswords = funciondistribuciosentimentswords(numwords);
84
+ // the number of sentiment words depends on the number of words in the sentence
87
85
int numsentimentswords = (int ) (numwords * 0.4 );
88
86
for (int q = 0 ; q < numhashtags ; ++q ) {
89
87
content .append (" " + sentiment .nextDouble (this .random ));
@@ -92,14 +90,8 @@ public String generateText(PersonSummary member, TreeSet<Integer> tags, Properti
92
90
for (int j = 0 ; j < numwords ; ++j ) {
93
91
content .append (" " + popularword .nextDouble (this .random ));
94
92
}
95
-
96
93
}
97
- //per cada frase mirar numero de paraules
98
- //mirar numero de hashtags
99
- content .toString ();
100
94
return content .toString ();
101
-
102
95
}
103
96
104
-
105
97
}
0 commit comments