up trads
This commit is contained in:
parent
bebe20fea0
commit
48b8683028
2 changed files with 30 additions and 1 deletions
Binary file not shown.
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue