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

The deepl.Formality is ignored #94

Open
pbtsrc opened this issue Feb 3, 2024 · 0 comments
Open

The deepl.Formality is ignored #94

pbtsrc opened this issue Feb 3, 2024 · 0 comments

Comments

@pbtsrc
Copy link

pbtsrc commented Feb 3, 2024

import deepl
auth_key = '_____'
client = deepl.Translator(auth_key, send_platform_info=False)

text_1_plain = '''
‘So you want this hung up in the window, my — in the window, miss?’ asked Mr Dunball.
‘If you could hang it up without inconvenience, sir.’
'''
text_2_plain = '''
I am not angry with you, Edric.
"Thou art a brave lad!" cried the duke.
'''
result_1_plain_default = client.translate_text(
    text_1_plain, source_lang='en', target_lang='de',
    formality=deepl.Formality.DEFAULT)
result_1_plain_less = client.translate_text(
    text_1_plain, source_lang='en', target_lang='de',
    formality=deepl.Formality.LESS)
result_1_plain_more = client.translate_text(
    text_1_plain, source_lang='en', target_lang='de',
    formality=deepl.Formality.MORE)

result_2_plain_default = client.translate_text(
    text_2_plain, source_lang='en', target_lang='de',
    formality=deepl.Formality.DEFAULT)
result_2_plain_less = client.translate_text(
    text_2_plain, source_lang='en', target_lang='de',
    formality=deepl.Formality.LESS)
result_2_plain_more = client.translate_text(
    text_2_plain, source_lang='en', target_lang='de',
    formality=deepl.Formality.MORE)

print('text_1_plain\n', text_1_plain)
print('result_1_plain_default\n', result_1_plain_default)
print('result_1_plain_less\n', result_1_plain_less)
print('result_1_plain_more\n', result_1_plain_more)

print('text_2_plain\n', text_2_plain)
print('result_2_plain_default\n', result_2_plain_default)
print('result_2_plain_less\n', result_2_plain_less)
print('result_2_plain_more\n', result_2_plain_more)

The above code prints this:

text_1_plain
 
‘So you want this hung up in the window, my — in the window, miss?’ asked Mr Dunball.
‘If you could hang it up without inconvenience, sir.’

result_1_plain_default
 
Sie wollen also, dass das im Fenster aufgehängt wird, mein - im Fenster, Miss?", fragte Mr. Dunball.
'Wenn Sie es ohne Unannehmlichkeiten aufhängen könnten, Sir.'

result_1_plain_less
 
Sie wollen also, dass das ins Fenster gehängt wird?", fragte Mr. Dunball.
Wenn Sie es ohne Probleme aufhängen können, Sir.

result_1_plain_more
 
'Sie wollen also, dass das im Fenster aufgehängt wird, mein - im Fenster, Miss?', fragte Mr. Dunball.
'Wenn Sie es ohne Unannehmlichkeiten aufhängen könnten, Sir.'

text_2_plain
 
I am not angry with you, Edric.
"Thou art a brave lad!" cried the duke.

result_2_plain_default
 
Ich bin nicht böse auf dich, Edric.
"Du bist ein tapferer Bursche!", rief der Herzog.

result_2_plain_less
 
Ich bin nicht böse auf dich, Edric.
"Du bist ein tapferer Junge!", rief der Herzog.

result_2_plain_more
 
Ich bin nicht böse auf dich, Edric.
"Du bist ein tapferer Bursche!", rief der Herzog.

Looks like the deepl.Formality is ignored.

text_1:
"You" is always translated as "Sie", but should be "Du" if formality==deepl.Formality.LESS

text_2:
"with you" is always translated as "auf dich", but should be " auf Sie" if formality==deepl.Formality.MORE. The same is for "Thou art"

@pbtsrc pbtsrc changed the title The deepl.Formality is often ignored The deepl.Formality is ignored Feb 26, 2024
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

1 participant