Author Topic: Single digit recognition for callsigns  (Read 8874 times)

Max

  • Guest
Single digit recognition for callsigns
« on: June 26, 2016, 07:06:35 PM »
I'm trying to use VA with an air traffic control simulator.  In order to do so, I need to recognize things like:

UNITED FIVE SIX DESCEND AND MAINTAIN FLIGHT LEVEL ONE EIGHT ZERO

I've been trying to figure this out for a while with no success.  I've been able to cobble together something that will recognize the above, but only with unrealistic pauses between parts, like:

UNITED /pause/ FIVE /pause/ SIX /pause/ DESCEND AND MAINTAIN FLIGHT LEVEL /pause/ ONE /pause/ EIGHT /pause/ ZERO

Is there any way to recognize and parse something akin to a regex expression? For instance, something like:
[UNITED|SOUTHWEST]([0..9]*)(DESCEND AND MAINTAIN FLIGHT LEVEL [0..9]*|DIRECT TO (SAX|TEB|EWR))
and so on...

I've tried thing like: When I say "UNITED [0..9999]", but that apparently generates 10k recognition items in VA, and of course that's not viable with even one or two airlines...

It would even be fine if it would recognize phrase by phrase of the above, like:
UNITED FIVE SIX /pause/ DESCEND AND MAINTAIN FLIGHT LEVEL ONE EIGHT ZERO

Has anybody done anything like this?

yxpoh

  • Guest
Re: Single digit recognition for callsigns
« Reply #1 on: July 09, 2016, 12:15:25 AM »
EDIT: Actually ignore if you saw the message previously, found out you can actually try the attached.

I used "break" in the command to simplify searching the cmd for its parts if you get my gist.
« Last Edit: July 09, 2016, 04:14:34 AM by yxpoh »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Single digit recognition for callsigns
« Reply #2 on: July 09, 2016, 08:05:20 AM »
I've tried thing like: When I say "UNITED [0..9999]", but that apparently generates 10k recognition items in VA, and of course that's not viable with even one or two airlines...

yxpoh, have a look at the "derived commands" counter at the bottom of the command list(hover over the "X commands" label).

yxpoh

  • Guest
Re: Single digit recognition for callsigns
« Reply #3 on: July 09, 2016, 10:26:13 PM »
Are you referring to Max comment? Or are you telling me something?

That aside, that is something new that I learnt.
Thanks.

Max

  • Guest
Re: Single digit recognition for callsigns
« Reply #4 on: July 10, 2016, 11:01:49 AM »
Thanks yxpoh and Pfiel.  I'll try yxpoh's solution, but it kinda breaks the immersion with that "break" in there.  It's better than anything I've come up with so far though, so thanks!

Pfeil, I'll check out the derived commands section too for something I might have missed.


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Single digit recognition for callsigns
« Reply #5 on: July 10, 2016, 11:39:46 AM »
it kinda breaks the immersion with that "break" in there.
If you're referring to the "break" in "DESCEND AND MAINTAIN FLIGHT LEVEL [0..9] [0..9] break [0..9]", you can omit that. For me at least, recognition works just as well without it.

If you need the flight level as a numeric value, you can use this:
Code: [Select]
Set Text [CMD] to '{CMD}'
Set small int (condition) [FlightLevel] value to the converted value of {TXTNUM:CMD}

are you telling me something?
I'll check out the derived commands section too for something I might have missed.
The point is that many permutations will eventually bog down recognition to the point it becomes unusable.

I checked, the command count totals 1100 for just those two. Separating the callsign and the instruction does lower the amount of combinations significantly, as you'd expect.

You can experiment, but eventually recognition performance will degrade as the amount of phrases it needs to process increases. Every 3 digit phrase adds 1000 permutations, every 2 digit phrase adds 100.

In addition, you'll need to pause between phrases(E.G. "SOUTHWEST 11" pause "CLIMB AND MAINTAIN FLIGHT LEVEL 1 1 break 1" pause "DIRECT TO SAX"), which is better than having to do so every digit, but still unnatural for an ATC.


yxpoh, as an aside, and as you can see in the OP, there's no need to specify all the numbers in a a consecutive sequence; You can use "[0..9]" instead, in this case.

You can also use these ranges as part of a permutation, as long as they're in brackets: "SOUTHWEST [0..8;Niner] [0..8;Niner]"
In which case you need to use
Code: [Select]
Set Text [CMD] to '{CMD}'
Set Text [CMD] to '{TXTREPLACE:CMD:niner:9}'
Set small int (condition) [FlightLevel] value to the converted value of {TXTNUM:CMD}
To get the numeric value.


Note that "{TXTREPLACE:}" is deprecated, so if you want to play it by the book that'd be
Code: [Select]
Set Text [CMD] to '{CMD}'
Set Text [niner] to 'niner'
Set Text [9] to '9'
Set Text [CMD] to '{TXTREPLACEVAR:CMD:niner:9}'
Set small int (condition) [TargetAltitude] value to the converted value of {TXTNUM:CMD}

yxpoh

  • Guest
Re: Single digit recognition for callsigns
« Reply #6 on: July 10, 2016, 09:08:26 PM »
@Pfeil
Ah, I see what you meant.
Thanks.

That last portion was quite mind-blowing for me :P, but I think I get what it is trying to do.

That aside, the reason for "break" was because I couldn't think of other method to check for the middle number if it is supposed to trigger something.

As I have no knowledge of ATC, I assume each number can mean different thing.

Quote
DESCEND AND MAINTAIN FLIGHT LEVEL [0..9] [0..9] [0..9]
DESCEND AND MAINTAIN FLIGHT LEVEL 3 3 3

Like I used "Starts with" to check for the first number
E.g. "DESCEND AND MAINTAIN FLIGHT LEVEL 3" to check for the first 3 and triggering something for number 3

And used "Ends with" to check for the last number,
E.g. "3" to check for the third 3 and triggering something for the last 3 too.

But for the middle one, I can only used "contains" but that might trigger even if the first or last is 3.
E.g.DESCEND AND MAINTAIN FLIGHT LEVEL 3 3 break 3

So I added break so as to check if the {CMD} contains "3 break" and then to trigger something for the middle 3.
As you can see in one of my screenshots.

I am at open ears if there is a better method for the middle number. (Might have missed out something because I was too bounded to the current method.)

@Max
No problem. I learnt a lot trying to solve your problem, as it piqued my interest.

Sadly, prefix and suffix couldn't be used here unless I increase the waiting time of the command to complete in the global setting, but that might cause other short commands to take longer to execute.
Otherwise, It would have been a continuous complete command. haha..

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Single digit recognition for callsigns
« Reply #7 on: July 10, 2016, 10:07:55 PM »
That aside, the reason for "break" was because I couldn't think of other method to check for the middle number if it is supposed to trigger something

I am at open ears if there is a better method for the middle number. (Might have missed out something because I was too bounded to the current method.)

In this particular case, you know there will always be 3 digits, so you don't need to worry about how many characters to retrieve. Therefore, this will work:
CLIMB AND MAINTAIN FLIGHT LEVEL [0..8;Niner] [0..8;Niner] [0..8;Niner]
Code: [Select]
Set Text [CMD] to '{CMD}'
Set Text [Find] to 'niner'
Set Text [Replace] to '9'
Set Text [CMD] to '{TXTREPLACEVAR:CMD:Find:Replace}'
Set Text [CMD] to '{TXTNUM:CMD}'
Set small int (condition) [Digit1] value to the converted value of {EXP:SUBSTRING('{TXT:CMD}',1,1)}
Set small int (condition) [Digit2] value to the converted value of {EXP:SUBSTRING('{TXT:CMD}',2,1)}
Set small int (condition) [Digit3] value to the converted value of {EXP:SUBSTRING('{TXT:CMD}',3,1)}

Some clarification:

Assuming a command phrase "climb and maintain flight level 2 niner 0"
Code: [Select]
Set Text [CMD] to '{CMD}'
Set Text [Find] to 'niner'
Set Text [Replace] to '9'
Set Text [CMD] to '{TXTREPLACEVAR:CMD:Find:Replace}'
This section remains the same, to convert "niner" to "9".
CMD = "climb and maintain flight level 2 9 0"

Code: [Select]
Set Text [CMD] to '{TXTNUM:CMD}'
This strips all characters aside from numbers.
CMD = "290"

Code: [Select]
Set small int (condition) [Digit1] value to the converted value of {EXP:SUBSTRING('{TXT:CMD}',1,1)}
Set small int (condition) [Digit2] value to the converted value of {EXP:SUBSTRING('{TXT:CMD}',2,1)}
Set small int (condition) [Digit3] value to the converted value of {EXP:SUBSTRING('{TXT:CMD}',3,1)}
"{EXP:SUBSTRING('{TXT:CMD}',X,1)}" will select part of the "CMD" text value, from X position, for the length of 1 character.
Digit1=2
Digit2=9
Digit3=0

yxpoh

  • Guest
Re: Single digit recognition for callsigns
« Reply #8 on: July 11, 2016, 04:31:58 AM »
Oh.. I see.

Thanks. really learn a lot, even though I didn't open this thread.
:P

Sorry if it feels like I am hijacking the thread...