Author Topic: Sending Corrected Dictation  (Read 1867 times)

0 Members and 1 Guest are viewing this topic.

boutzo

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Sending Corrected Dictation
« on: March 08, 2013, 09:39:56 AM »
I'm trying to do a search on my movie collection.  Right now I'm using  payload dictation.  Here's my problem.

If I say the word "Raiders" with payload dictation no matter how I say it, it usually comes out as "readers" and search return nothing.

But if I use an xml payload with phrase only it will auto correct and change it to "Raiders" because thats what it thought I ment, but it will also send as a payload the entire phrase where all I want was the one word.

Basically is there a way to auto correct based on my movie (phrase.xml) and send that corrected word as payload dictation instead of the entire phrase.



Boutzo
« Last Edit: March 08, 2013, 10:37:57 AM by boutzo »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Sending Corrected Dictation
« Reply #1 on: March 08, 2013, 09:58:52 AM »
I don't think so.  But I think it would help if I understood better, what exactly it is that you are trying to accomplish.

Is it that you want to be able to search for "raiders" and not search for "raiders of the lost ark" ?  Why is that?

Do you want to be able to search for "star" and get a list of all movies from Stargate, Star Trek, Star Wars, etc?

boutzo

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: Sending Corrected Dictation
« Reply #2 on: March 08, 2013, 10:33:14 AM »
Exactly "Star" shows up fine but only returns one phrase that has star in it with phrase.xml.  It's just those words that sound similar "Raiders" translates to "readers" "Cars " (sometimes) translates to "Artist".  My python script goes through my xml file and gets all the movies that has the word I'm looking for in it, if it's the correct word.

But if Raiders translates as readers it will return nothing.  Was looking for something to autocorrect based on my movielist kind of like xbmc loadsmart but for WMC.

Also is there a way to get spoken numbers to show up as numbers.  EX. "21 Jump Street" shows up as "twenty one Jump Street" with dictation or do I have to regex all spoken numbers to numerical numbers ?

Again trying to match what I say againt a list (i.e. Movie Titles) and return best match for just that particular word.
« Last Edit: March 08, 2013, 10:48:22 AM by boutzo »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Sending Corrected Dictation
« Reply #3 on: March 08, 2013, 11:43:53 AM »
No, there is no such thing, except that you can probably work with {LastSpoken} to get the word that you want when using a payloadXML.

So, for example, if you use a command "Search Movies <payloadXML for movies>"

and you say: "Search Movies Raiders", then {1} will be equal to "Raiders of the lost ark" but {LastSpoken} will be equal to "Search Movies Raiders".

so you could then snip off the "Search Movies" to get the other word(s) using regular expressions

I managed to come up with this command that I think will work nicely for you:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="321" name="Search Movies {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <cmdString>{LastSpoken}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <cmdString>movies\s(.*)$</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{Match.1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>filter,scan,search my</phrase>
  <phrase>movies</phrase>
  <payloadFromXML phraseOnly="True" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone">XbmcPayloads\xbmcMovies.xml</payloadFromXML>
</command>

Note that if you change the phrase "movies" to something else you will need to update the regex command to match it.  Also, I guess if you have a movie with the word "movies" in it you could run into some trouble, possibly.

This command only displays the word using OSD.ShowText, but depending on what you are trying to do you can send the word(s) using the {Match.1} variable in some other action.

boutzo

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: Sending Corrected Dictation
« Reply #4 on: March 08, 2013, 01:45:59 PM »
So far so good.  eventghost sends ['Raiders', 'Raiders of the Lost Ark'] How do you only look at the first payload of an array/list?
« Last Edit: March 08, 2013, 01:48:31 PM by boutzo »

boutzo

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: Sending Corrected Dictation
« Reply #5 on: March 08, 2013, 01:52:49 PM »
Nevermind figured it out with python.  So far working like a charm.  Thanks

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Sending Corrected Dictation
« Reply #6 on: March 08, 2013, 03:08:56 PM »
saying "I figured it out" without giving the answer can be quite frustrating for others who may come across a thread so here is the answer:

if you are writing a python script in EventGhost and you have a payload with multiple values in it, you can access the first payload like this:

eg.event.payload[0]

more info here:
http://docs.python.org/2/tutorial/datastructures.html

boutzo

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: Sending Corrected Dictation
« Reply #7 on: March 08, 2013, 07:09:42 PM »
You are correct.  Didn't mean to disrespect the forum.  My apologies.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Sending Corrected Dictation
« Reply #8 on: March 08, 2013, 09:30:08 PM »
No worries.  I'm just trying to set a higher standard  ;)

I can't tell you how many times it has happened to me before on other forums.