You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bahir.apache.org by lr...@apache.org on 2016/06/10 15:24:17 UTC
[38/50] [abbrv] bahir git commit: Fixing the type of the sentiment
happiness value
Fixing the type of the sentiment happiness value
## What changes were proposed in this pull request?
Added the conversion to int for the 'happiness value' read from the file. Otherwise, later on line 75 the multiplication will multiply a string by a number, yielding values like "-2-2" instead of -4.
## How was this patch tested?
Tested manually.
Author: Yury Liavitski <se...@gmail.com>
Author: Yury Liavitski <yu...@il111.ice.local>
Closes #11540 from heliocentrist/fix-sentiment-value-type.
Project: http://git-wip-us.apache.org/repos/asf/bahir/repo
Commit: http://git-wip-us.apache.org/repos/asf/bahir/commit/3b4a1c0e
Tree: http://git-wip-us.apache.org/repos/asf/bahir/tree/3b4a1c0e
Diff: http://git-wip-us.apache.org/repos/asf/bahir/diff/3b4a1c0e
Branch: refs/heads/master
Commit: 3b4a1c0e2609ec7c852495f9d4aefac7e8730691
Parents: 9bff9b3
Author: Yury Liavitski <se...@gmail.com>
Authored: Mon Mar 7 10:54:33 2016 +0000
Committer: Sean Owen <so...@cloudera.com>
Committed: Mon Mar 7 10:54:33 2016 +0000
----------------------------------------------------------------------
.../streaming/twitter/TwitterHashTagJoinSentiments.scala | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/bahir/blob/3b4a1c0e/streaming-twitter/examples/src/main/scala/org/apache/spark/examples/streaming/twitter/TwitterHashTagJoinSentiments.scala
----------------------------------------------------------------------
diff --git a/streaming-twitter/examples/src/main/scala/org/apache/spark/examples/streaming/twitter/TwitterHashTagJoinSentiments.scala b/streaming-twitter/examples/src/main/scala/org/apache/spark/examples/streaming/twitter/TwitterHashTagJoinSentiments.scala
index edf0e0b..a8d392c 100644
--- a/streaming-twitter/examples/src/main/scala/org/apache/spark/examples/streaming/twitter/TwitterHashTagJoinSentiments.scala
+++ b/streaming-twitter/examples/src/main/scala/org/apache/spark/examples/streaming/twitter/TwitterHashTagJoinSentiments.scala
@@ -56,8 +56,8 @@ object TwitterHashTagJoinSentiments {
val wordSentimentFilePath = "data/streaming/AFINN-111.txt"
val wordSentiments = ssc.sparkContext.textFile(wordSentimentFilePath).map { line =>
val Array(word, happinessValue) = line.split("\t")
- (word, happinessValue)
- } cache()
+ (word, happinessValue.toInt)
+ }.cache()
// Determine the hash tags with the highest sentiment values by joining the streaming RDD
// with the static RDD inside the transform() method and then multiplying