GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [google cloud translate] as a result of translation, the second sentence disappeared · Issue #9 · googleapis/python-translate

This repository was archived by the owner on Feb 23, 2024. It is now read-only.
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

[google cloud translate] as a result of translation, the second sentence disappeared #9

Copy link
Copy link
Closed
Closed
[google cloud translate] as a result of translation, the second sentence disappeared#9
Copy link
Assignees
czahedi
Labels
🚨This issue needs some love.api: translationIssues related to the Cloud Translation API API.triage meI really want to be triaged.

Description

@InspiringPeople
InspiringPeople
opened on Apr 3, 2020
Issue body actions

Environment details

  1. Specify the API at the beginning of the title (for example, "BigQuery: ...")
    Google Cloud Translate
  2. OS type and version
    Linux ANLZ-G1 4.4.0-130-generic Removing overloaded global "type" from storage.acl. google-cloud-python#156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  3. Python version and virtual environment information: python --version
    python 3.7
  4. google-cloud- version: pip show google-<service> or pip freeze
    google-cloud-translate==2.0.1

Steps to reproduce

  1. Translate the two sentences written in Korean without spaces after the special symbols (.,! ...) using the google cloud translate API.

Code example

# example
from google.cloud import translate_v2 as translate
translate_client = translate.Client()

# case 1
comments = '야 너 왜 자꾸 문제 생겨.자꾸 이러면 못써'
myTrans1 = translate_client.translate(comments, target_language = 'en')
print('case 1 : ',myTrans1['translatedText'])

# case 2
comments = '야 너 왜 자꾸 문제 생겨. 자꾸 이러면 못써'
myTrans2 = translate_client.translate(comments, target_language = 'en')
print('case 2 : ', myTrans2['translatedText'])

Result

case 1 : Hey, why do you keep having problems?
case 2 : Hey, why do you keep having trouble? If I keep doing this, I can't use it

This is 100% reproducible. It needs credential key (GOOGLE_APPLICATION_CREDENTIALS) because I use paid service (Google Cloud Translate V2)

The difference in input data is just whether there is a space after the period or not. However, as a result of translation, in case 2, the second sentence disappeared without being translated.

Activity

  1. busunkim96
    transferred this issue fromgoogleapis/google-cloud-pythonon Apr 3, 2020
  2. product-auto-label
    added
    api: translationIssues related to the Cloud Translation API API.
    on Apr 3, 2020
  3. busunkim96 commented on Apr 3, 2020

    @busunkim96
    busunkim96
    on Apr 3, 2020
    Contributor
    More actions

    Interesting. This looks like something coming from the backend. I tried the v2 REST API directly, the v3 client, and translate.google.com

    REST API:

    https://translation.googleapis.com/language/translate/v2/?q=%EC%95%BC%20%EB%84%88%20%EC%99%9C%20%EC%9E%90%EA%BE%B8%20%EB%AC%B8%EC%A0%9C%20%EC%83%9D%EA%B2%A8.%EC%9E%90%EA%BE%B8%20%EC%9D%B4%EB%9F%AC%EB%A9%B4%20%EB%AA%BB%EC%8D%A8&source=ko&target=en&key=YOUR_API_KEY
    

    v3 client

    from google.cloud import translate
    
    client = translate.TranslationServiceClient()
    
    parent = client.location_path('PROJECT_ID', "global")
    
    text_no_space = '야 너 왜 자꾸 문제 생겨.자꾸 이러면 못써'
    text_with_space = '야 너 왜 자꾸 문제 생겨. 자꾸 이러면 못써'
    
    
    for text in [text_no_space, text_with_space]:
        response = client.translate_text(
            parent=parent,
            contents=[text],
            mime_type="text/plain",
            source_language_code="ko",
            target_language_code="en",
        )
        # Display the translation for each input text provided
        for translation in response.translations:
            print(u"Translated text: {}".format(translation.translated_text))

    From poking around with different inputs this doesn't seem to always happen.
    '너 왜 자꾸 문제 생겨.이러면 못써 -> Why do you keep having problems?
    너 왜 자꾸 문제 생겨.너 이러면 못써 -> Why do you keep having trouble, you can't use this

    If feasible, you could insert spaces around the punctuation as a work-around.

    @czahedi Where is the correct place to provide feedback on translation quality?

  4. czahedi commented on Apr 3, 2020

    @czahedi
    czahedi
    on Apr 3, 2020
    More actions

    Howdy! Just checked with the translation team and they have a public feedback / issue tracking forum here: https://issuetracker.google.com/issues?q=componentid:187144

  5. czahedi commented on Apr 3, 2020

    @czahedi
    czahedi
    on Apr 3, 2020
    More actions

    @InspiringPeople I encourage you to file an issue above and get your feedback directly to the product team, and refer to Bu Sun's workaround in the meantime. Thanks!

  6. czahedi
    closed this as completedon Apr 3, 2020
  7. yoshi-automation
    added
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Apr 7, 2020
  8. JustinBeckwith
    assigned
    czahedi
    on Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @czahedi
    czahedi

Labels

🚨This issue needs some love.api: translationIssues related to the Cloud Translation API API.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.