deepl-python
deepl-python copied to clipboard
XML translation - Doctype statement turns < and > characters into entity characters
When translating XML documents, the doctype statement is not properly handled. The less than and greater than characters surrounding the DOCTYPE statement are being converted to entities:
Before translation:
<!ENTITY ICN-S1000DBIKE-AAA-D000000-0-U8025-00536-A-04-1 SYSTEM "ICN-S1000DBIKE-AAA-D000000-0-U8025-00536-A-04-1.CGM" NDATA cgm >
]>
After translation:
<!DOCTYPE dmodule[
<!ENTITY ICN-S1000DBIKE-AAA-D000000-0-U8025-00536-A-04-1 SYSTEM "ICN-S1000DBIKE-AAA-D000000-0-U8025-00536-A-04-1.CGM" NDATA cgm > ]>
Code:
result = deepl_client.translate_text(
text,
tag_handling="xml",
source_lang="SV",
target_lang="EN-GB",
model_type="prefer_quality_optimized",
non_splitting_tags="div",
split_sentences="nonewlines"
)
I have heard that DeepL is working on improving the tag handling, is there an expected timeframe for this?
Any settings that could help improve this situation?
Added image to better illustrate the translated text.