Author Topic: Large amount of commands from spreadsheet  (Read 3514 times)

Kalidor

  • Newbie
  • *
  • Posts: 7
Large amount of commands from spreadsheet
« on: April 28, 2017, 04:49:36 AM »
Hi,

I know variants of this have been asked, i've tried to read and understand, but I dont get it. I noted the VAextensions plugin, and it may be what I need but again I don't know howto use it.

So, what I'd like to accomplish is a voice wikipedia sort of thing. So I have a profile and I added over 800 command, but Im going to end up with a hell of a lot more, and I'm thinking it may get too convulated and make it hard for recognition if too many similar commands?

It also make my job a lot easier in a spreadsheet or database or w/e.

So could i have a command to search column a, or b or c for an entry and read the text back via TTS.

A picture might be highlight this:



So the command for row 2 is 'Ayr'ka System' (column A) with the modifiers; information, more information, astronomical data etc

so is there a way to say to VA, "More information Ayr'ka System", and it returns TTS entry of cell C2. or "astronomical Data Ayr'ka system" and it returns cell D2?


Hopefully this makes sense to someone.


Thank you very much for any advice you can give.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Large amount of commands from spreadsheet
« Reply #1 on: April 28, 2017, 08:09:23 AM »
No matter how you get to the data into VoiceAttack, one restriction applies: You have to create the command phrases manually(you could also write a script to generate a .vap file so you can import them, but the point is, you can't do it on-the-fly).

It's not currently possible to dynamically add phrases, and I doubt any speech recognition engine will correctly pick up "Ayr'Ka" without them.


As for the spreadsheet, you've already mentioned VAextensions. If you export to .csv, it would allow you to access fields by row and column numbers, or search for values.

As people have been asking for this, here's a basic example based on the VAExtensions CSV Samples:
Initialize
Code: [Select]
Set Text [VxFile] to 'SpaceWiki.csv'
Set Text [VxDelimiter] to '|'
Execute external plugin, 'VA Extensions 2.0' and wait for return
Begin Small Integer Compare : [VxError] Equals 0
    Write '[Green] File loaded, {INT:VxRowsCount} rows and {INT:VxColumnsCount} columns' to log
End Condition - Exit when condition met
Begin Small Integer Compare : [VxError] Does Not Equal 0
    Write '[Red] {TXT:VxResult}' to log
End Condition - Exit when condition met
This loads the file. You only have to call this when the profile loads(or when the data in the .csv changes while it's already loaded).

One caveat to using .csv, which is a limitation of the format: You have to use an uncommon character as a separator. I suggest pipe("|").
Here's how to change that in Microsoft Excel.

[Information;More Information;Astronomical Data;Jump points;Population;Economy] [Ayr'ka system;Ayr'ka 1;Planet Bob]
Code: [Select]
Set Text [VxFile] to 'SpaceWiki.csv'
Set Text [VxArgs] to '{CMDSEGMENT:1}'
Set integer [VxColumn] value to 1
Execute external plugin, 'VA Extensions 2.0' and wait for return
Begin Small Integer Compare : [VxError] Equals 0
    Begin Small Integer Compare : [VxRow] Equals 0
        Say, 'Value not found'  (and wait until it completes)
    Else
        Write '[Green] Value found at row {INT:VxRow}' to log
    End Condition
End Condition
Begin Small Integer Compare : [VxError] Does Not Equal 0
    Write '[Red] {TXT:VxResult}' to log
End Condition - Exit when condition met
Set integer [VxColumn] value to [Not Set]
Begin Text Compare : [{CMD}] Contains 'Information'
    Set Text [VxColumn] to 'Information'
Else If Text Compare : [{CMD}] Contains 'More Information'
    Set Text [VxColumn] to 'More Information'
Else If Text Compare : [{CMD}] Contains 'Astronomical Data'
    Set Text [VxColumn] to 'Astronomical Data'
Else If Text Compare : [{CMD}] Contains 'Jump points'
    Set Text [VxColumn] to 'Jump Points'
Else If Text Compare : [{CMD}] Contains 'Population'
    Set Text [VxColumn] to 'Population'
Else If Text Compare : [{CMD}] Contains 'Economy'
    Set Text [VxColumn] to 'Economy'
End Condition
Execute external plugin, 'VA Extensions 2.0' and wait for return
Begin Small Integer Compare : [VxError] Equals 0
    Begin Text Compare : [{TXT:VxResult}] Does Not Equal ''
        Say, '{TXT:VxResult}'  (and wait until it completes)
    Else
        Say, 'Not available for this entry.'  (and wait until it completes)
    End Condition
End Condition
Begin Small Integer Compare : [VxError] Does Not Equal 0
    Write '[Red] {TXT:VxResult}' to log
End Condition - Exit when condition met
You still have to modify the command phrase whenever you add a new row or column, but this example will read from the spreadsheet like you asked.


.csv used for testing:
Code: [Select]
Command|Information|More Information|Astronomical Data|Jump Points|Population|Economy
Ayr'ka System|Single star system, Xi'an territory. Primarily a military system focused on supporting, housing, and training Xi'An ground troops. Its close proximity to the Perry Line made it strategically important during the Human / Xi'An cold war. Once relations normalized, Xi'An forces from the Perry Line systems withdrew to here.'||Single Star, Main Sequence Dward-B. system Size 55 Au.|2 Jump points, Ayr'ka t||
Ayr'ka 1|Single star system, Xi'an territory. Primarily a military system focused on supporting, housing, and training Xi'An ground troops. Its close proximity to the Perry Line made it strategically important during the Human / Xi'An cold war. Once relations normalized, Xi'An forces from the Perry Line systems withdrew to here.'|||||
Planet Bob|You can't call a planet "Bob"!|So now you’re the boss. You’re the King of Bob.|Can’t we just call it “Earth”?|No one said you have to live on Bob.|I’m never calling it that.|Titan A.E.
I placed mine in the VAExtensions root directory, so that's where the above example will look for it.


Profile and .csv attached.

Kalidor

  • Newbie
  • *
  • Posts: 7
Re: Large amount of commands from spreadsheet
« Reply #2 on: April 28, 2017, 01:18:04 PM »
Ah I see, so I am able to search the spreadsheet for each cell, but would have to either have a command with all of the spoken commands, or lots of commands one for each.



You have explained it very well and im am incredibly grateful to you for taking the time to create the examples.

Thank you!

Kalidor

  • Newbie
  • *
  • Posts: 7
Re: Large amount of commands from spreadsheet
« Reply #3 on: April 29, 2017, 01:55:33 AM »
double post sry, was unsure if you'd see an edit.

Is there any reason that adding all the command phrases (ayrka, ayrka1, sol, etc) to that one spoken command would be bad form?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Large amount of commands from spreadsheet
« Reply #4 on: April 29, 2017, 12:15:09 PM »
Is there any reason that adding all the command phrases (ayrka, ayrka1, sol, etc) to that one spoken command would be bad form?
Not at all.

The one thing you could argue is that it gets harder to edit the longer the command name becomes, but as the order of items doesn't matter, you can prepend your new entry; E.G. if you have [ayrka;ayrka 1] you can add "sol" at the front: [sol;ayrka;ayrka 1].

If you need to modify something, you can click inside the "When I say" textbox, press CTRL-A to select everything, copy and paste that inside a text editor, and edit it there(especially handy if you need to search the text).


Dynamic Command Sections(the name of this VoiceAttack feature) are shorthand to generate multiple command phrases linked to a single command, so it's intended to be used for this type of thing.