Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation error with markup text #68

Open
ChingYi-AX opened this issue Mar 14, 2023 · 3 comments
Open

Translation error with markup text #68

ChingYi-AX opened this issue Mar 14, 2023 · 3 comments

Comments

@ChingYi-AX
Copy link

ChingYi-AX commented Mar 14, 2023

When translating the markup text via DeepL API, the newlines, \\n, are squeezed into the wrong tag (i.e., </c>). Please see the following example, where DE is the source and RU is the target :)

DE: Liste der Eigenschaften:\\n* <c id=\"f48c4591-9f64-4ac8-af6a-72228cd50793\">Kamera</c>\\n* <c id=\"882df0f7-39a5-4f99-ae8a-e23a485419ee\">Akku</c>\\n
RU: Список свойств:\\n* <c id=\"f48c4591-9f64-4ac8-af6a-72228cd50793\">Камера\\n*</c> <c id=\"882df0f7-39a5-4f99-ae8a-e23a485419ee\">Аккумулятор\\n</c>

The expectation would be that the 2nd and 3rd newlines still stay outside of the </c> tag, after translating.

@ChingYi-AX ChingYi-AX changed the title Translation error with Markup text Translation error with markup text Mar 14, 2023
@seekuehe
Copy link

We have raised your issue with the relevant team. Thank you for reporting! We'll keep you posted if we find anything.

@DeeJayTC
Copy link
Member

hey @ChingYi-AX could you give us the exact request you've sent including the parameters etc?

@ChingYi-AX
Copy link
Author

@seekuehe @DeeJayTC Thank you very much for your help and sorry for the late reply! Here is the exact request with the parameters:

_BASE_PARAMS = {
    "split_sentences": "nonewlines",
    "tag_handling": "xml",
    "non_splitting_tags": "b,c",
}
auth_header = {"Authorization": OUR_DEEPL_API_KEY}
texts = ["Liste der Eigenschaften:\\n* <c id=\"f48c4591-9f64-4ac8-af6a-72228cd50793\">Kamera</c>\\n* <c id=\"882df0f7-39a5-4f99-ae8a-e23a485419ee\">Akku</c>\\n"]

data = {"source_lang": "DE", "target_lang": "RU", **_BASE_PARAMS, "text": texts}
    
response = requests.post(
    "https://api.deepl.com/v2/translate",
    timeout=20,
    headers=auth_header,
    data=data,
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants