Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Speech: 404 Unable to find PhraseSet from project

I have a little project with google speech-to-text module that works fine without adaptation. Now I want to add a phrase set for it. For this I have created one in web UI:

google1.png

But for some reason the python lib says it is unable to find it (instead of ellipsis there is project id) :

 

from google.cloud.speech_v2 import (
    GetPhraseSetRequest,
    SpeechClient,
)


client = SpeechClient()
request = GetPhraseSetRequest(name='projects/.../locations/global/phraseSets/meow')
phrase_set = client.get_phrase_set(request)
google.api_core.exceptions.NotFound: 404 Unable to find PhraseSet meow from project ...

 

 I run the project under my account using gcloud auth login, I own the project, so I guess I have all the rights. Similar procedure of getting recognizer succeeded. What's worng?

0 2 902
2 REPLIES 2

Hi @MeowHellYeah,

Welcome back to Google Cloud Community.

It appears that the phrase set you made cannot be located by the `GetPhraseSetRequest` function.

Here are some checking you might perform to resolve the issue you're encountering.

Hi, thanks for reply! Project id, location and phrase set name are correct, I've copied them from the phrase set details page (on the screenshot). My role is owner. I managed to retrieve the phrase set using curl command on step 2 here:

 

curl -X GET -H "Authorization: Bearer $(gcloud auth --impersonate-service-account=$SA_EMAIL print-access-token)" -H "Content-Type: application/json; charset=utf-8" "https://speech.googleapis.com/v1p1beta1/projects/.../locations/global/phraseSets/meow"

 

But it still fails with python google.cloud.speech_v2 package.

One extra note: it is allowed in the web UI to create a phrase set with capital letters in name but get_phrase_set() method raises

google.api_core.exceptions.InvalidArgument: 400 Invalid resource id: Meow. This value should match the regex: [a-z]([a-z0-9-]{0,61}[a-z0-9])?