Author Topic: Results.Replace for a Payload Response  (Read 2051 times)

0 Members and 1 Guest are viewing this topic.

jb5349

  • Jr. Member
  • **
  • Posts: 46
  • Karma: 2
    • View Profile
Results.Replace for a Payload Response
« on: November 19, 2013, 05:08:17 AM »
Hello, I have run into an annoyance that I wasn't sure if a feature existed that would correct it.

I have a payload XML of relationship titles and one of them is "cousins on my moms side". For the TTS.Speak part, after it reads me back {LastResult} from my Map of relationship names to titles, I have it state the payload {1}. The problem is that it is not saying the title using proper grammar. I want it to say "your" instead of "my". I know how to use results.replace to do this but how can I do this on a payload response, even if I sent it to a variable first. Is there a way to do a replace on the payload itself before TTS.Speak or how could I do this?

If it isn't possible yet, maybe a payload1.replace, payload2.replace, etc. would be nice to have for situations where I need to re-phrase something using proper grammar?

Thanks!

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Results.Replace for a Payload Response
« Reply #1 on: November 19, 2013, 06:01:45 AM »
I'm a bit confused with "The problem is that it is not saying the title using proper grammar."
The TTS use that what you are give him as input - so you can change the data in your payload to have the correct grammar. It is possible that I'm wrong, because I don't understand what you want to do - sometimes it is better to post your command group here or you can more explain in which way you want to use your command.
***********  get excited and make things  **********

jb5349

  • Jr. Member
  • **
  • Posts: 46
  • Karma: 2
    • View Profile
Re: Results.Replace for a Payload Response
« Reply #2 on: November 19, 2013, 11:06:42 AM »
Sorry. My payload list contains items that say "Cousins on my Mothers Side" and "Cousins on my Fathers Side". I ask VC "Who are my cousins on my mothers side" and it returns to me a list of their names and says "are your cousins on my mothers side". Well, first of all it isn't VC's cousins we are talking about, therefore I need the payload (currently just using {LastResult} are your {1} to represent response) to respond with "list of names... are your cousins on your mother's side". The simple change from "my" to "your" is what I need to do but with a {1} payload response. I thought of using Results. Replace but that only works for the {LastResult} so what are my other options?

When I said proper grammar, I mean proper english grammar. Restating to someone and referring to "your" vs. "my" is what I was trying to accomplish since VC does not belong to the list of people the user is asking about.

Thanks!

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Results.Replace for a Payload Response
« Reply #3 on: November 19, 2013, 02:57:24 PM »
Ok, a payload.xml can contain phrases and values or only values, depends on what you need.

example:

1. create a command group and give it a name e.g. "relationship"
2. create in this group a command and give it a name
3. open the command and create a logic block that use IF (A)contains(B) -> {LastSpoken} for A and mothers for B -> THEN ->TTS.SpeakSync  {1}, are your cousins on your mothers side  ELSE -> TTS.SpeakSync  {1}, are your cousins on your fathers side
4. create a phrase for the command -> my cousins on my
5. create among them a namesPayload.xml with phrase - mothers side and as value the names separated by a comma like mike, jonny, james, bruce  this is what VC give back in the {1} then a second line with phrase - fathers side and also as value the names separated by a comma and save it.

When you ask VC: Who are my cousins on my mothers side - the logic block check the last spoken and if contains the word mothers it speak the names that is stored as value in the payload for mother side.
Everything is theorie, I'm not at home so I can't test this command, but I hope it will work.  ;)

Kalle


« Last Edit: November 19, 2013, 03:00:06 PM by Kalle »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Results.Replace for a Payload Response
« Reply #4 on: November 19, 2013, 05:16:45 PM »
It would be significantly easier to help you if you would just post your commands and attach your payloadXml.  As it is I still can't figure out what you are doing exactly so I can't suggest a better way to do it.

One thing that might help you is to use Results.SetLastResult so that you can then manipulate the results using actions like Replace.

http://voxcommando.com/mediawiki/index.php?title=Actions#SetLastResult

...but I think if you constructed your command properly you would not need to use it.  Probably you can change the way you are using the payloadXml.

jb5349

  • Jr. Member
  • **
  • Posts: 46
  • Karma: 2
    • View Profile
Re: Results.Replace for a Payload Response
« Reply #5 on: November 20, 2013, 01:08:32 PM »
Thanks Kalleand James for the suggestions. I will give both a try and see what works best. I was planning on posting the finished commands once I worked it out.