`RomanizeText` API is broken
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-translateversion:3.11.1
Things I tried
- Complained at Google APIs groups.
- 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.
- Looked into the source code file but couldn't find any API named
romanize_text.
Steps to reproduce
- As per the Google Romanize text docs, I wrote the following Python code to transliterate from some language script to Roman script.
- The below code with minor replacements works correctly for
translate_textAPI.
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?
Hello team,
Is it possible to either give some work-around or at least give an ETA of this?
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
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.