Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HACK / do not merge #505

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ RUN python3 -m spacy download el_core_news_sm \
COPY . /ingestors
WORKDIR /ingestors
RUN pip3 install --no-cache-dir -e /ingestors
RUN argospm update && argospm install translate-en_es
RUN chown -R app:app /ingestors

ENV ARCHIVE_TYPE=file \
Expand Down
4 changes: 3 additions & 1 deletion ingestors/support/pdf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import argostranslate.translate
from dataclasses import dataclass
import logging
import os
Expand Down Expand Up @@ -67,7 +68,8 @@ def extract_pages(self, pdf_model: PdfModel, entity, manager):
page_entity.make_id(entity.id, page_model.number)
page_entity.set("document", entity)
page_entity.set("index", page_model.number)
page_entity.add("bodyText", page_model.text)
text_es = argostranslate.translate.translate(page_model.text, "en", "es")
page_entity.add("bodyText", text_es)
manager.apply_context(page_entity, entity)
manager.emit_entity(page_entity)
manager.emit_text_fragment(entity, page_model.text, page_entity.id)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ requests[security]==2.28.2
pymupdf==1.21.1

sentry_sdk==1.26.0
argostranslate