google-cloud-python icon indicating copy to clipboard operation
google-cloud-python copied to clipboard

`RomanizeText` API is broken

Open rdp1414 opened this issue 2 years ago • 3 comments

We need the Romanization feature badly. Can someone please help? We want to transliterate (not translate) from Hindi (Devanagari script) language to English (Roman script) language.

Input
romanize_text('अंतिम लक्ष्य क्या है')

Expected Output
'antim lakshya kya hai'

Environment details

  • OS type and version: Windows 11
  • Python version: 3.9.11
  • pip version: 23.1.2
  • google-cloud-translate version: 3.11.1

Things I tried

  1. Complained at Google APIs groups.
  2. Looked up in the Google's API reference of romanizeText. I saw that the right-hand side API Explorer is broken. Whereas, if you select any other method from the left-hand side - its API Explorer works correctly.
  3. Looked into the source code file but couldn't find any API named romanize_text.

Steps to reproduce

  1. As per the Google Romanize text docs, I wrote the following Python code to transliterate from some language script to Roman script.
  2. The below code with minor replacements works correctly for translate_text API.

Code example

# Authenticate using credentials.
import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "translate.json"

PROJECT_ID = "project-id"
LOCATION = "global"

# Imports the Google Cloud Translation library
from google.cloud import translate_v3

# Transliteration.
def romanize_text(text, src_lang="hi", tgt_lang="en"):

    client = translate_v3.TranslationServiceClient()
    parent = f"projects/{PROJECT_ID}/locations/{LOCATION}"

    response = client.romanize_text(
        request={
            "parent": parent,
            "contents": [text],
            "source_language_code": src_lang,
            "target_language_code": tgt_lang,
        }
    )

    # Display the romanized for each input text provided
    for romanization in response.romanizations:
        print(f"Romanized text: {romanization.romanized_text}")

romanize_text('अंतिम लक्ष्य क्या है')

Stack trace

AttributeError: 'TranslationServiceClient' object has no attribute 'romanize_text'

We need the Romanization feature urgently. Can someone please help?

rdp1414 avatar May 24 '23 09:05 rdp1414

Hello team,

Is it possible to either give some work-around or at least give an ETA of this?

rdp1414 avatar May 27 '23 03:05 rdp1414

I'm going to transfer this issue to google-cloud-python as we're planning to move the code for google-cloud-translate there in the next 1-2 weeks

parthea avatar Oct 21 '23 20:10 parthea

Thanks for filing this issue. This is a Translate API feature request, not an issue that pertains directly to the Python client libraries. We'll route your request to the API team internally. If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

vchudnov-g avatar Dec 08 '23 21:12 vchudnov-g