Comments (9)
All I needed was to read out numbers, so I got what I needed by doing 'my number'.split('').join(' ')
and it correctly reads the numbers for me.
from actions-on-google-nodejs.
Yes you're correct that you need to wrap your entire spoken statement in open and close tags (i.e., <speak>...</speak>
). As for the say-as
tags, what you have (assistant.ask('<speak>We found Product <say-as interpret-as=\"characters\">ABC1</say-as> - Bottle</speak>')
) should work. I just tested in the web sim and got the expected result. Try putting this string directly in APIAI as a text response and see if it works there, that might be helpful to debug.
from actions-on-google-nodejs.
API.AI has no problem reading the string.
// Google Home says: "We found Product Bottle"
assistant.tell('<speak>We found Product <say-as interpret-as=\"characters\">ABC1</say-as> - Bottle</speak>');
Response: {
"response": "We found Product<unknown word to simulator>- Bottle\n",
"debugInfo": {
"agentToAssistantDebug": {
"agentToAssistantJson": {
"conversation_token": "[]",
"expect_user_response": false,
"final_response": {
"rich_response": {
"items": [{
"simple_response": {
"ssml": "<speak>We found Product <say-as interpret-as=\"characters\">ABC1</say-as> - Bottle</speak>"
}
}]
}
}
}
}
}
}
from actions-on-google-nodejs.
Hi @ds8k, sorry for the late response on this. I think the issue might be that the SSML transducer doesn't understand 'ABC1' as a character string. Just 'ABC' does work. Try moving the '1' outside the say-as tags. In my testing, I didn't need the say-as tags at all.
from actions-on-google-nodejs.
@smishra2 That sounds like it would become a major problem, especially if "ABC1" is being pulled from a database or outside source of some sort...
from actions-on-google-nodejs.
Any update on this one @ds8k @smishra2 ? I have a long number that I want Google Assistant to speaks as individual digits and it is giving me same 'unknown word to simulator' error. It is strange @smishra2 if it does not work with numbers because example on official actions documentation uses numbers. Here is the link
from actions-on-google-nodejs.
@ds8k @nominator A temporary alternative may be to use a utility function to generate the tags that you need, at least until this bug is acknowledged and fixed.
Something similar to this maybe?
const sayAsCharacters = (text) => {
let ret = '';
let chars = text.split('');
let c = '';
while(c = chars.shift()) {
let prevChar = ret.slice(-1);
if (isNaN(parseInt(c))) {
if (!isNaN(parseInt(prevChar)) || !prevChar) {
ret += ` <say-as interpret-as="characters">`;
}
ret += c;
if (chars.length === 0) ret += `</say-as> `;
} else {
if (isNaN(parseInt(prevChar))) ret += `</say-as> ${c}`;
else ret += ` ${c}`;
}
}
return ret;
};
The above produces the following:
sayAsCharacters('foo12bar');
" <say-as interpret-as="characters">foo</say-as> 1 2 <say-as interpret-as="characters">bar</say-as> "
from actions-on-google-nodejs.
I've got a number like 982968761 that I want to have read as characters: 9 8 2 9 6... not "nine hundred eighty two million, ..."
Using this should work, but doesn't:
<speak>
The code is: <say-as interpret-as="characters">982968761</say-as>
</speak>
from actions-on-google-nodejs.
@glittle Please see my solution and let me know if it works for you.
from actions-on-google-nodejs.
Related Issues (20)
- Support configuring loggers HOT 1
- Sign homegraph request using IAM API HOT 2
- Link Out Suggestion not working as expected
- smarthome Action: onSync response is invalid (according to GCP logs explorer) HOT 1
- How to bypass middleware and only get JSON response HOT 1
- queryText being sent to Dialogflow is not the original user query HOT 4
- Response is malformed HOT 1
- Smart Home: Cache authorization tokens HOT 14
- Smart Home: Allow to set https agent options HOT 1
- Error, Entity not found
- TypeError: Cannot read property '0' of undefined HOT 1
- npm audit has been reporting vulnerabilities since at least October 2020, please can we update dependencies? HOT 7
- account link success but action response error
- onDisconnect bug
- unable to trigger actions.intent.NO_MATCH HOT 2
- Can't find user access token in requests to fulfilment webhooks HOT 1
- Upgrade "google-auth-library" dependency to latest major version
- TypeError: Cannot read properties of undefined (reading '0')
- Turtorial on authentication
- Typescript doesn't compile with `strictNullChecks: true`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from actions-on-google-nodejs.