deepl-python icon indicating copy to clipboard operation
deepl-python copied to clipboard

XML Tags Misplaced in Translated Output

Open sunghowoo-kr opened this issue 5 months ago • 0 comments

Hi,

I'm testing the API for integrating our web services, but I’ve encountered an issue.

Example: Input Target (EN): <claim id="CLM-00004" num="00004"><claim-text>4. An optical fiber coupling part comprising:<claim-text>an optical fiber having a numerical aperture **NA<sub>f</sub>**;</claim-text><claim-text>a first GRIN lens having a numerical aperture **NA<sub>1</sub>**, said first GRIN lens having an unattached first end; and</claim-text><claim-text>a second GRIN lens having a numerical aperture **NA<sub>2</sub>**, wherein a first end of said second GRIN lens is fusion spliced with a second end of said first GRIN lens and a second end of said second GRIN lens is fusion spliced with an end of said optical fiber,</claim-text><claim-text>wherein a tip part of said unattached first end of said first GRIN lens is flat, and wherein the numerical aperture NA<sub>f </sub>of the optical fiber, the numerical aperture NA<sub>1 </sub>of the first GRIN lens, the numerical aperture NA<sub>2 </sub>of the second GRIN lens, and a numerical aperture NA<sub>s </sub>of a light emitting source are selected to satisfy the formula expressed by:<claim-text><br/><?in-line-formulae description="In-line Formulae" end="lead"?>**NA<sub>f</sub>≦NA<sub>2</sub>&lt;NA<sub>s</sub>≦NA<sub>1</sub>**,<?in-line-formulae description="In-line Formulae" end="tail"?></claim-text></claim-text><claim-text>wherein said light emitting source comprises a semiconductor laser.</claim-text></claim-text></claim>

Output Target (KO): <claim id="CLM-00004" num="00004"><claim-text>4. 다음을 포함하는 광섬유 결합부:<claim-text>수치 조리개 **<sub>NAf를</sub>** 갖는 광섬유;</claim-text><claim-text>수치 조리개 **<sub>NA1을</sub>** 갖는 제1 GRIN 렌즈, 상기 제1 GRIN 렌즈는 제1 단부가 부착되지 않은 제1 단부를 갖는다; 및</claim-text><claim-text>수치 조리개 **<sub>NA2를</sub>** 갖는 제2 GRIN 렌즈, 상기 제2 GRIN 렌즈의 제1 단부는 상기 제1 GRIN 렌즈의 제2 단부와 융합 접합되고 상기 제2 GRIN 렌즈의 제2 단부는 상기 광섬유의 단부와 융합 접합되며</claim-text><claim-text>, 상기 제1 GRIN 렌즈의 부착되지 않은 제1 단부의 팁 부분은 평평한 것을 특징으로</claim-text><claim-text>하는 제2 GRIN 렌즈</claim-text><claim-text>, 및 상기<sub>광섬유의 </sub>수치 조리개 NAf, 상기 제1 GRIN<sub>렌즈의 </sub>수치 조리개 NA1, 상기 제2 GRIN<sub>렌즈의 </sub>수치 조리개 NA2 및 발광원의 수치 조리개 NS가 식 (1)로 표현되는 공식을 만족하도록 선택되는 것을 특징으로 하는 광섬유를 포함한다:<claim-text><br/><?in-line-formulae description="In-line Formulae" end="lead"?>**<sub>NAf≦NA2&lt;NAs≦NA1</sub>**,<?in-line-formulae description="In-line Formulae" end="tail"?></claim-text></claim-text><claim-text>, 여기서 상기 발광원은 반도체 레이저를 포함합니다.</claim-text></claim-text></claim>

In this case, the <sub> tags are not placed in the correct positions in the output. This causes incorrect rendering and affects the intended meaning of the content.

How can I resolve this issue?

For reference, here is my current API setup:

def get_deepl_params(text: str, source_lang: str, target_lang: str) -> Dict[str, Any]:
    """Creat DeepL API Parameter"""
    return {
        'auth_key': DEEPL_API_KEY,
        'text': text,
        'source_lang': source_lang.upper(),
        'target_lang': target_lang.upper(),
        'tag_handling': 'xml',
        # 'outline_detection': 0,
    }

Thank you.

sunghowoo-kr avatar Jul 16 '25 10:07 sunghowoo-kr