Phrase Permutation Generator

130 views
Skip to first unread message

Luke Clemens

unread,
Jun 23, 2015, 7:43:49 PM6/23/15
to voice...@googlegroups.com
Just gotta say... Voice Attack rocks!  For us Rifters, keyboards are reduced to a couple of useful keys and if it wasn't for VA, rifting would be so much more frustrating for games with lots of buttons :-)

I started putting together a profile for Elite Dangerous specifically for the Rift a few weeks ago. There are lots of ED profiles out there, but most of them assumed you were using a monitor, and there are certain functions you can do on a monitor that won't work in the Rift. But that's another topic for another group....

While I was putting together command strings, I wanted to make the interpreter as realistic as possible by giving speakers lots of leeway in terms of how people phrase a command.  Accounting for all the variations makes voice interaction much more robust.  Fortunately, VA lets us compose a command string from lots of different ways to say a command. For example you could say:

Lights.
Light on.
Lights on.
Turn lights on.
Turn the lights on.
Turn the ship lights on.
Turn the light on.
Enable lights.
Enable the light.
Enable the spotlight.
Enable the headlights
... and on and on...

I started working through an example and discovered that there are hundreds of ways to phrase the same command that would make sense in the English language. When I'm in the middle of a game, I don't wan't to have to guess the exact phrasing I programmed into the profile.  "Landing gear down.. wait... Deploy the landing gear... no wait... Deploy landing gear... crap, what was it.... Put the landing gear down... hmmm... *CRASH*!! Noooooooo!!"

VA currently has a limited way to combine phrase permutations - a Prefix and a Suffix. That essentially divides the number of permutations you have to type in by two. The beta version recently added wildcard support for full commands (not prefix or suffix). That helps too, but it doesn't fully cover a lot of cases in natural language.

Last weekend I coded an application that helps me generate all the permutations for various phrases.  I called it Phrase Walker :-)  It's fugly, a bit clunky, and some of the buttons don't work, but it has enough functionality such that I used it to nearly complete the Rift-VA profile I'd been working on.

Here's a screenshot:



On the light example, I uses the phrase:

set [The] [Ship] [Light][S] [ToEnabled]

turn [The] [Ship] [Light][S] On

[TurnOn] [The] [Ship] [Light][S]

let there be light


Anywhere that an item in brackets is used, it gets replaced with an incremented value in the series that it represents.  So [The] equates to (*, the), where the * means empty. Light resolves to (light, spotlight, headlight, light switch).  

As you can see in the screenshot, the "Light" example actually came out to 433 permutations - that would have been a lot of typing!  The average phrases turned into about 10 to 20 commands. It makes your .vap file massive though because VA stores each synonym phrase as a separate command in its XML.

All the permutations of your phrase are displayed as you modify settings. The settings get saved to an XML so you can share them and load them up later for editing. In theory it should handle Unicode. I did add support for incremented series of floats and integer values as well, but they probably won't get used much.

I am thinking of making the system into a VA plugin. Right now there's a button to copy the results into a semicolon separated list, which you then paste into VA. Pasting works OK, but maybe there's a way to sync with it via the plugin system. I'll look into the API a bit closer this weekend.  

Gary - if you want to build something like this into the core I can send you the source code.  It's C++, but the main algorithm is completely separated from the GUI so it wouldn't be hard to translate that part of it to C#.  The GUI is written with Qt.  Or perhaps there's a better way to implement a command substitution system in the core with a similar syntax that handles the speech as it comes in, as opposed to generating all the phrases beforehand.  Whatever you do, I think VA could benefit immensely by having the ability to translate more language variations into commands.  PhraseWalker is a very specialized application so I don't really know if it would be of much use to the general gamer, but I could throw together a quick installer if enough people are interested.

--luke

Gary

unread,
Jun 23, 2015, 8:40:04 PM6/23/15
to voice...@googlegroups.com, lcle...@gmail.com
Hi, Luke.  Wow!  That's fantastic :)

I realized the commands could be a little more flexible, so I added some code to make it a little more dynamic.  What I have done has not been exposed for use yet, as I'm still trying to make sure some things work right with it (prefixes/suffixes).  When exposed, commands can look like this (I pulled this out of a recent thread) :

>>
>> [divert; ;reroute] power to [weapons;weapon systems];power up stuff;more power to stuff
>> 
>> Note that the command can still be split by semicolon as usual.  Note that the stuff in the brackets can have a blank -> [divert; ;reroute]... that makes it optional.
>> So, you can say, 'power to weapons', 'divert power to weapons', 'reroute power to weapon systems' 'power to weapon systems', 'power up stuff', 'more power to stuff', etc, etc.
>>

This should cut down on the number of phrases.  The synonyms that are part of one command : fire;open fire;fire weapons should all be in one command (and not split into 3 in the XML).

Nice work on your app :)   There's a lot of work there!  

Gary

Luke Clemens

unread,
Jun 23, 2015, 9:24:44 PM6/23/15
to voice...@googlegroups.com
That's awesome!  The syntax that you're describing could almost fully replace the prefix-suffix paradigm - it's far more power and flexible. I guess the only difference is that people can execute commands for the prefix and suffix part, whereas with the new syntax there is only one set of commands to execute.  I can't really think of where that would be useful, but I suppose some people might use it. I'd be half tempted to ditch it though...

If I had known you already added that functionality, I might not have built mine, but it was fun anyway :-)  Thanks for the heads up though - I think I'll stop development for the time being and actually play the game for a bit - I've been dying to try it out!

P.S.... You should make the "When I say: " edit box into a multi-line text box or give it a button for an optional pop-out window with a bigger multi-line edit or list widget - I think most people are loading that poor little overburdened edit-box up to the max with massive semicolon delimited strings :-)

--

---
You received this message because you are subscribed to a topic in the Google Groups "VoiceAttack" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/voiceattack/mndP-Jy0Krk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to voiceattack...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-
-
-
-
Luke Clemens
http://bytehammer.com

Luke Clemens

unread,
Jun 24, 2015, 4:17:22 PM6/24/15
to voice...@googlegroups.com
Now that I think about it... 

A script writer could just break up a command with that new syntax into two commands and it would do exactly the same things as prefix-suffix combination!  You could setup commands for both parts of the sentence, exactly as before.  As far as I can tell, there is no need to keep the prefix-suffix feature around once you implement the new syntax!

Luke Clemens

unread,
Jul 13, 2015, 11:00:37 AM7/13/15
to voice...@googlegroups.com
If anyone wants it, here is the the Windows 64 bit download link: https://drive.google.com/open?id=0B_OVI76MFavRclNPR0lIQzRDVzA .
Reply all
Reply to author
Forward
0 new messages