fixed unrecognisable lang bug

This commit is contained in:
Robert Nasarek 2023-01-31 17:51:06 +01:00
parent 2b98565444
commit 79f54079f7
2 changed files with 5 additions and 2 deletions

View file

@ -80,7 +80,7 @@ axes[0].legend(pieChartlabels, loc='upper right', bbox_to_anchor=(0.9, 0.9))
# Line chart. # Line chart.
lineChart = dataframe4LineChart.plot.line( lineChart = dataframe4LineChart.plot.line(
ax=axes[1], 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].grid(True)
axes[1].set_xlim([date(2023, 1, 1), date(2023, 12, 31)]) axes[1].set_xlim([date(2023, 1, 1), date(2023, 12, 31)])

View file

@ -31,7 +31,10 @@ class TootCrawler():
timelinePagination = self.mastodonInstance.fetch_previous(timelinePagination) timelinePagination = self.mastodonInstance.fetch_previous(timelinePagination)
for i in allTimelineResults: for i in allTimelineResults:
content = self.cleanhtml(i.content) content = self.cleanhtml(i.content)
try:
language = detect(content) language = detect(content)
except:
language = None
sentiment = self.sentiTooter.analyze(language, content) sentiment = self.sentiTooter.analyze(language, content)
toot = { toot = {
"sentiment": sentiment[0], "sentiment": sentiment[0],