Этот коммит содержится в:
Inga Ulusoy 2024-11-29 08:27:01 +01:00
родитель ac560ded38 8057153e60
Коммит 4add286d7d
3 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/kynan/nbstripout - repo: https://github.com/kynan/nbstripout
rev: 0.7.1 rev: 0.8.1
hooks: hooks:
- id: nbstripout - id: nbstripout
files: ".ipynb" files: ".ipynb"

Просмотреть файл

@ -173,8 +173,8 @@
"source": [ "source": [
"%pwd\n", "%pwd\n",
"image_dict = ammico.find_files(\n", "image_dict = ammico.find_files(\n",
" path=\"data/errors_Nov24/Error1\",\n", " # path = \"/content/drive/MyDrive/misinformation-data/\",\n",
" # path=str(data_path),\n", " path=str(data_path),\n",
" limit=15,\n", " limit=15,\n",
")" ")"
] ]

Просмотреть файл

@ -237,6 +237,15 @@ class TextDetector(AnalysisMethod):
if not self.subdict["text"]: if not self.subdict["text"]:
print("No text found - skipping analysis.") print("No text found - skipping analysis.")
else: else:
# make sure all full stops are followed by whitespace
# otherwise googletrans breaks
index_stop = self.subdict["text"].find(".")
if self.subdict["text"][index_stop + 1] != " ":
self.subdict["text"] = (
self.subdict["text"][: index_stop + 1]
+ " "
+ self.subdict["text"][index_stop + 1 :]
)
self.translate_text() self.translate_text()
self.remove_linebreaks() self.remove_linebreaks()
if self.analyse_text: if self.analyse_text: