Update goai_helpers/goai_traduction.py
Browse files
goai_helpers/goai_traduction.py
CHANGED
@@ -14,7 +14,7 @@ def split_text_intelligently(text, max_chunk_length=80):
|
|
14 |
Divise le texte en chunks en respectant les phrases complètes.
|
15 |
"""
|
16 |
# Séparation basée sur les phrases (utilise les points, points d'interrogation, etc.)
|
17 |
-
sentences = re.split(r'([
|
18 |
chunks = []
|
19 |
current_chunk = ""
|
20 |
|
@@ -39,7 +39,7 @@ def split_text_intelligently(text, max_chunk_length=80):
|
|
39 |
return chunks
|
40 |
|
41 |
@spaces.GPU
|
42 |
-
def goai_traduction(text, src_lang, tgt_lang, max_chunk_length=
|
43 |
# Si le texte est trop long, le diviser en chunks
|
44 |
if len(text) > max_chunk_length:
|
45 |
chunks = split_text_intelligently(text, max_chunk_length)
|
|
|
14 |
Divise le texte en chunks en respectant les phrases complètes.
|
15 |
"""
|
16 |
# Séparation basée sur les phrases (utilise les points, points d'interrogation, etc.)
|
17 |
+
sentences = re.split(r'([.!?:])', text)
|
18 |
chunks = []
|
19 |
current_chunk = ""
|
20 |
|
|
|
39 |
return chunks
|
40 |
|
41 |
@spaces.GPU
|
42 |
+
def goai_traduction(text, src_lang, tgt_lang, max_chunk_length=80):
|
43 |
# Si le texte est trop long, le diviser en chunks
|
44 |
if len(text) > max_chunk_length:
|
45 |
chunks = split_text_intelligently(text, max_chunk_length)
|