From 79f54079f7dabb9e526f41ca28401975d0155215 Mon Sep 17 00:00:00 2001 From: Robert Nasarek Date: Tue, 31 Jan 2023 17:51:06 +0100 Subject: [PATCH] fixed unrecognisable lang bug --- Main.py | 2 +- TootCrawler.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Main.py b/Main.py index 2b6768a..e6b7a3a 100644 --- a/Main.py +++ b/Main.py @@ -80,7 +80,7 @@ axes[0].legend(pieChartlabels, loc='upper right', bbox_to_anchor=(0.9, 0.9)) # Line chart. lineChart = dataframe4LineChart.plot.line( ax=axes[1], - title='Mean of all sentiments from max positive (1) to min negative (-1)' + title='"Mean" of all sentiments. Please note that the sentiments are classified in a nominal scale: positive (1), neutral (0), and negative (-1) and NOT with compounds. Therefore this value indicates a tendency and not a correct statistical value.' ) axes[1].grid(True) axes[1].set_xlim([date(2023, 1, 1), date(2023, 12, 31)]) diff --git a/TootCrawler.py b/TootCrawler.py index fa131bf..a657a5d 100644 --- a/TootCrawler.py +++ b/TootCrawler.py @@ -31,7 +31,10 @@ class TootCrawler(): timelinePagination = self.mastodonInstance.fetch_previous(timelinePagination) for i in allTimelineResults: content = self.cleanhtml(i.content) - language = detect(content) + try: + language = detect(content) + except: + language = None sentiment = self.sentiTooter.analyze(language, content) toot = { "sentiment": sentiment[0],