Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/alberto-solano/open-source-LLM-translation-tool
/ functions
Functions
49 in github.com/alberto-solano/open-source-LLM-translation-tool
⨍
Functions
49
◇
Types & classes
5
↓ 6 callers
Method
Execute
(self, paragraph)
src/translate_docx.py:108
↓ 4 callers
Function
convert_text
Function to generate a list of strings with a limited number of tokens given the max_tokens parameter. The sentence is splited by ". " as a se
src/utils.py:34
↓ 4 callers
Function
language_detection
Function to automatically detect a langauge using the lid218e model. Parameters ---------- text : list Text list with the paragra
src/utils.py:90
↓ 3 callers
Function
basic_preprocessing
(_string)
src/utils.py:26
↓ 2 callers
Method
browse_slide
All PowerPoint slides are composed of shapes. We are going inside each shape in order to translate the text on them PARAMETERS:
src/translate_pptx.py:117
↓ 2 callers
Method
change_text_frame_text
Operate text modifications to a shape which contains/is a text_frame. PARAMETERS: shape : pptx.shapes.shapetree.SlideShapes
src/translate_pptx.py:89
↓ 1 callers
Method
body_content
(self, document)
src/translate_docx.py:71
↓ 1 callers
Method
body_tables
(self, document)
src/translate_docx.py:76
↓ 1 callers
Method
browse_shape
PowerPoint Shapes might be of different kind. Each kind of shape has its own way to deal with text. This functions aims to roo
src/translate_pptx.py:63
↓ 1 callers
Method
change_table_text
Operate text translation to a shape which contains/is a table. PARAMETERS: shape : pptx.shapes.shapetree.SlideShapes Orig
src/translate_pptx.py:132
↓ 1 callers
Function
convert_pdf2image
Function to convert a PDF into a set of images. Parameters ---------- doc_filepath : str String with complete path to the documen
src/preprocess_pdf.py:9
↓ 1 callers
Function
detect_language_from_images
Function to infer the language of a group of images using the google Tesseract OCR engine + lid218e model. Parameters ---------- img_
src/utils.py:124
↓ 1 callers
Method
footers
(self, document)
src/translate_docx.py:96
↓ 1 callers
Function
get_y_and_heights
Gets the vertical size of a given text: https://stackoverflow.com/questions/43060479/
src/save_document.py:223
↓ 1 callers
Function
handle_non_ascii
Convert all non-ASCII characters to their closest ASCII equivalent automatically.
src/utils.py:9
↓ 1 callers
Function
handle_utf8
(_string)
src/utils.py:16
↓ 1 callers
Function
handle_whitespaces
(_string)
src/utils.py:21
↓ 1 callers
Method
headers
(self, document)
src/translate_docx.py:84
↓ 1 callers
Function
inpaint_algorithm
Function to interpolate the background of a text box with a rectangular mask
src/save_document.py:116
↓ 1 callers
Function
load_model
Function to load the desired nllb model. Parameters ---------- model_path : str Path in whic the model is stored Returns
src/utils.py:161
↓ 1 callers
Function
main
Run administrative tasks.
manage.py:7
↓ 1 callers
Method
make_text_modification
(self, text)
src/translate_pptx.py:177
↓ 1 callers
Function
overalapping_correction
corrects the overlapping of bboxes by readjusting their ypos
src/save_document.py:265
↓ 1 callers
Function
overwrite_text_on_images
Function needed for replacing the translated pdf text chunks over the images extracted from the input pdf Parameters ---------- docum
src/save_document.py:42
↓ 1 callers
Function
preprocess_text
Function to preprocess text from a .pptx file. Parameters ---------- doc_filepath : str String with complete path to the document
src/preprocess_pptx.py:5
↓ 1 callers
Method
replace_paragraph_text_retaining_initial_formatting
Given a paragraph PARAMETERS: paragraph : pptx.text.text._Paragraph Read paragraph with its original value and font param
src/translate_pptx.py:154
↓ 1 callers
Function
save_translated_doc
Function to save translated and untranslated documents in a certain location. Parameters ---------- document : File containing all th
src/save_document.py:8
↓ 1 callers
Function
text_wrap
(text, font, max_width)
src/save_document.py:235
↓ 1 callers
Function
translate
Auxiliary translation function encapsulated in a lambda
src/translate_pdf.py:39
↓ 1 callers
Function
translate_document
( document, model_name, models_path, max_tokens, lang_origin_code, lang_dest_code,
src/translate_pptx.py:7
↓ 1 callers
Function
translate_document
(filename, dst_lang, loaded_model=None)
src/translation_app.py:76
↓ 1 callers
Method
translate_document
(self, document)
src/translate_pptx.py:58
↓ 1 callers
Method
translate_document
(self, document)
src/translate_docx.py:61
↓ 1 callers
Function
translate_text
Function to generate a list of strings with a limited number of tokens. Each string will be processed with the NLLB model so it should not exceed
src/translation_app.py:6
↓ 1 callers
Function
write_text_on_rectangle
coords: (left=w, top=x, right=y, bottom=z)
src/save_document.py:181
Method
__init__
( self, model_name, models_path, max_tokens, lang_origin_code,
src/translate_pptx.py:36
Method
__init__
( self, model_name, models_path, max_tokens, lang_origin_code,
src/translate_docx.py:39
Method
__str__
(self)
application/models.py:8
Method
clean_translated_document
(self)
application/forms.py:19
Function
delete_all_translations
(request)
application/views.py:144
Function
detect_language
(request)
application/views.py:38
Function
home
(request)
application/views.py:31
Function
preprocess_text
Function to preprocess text from a .pdf file. Parameters ---------- doc_filepath : str String with complete path to the document
src/preprocess_pdf.py:40
Function
preprocess_text
Function to preprocess text from a .docx file. Each paragraph is obtained through paragraph atribute from python.docx library. Parameters
src/preprocess_docx.py:5
Function
serve_translated_document
(request, filename)
application/views.py:134
Function
translate_document
( document, model_name, models_path, max_tokens, lang_origin_code, lang_dest_code,
src/translate_pdf.py:7
Function
translate_document
( document, model_name, models_path, max_tokens, lang_origin_code, lang_dest_code,
src/translate_docx.py:7
Function
translation_interface
(request)
application/views.py:50
Function
upload_document
(request)
application/views.py:87