Exemplo n.º 1
0
 def runDatumBoxSentimentAnalysis(self, articles):
     numWrong = 0
     #torThread = TorThread(self)
     #torThread.start()
     #time.sleep(5)
     datumBox = DatumBox("08fe94b761715219d636bd338b1cd984") 
     for article in articles:
         sentimentModule = SentimentThread(article=article,articleNumber=0, datum_box=datumBox, proxy="127.0.0.1:8118")
         guessedSentiment = sentimentModule.getSentimentOfArticle()
         #print(article.getText())
         print("Guess: " + str(guessedSentiment) + ", actual: " + str(article.sentiment))
         if int(article.sentiment) != int(guessedSentiment):
             numWrong += 1
     print("\nCorrectly analyzed " + str(len(articles) - numWrong) + " out of " + str(len(articles)) + " articles.")