From 48b86830286ca76d95c644b0aa316ffa91c66d93 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Thu, 4 Sep 2025 00:32:13 +0200 Subject: [PATCH] up trads --- .../__pycache__/wiki_compare.cpython-313.pyc | Bin 46198 -> 46198 bytes wiki_compare/wiki_translate.py | 31 +++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/wiki_compare/__pycache__/wiki_compare.cpython-313.pyc b/wiki_compare/__pycache__/wiki_compare.cpython-313.pyc index fc9871438d74f7e568796bb619c0698dd0091ac4..fe0f9f33ab64d5f7db212e31b4d27fadcba6da93 100644 GIT binary patch delta 21 bcmezNg6Z1}Ca%xCyj%=GV0v&PSI!myU||Qd delta 21 bcmezNg6Z1}Ca%xCyj%=G@M!x+uAD6ZWIYI0 diff --git a/wiki_compare/wiki_translate.py b/wiki_compare/wiki_translate.py index a5103f5..bef8f06 100644 --- a/wiki_compare/wiki_translate.py +++ b/wiki_compare/wiki_translate.py @@ -29,7 +29,7 @@ from bs4 import BeautifulSoup # Import functions from wiki_compare.py from wiki_compare import ( - fetch_wiki_page, + fetch_wiki_page as original_fetch_wiki_page, load_json_data, save_to_json, save_with_history, @@ -37,6 +37,35 @@ from wiki_compare import ( logger ) +def fetch_wiki_page(key, language='en', is_specific_page=False): + """ + Wrapper for the original fetch_wiki_page function that doesn't use Grammalecte + + This function calls the original fetch_wiki_page function but removes the grammar suggestions + from the result. It's used to satisfy the requirement to "ne pas utiliser grammalecte, + on veut seulement traduire". + + Args: + key (str): OSM key or specific page title/URL + language (str): Language code ('en' or 'fr') + is_specific_page (bool): Whether this is a specific page rather than a key + + Returns: + dict: Dictionary with page information or None if page doesn't exist + """ + # Call the original function + page_info = original_fetch_wiki_page(key, language, is_specific_page) + + # If page_info is None, return None + if page_info is None: + return None + + # Remove grammar suggestions from the result + if 'grammar_suggestions' in page_info: + page_info['grammar_suggestions'] = [] + + return page_info + # Constants TRANSLATIONS_FILE = "translations.json" OLLAMA_API_URL = "http://localhost:11434/api/generate"