Ich versuche, die Stoppwörter aus einer RDD von Wörtern aus einer .txt
Datei herauszufiltern. Filter Stoppwörter in Spark
// Creating the RDDs
val input = sc.textFile("../book.txt")
val stopWordsInput = sc.textFile("../stopwords.csv")
val stopWords = stopWordsInput.map(x => x.split(","))
// Create a tuple of test words
val testWords = ("you", "to")
// Split using a regular expression that extracts words
val wordsWithStopWords = input.flatMap(x => x.split("\\W+"))
Der Code vor allem macht Sinn für mich und scheint gut zu funktionieren. Hier habe ich Probleme.
//Remove the stop words from the list
val words = wordsWithStopWords.filter(x => x != testWords)
Dies läuft aber herauszufiltern nicht tatsächlich die in dem Tupel testWords
enthaltenen Wörtern. Ich bin nicht sicher, wie man die Wörter in wordsWithStopWords
gegen jedes Wort in meinem Tupel testet testWords
Ich sehe nicht die Verwendung von testWords. – eliasah