Skip to content

Commit

Permalink
fix missing whitespace for links and names (#225)
Browse files Browse the repository at this point in the history
* fix missing whitespace for links and names

* remove comments in notebook

* cleanup
  • Loading branch information
iulusoy authored Nov 22, 2024
1 parent dc6c904 commit 8057153
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ammico/notebooks/DemoNotebook_ammico.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
"outputs": [],
"source": [
"image_dict = ammico.find_files(\n",
" # path=\"/content/drive/MyDrive/misinformation-data/\",\n",
" # path = \"/content/drive/MyDrive/misinformation-data/\",\n",
" path=str(data_path),\n",
" limit=15,\n",
")"
Expand Down
9 changes: 9 additions & 0 deletions ammico/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,15 @@ def analyse_image(self) -> dict:
if not self.subdict["text"]:
print("No text found - skipping analysis.")
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.remove_linebreaks()
if self.analyse_text:
Expand Down

0 comments on commit 8057153

Please sign in to comment.