Skip to content

RomanizeText API is broken #11866

Description

@rdp1414

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: translateIssues related to the Cloud Translation API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions