Skip to content

Commit 86b3032

Browse files
committed
tweaking demo
1 parent 6b22bbe commit 86b3032

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Diff for: samples/bluesky-sentiment-analysis/api/bsky-sentiment-api/src/main/java/com/redis/bskysentimentapi/Bootstrap.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void run(String... args) throws Exception {
4343
};
4444

4545
jedis.sadd(Constants.HASHTAGS_TO_QUERY, hashtags);
46-
jedis.sadd(Constants.KEYWORDS_TO_QUERY, "us", "politics", "election", "apple", "tesla", "ai", "history", "pop", "rock", "jazz", "boeing");
46+
jedis.sadd(Constants.KEYWORDS_TO_QUERY, "us", "apple", "tesla", "ai", "history", "pop", "rock", "jazz", "boeing", "aws", "google", "azure", "travel", "science","technology", "databases", "WWE", "France", "UK");
4747

4848
}
4949
}

Diff for: samples/bluesky-sentiment-analysis/api/bsky-sentiment-api/src/main/java/com/redis/bskysentimentapi/services/SentimentService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public double getSentimentForHashTag(String tag) {
3434

3535
public Optional<Double> getSentimentForKeyWord(String keyword) {
3636
long now = Instant.now().getEpochSecond() * 1000;
37-
AggregationBuilder builder = new AggregationBuilder(String.format("@text:%s @createdAt:[%d %d]", keyword, now - 10000, now));
37+
AggregationBuilder builder = new AggregationBuilder(String.format("@text:%s @createdAt:[-inf %d]", keyword, now));
3838
Group group = new Group();
3939
group.reduce(Reducers.avg("@sentiment").as("sentiment"));
4040
builder.groupBy(group);
@@ -51,7 +51,7 @@ public Map<String, Double> getSentimentForKeyWords(Set<String> keyWords){
5151
}
5252
String queryString = String.join("|", keyWords);
5353
long now = Instant.now().getEpochSecond() * 1000;
54-
AggregationBuilder builder = new AggregationBuilder(String.format("@text:%s @createdAt:[%d %d]", queryString, now - 10000, now));
54+
AggregationBuilder builder = new AggregationBuilder(String.format("@text:%s @createdAt:[-inf %d]", queryString, now));
5555
Group group = new Group("@text");
5656
group.reduce(Reducers.avg("@sentiment").as("sentiment"));
5757
builder.groupBy(group);

Diff for: samples/bluesky-sentiment-analysis/consumer/consumer/src/main/java/com/redis/Main.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static boolean containsNonAscii(String str) {
3535

3636
public void run() throws IOException, InterruptedException {
3737
Properties props = new Properties();
38-
props.setProperty("annotators", "tokenize,ssplit,pos,lemma,parse,sentiment");
38+
props.setProperty("annotators", "tokenize,ssplit,parse,sentiment");
3939
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
4040
String redisHost = System.getenv("REDIS_HOST") != null ? System.getenv("REDIS_HOST") : "localhost";
4141
System.out.println("Connecting to Redis at " + redisHost);

0 commit comments

Comments
 (0)