VoiceRec Nuance RecResult ActiveX Parser

This control has no features applicable to VisualConnect application development

Initial Setup Properties

Interpretation_NumSlots

NumResults

Recognized

RecScore

SlotConfidence_NumSlots

 

Runtime Properties

Interpretation_NumSlots

NumResults

Recognized

RecScore

SlotConfidence_NumSlots

Methods

GetRecResults

Interpretation_SlotInterpretation

Interpretation_SlotName

SlotConfidence_SlotName

SlotConfidence_SlotScore

 

Overview

This VBVoice Dynamic RecResult ActiveX DLL (VBVRecResult.dll) parses the VoiceRec control recognition result string into ready to use RecResult ActiveX properties and methods. It is available only for Nuance ASR.

After the Nuance recognition result is received from the VoiceRec control Words(channel) property, pass the string to the Dynamic RecResult ActiveX DLL. RecResult will parse the recognition string into dynamic object-arrays of recognized strings, confidence, slot-names, interpretations, and slot-confidence score.

Setting up the RecResult Parser
  1. Ensure that VBVRecResult.dll is copied and registered in your C:\Winnt\System32 directory

  2. Call regsvr32 command-line argument to register VBVRecResult.dll as follows:

  3. regsvr32.exe vbvrecresult.dll

  4. Open your VBVoice Project

  5. On the Project menu, click References to open the References dialog box

  6. Check Pronexus VBVoice Nuance Recognition Result Parser, then click OK

  7. Place the following code in the Declarations section of your VBVoice application's General Declarations:

  8. Private recRes As RecResult

  9. In similar fashion, add the following code to any event procedures where you have access to the VoiceRec1.Words(channel) property:

Set recRes = New RecResult
'Pass the Words(channel) property to the RecResult ActiveX DLL.
recRes.GetRecResults (VoiceRec1.Words(channel))

You are now ready to retrieve all (if any) RecResult properties and methods.

RecResult Parser and .NET

Note that this RecResult Parser is not supported in .Net. Use the XMLRecResult instead.

Runtime Properties

Interpretation_NumSlots

(Optional index As Integer = 0) As Long

This property contains the current number of slots in the ***INTERPRETATION section of the VoiceRec control Words(channel) property. Interpretation_NumSlots is a 0-based array with the default value set to 0.

EXAMPLE

Assume that VoiceRec1.Words(channel) returns:

***RECOGNIZED 0: "withdraw five hundred dollars from my checking account" (Conf=64 )***INTERPRETATION 0:{<amount 500> <command-type withdraw> <source-account checking>}***SLOTCONFIDENCE 0:{<amount 66> <command-type 73> <source-account 63>}***RECOGNIZED 1: "withdraw five hundred dollars to my checking account" (Conf=64 )***INTERPRETATION 1:{<amount 500> <command-type withdraw> <destination-account checking>}***SLOTCONFIDENCE 1:{<amount 66> <command-type 73> <destination-account 56>}

Dim x As Integer
Set recRes = New RecResult
recRes.GetRecResults (VoiceRec1.Words(channel))
x = recRes.Interpretation_NumSlots ' x = 3

This is the same as calling:

x = recRes.Interpretation_NumSlots(0) ' x = 3

NumResults

() As Long

This property contains the total number of recognition results in order of overall confidence score. If VoiceRec control Do N-Best check-box is selected, NumResults may be greater than 1.

EXAMPLE

Assume that VoiceRec1.Words(channel) returns:

***RECOGNIZED 0: "withdraw five hundred dollars from my checking account" (Conf=64 )***INTERPRETATION 0:{<amount 500> <command-type withdraw> <source-account checking>}***SLOTCONFIDENCE 0:{<amount 66> <command-type 73> <source-account 63>}***RECOGNIZED 1: "withdraw five hundred dollars to my checking account" (Conf=64 )***INTERPRETATION 1:{<amount 500> <command-type withdraw> <destination-account checking>}***SLOTCONFIDENCE 1:{<amount 66> <command-type 73> <destination-account 56>}

Dim x As Integer
Set recRes = New RecResult
recRes.GetRecResults (VoiceRec1.Words(channel))
x = recRes.NumResults ' x = 2

SlotConfidence_NumSlots

(Optional index As Integer = 0) As Long

This property contains the current number of slots in the ***SLOTCONFIDENCE section of the VoiceRec control, Words(channel) property. SlotConfidence_NumSlots is a 0-based array with the default value set to 0.

EXAMPLE

Assume that VoiceRec1.Words(channel) returns:

***RECOGNIZED 0: "withdraw five hundred dollars from my checking account" (Conf=64 )***INTERPRETATION 0:{<amount 500> <command-type withdraw> <source-account checking>}***SLOTCONFIDENCE 0:{<amount 66> <command-type 73> <source-account 63>}***RECOGNIZED 1: "withdraw five hundred dollars to my checking account" (Conf=64 )***INTERPRETATION 1:{<amount 500> <command-type withdraw> <destination-account checking>}***SLOTCONFIDENCE 1:{<amount 66> <command-type 73> <destination-account 56>}

Dim x As Integer
Set recRes = New RecResult
recRes.GetRecResults (VoiceRec1.Words(channel))
x = recRes.SlotConfidence_NumSlots' x = 3

This is the same as calling:

x = recRes.SlotConfidence_NumSlots (0)' x = 3

Recognized

(Optional index As Integer = 0) As String

This property contains the recognized string in the ***RECOGNIZED section of the VoiceRec control, Words(channel) property. Recognized is a 0-based array with the default value set to 0.

EXAMPLE

Assume that VoiceRec1.Words(channel) returns:

***RECOGNIZED 0: "withdraw five hundred dollars from my checking account" (Conf=64 )***INTERPRETATION 0:{<amount 500> <command-type withdraw> <source-account checking>}***SLOTCONFIDENCE 0:{<amount 66> <command-type 73> <source-account 63>}***RECOGNIZED 1: "withdraw five hundred dollars to my checking account" (Conf=64 )***INTERPRETATION 1:{<amount 500> <command-type withdraw> <destination-account checking>}***SLOTCONFIDENCE 1:{<amount 66> <command-type 73> <destination-account 56>}

Dim str As String
Set recRes = New RecResult
recRes.GetRecResults (VoiceRec1.Words(channel))
str = recRes.Recognized

str returns "withdraw five hundred dollars from my checking account"

This is the same as calling:

str = recRes.Recognized (0)

However, calling:

str = recRes.Recognized(1)

str returns "withdraw five hundred dollars to my checking account"

RecScore

(Optional index As Integer = 0) As Long

This property contains the recognized string confidence score from the ***RECOGNIZED section of the VoiceRec control, Words(channel) property. RecScore is a 0-based array with the default value set to 0.

EXAMPLE

Assume that VoiceRec1.Words(channel) returns:

***RECOGNIZED 0: "withdraw five hundred dollars from my checking account" (Conf=64 )***INTERPRETATION 0:{<amount 500> <command-type withdraw> <source-account checking>}***SLOTCONFIDENCE 0:{<amount 66> <command-type 73> <source-account 63>}***RECOGNIZED 1: "withdraw five hundred dollars to my checking account" (Conf=64 )***INTERPRETATION 1:{<amount 500> <command-type withdraw> <destination-account checking>}***SLOTCONFIDENCE 1:{<amount 66> <command-type 73> <destination-account 56>}

Dim x As Integer
Set recRes = New RecResult
recRes.GetRecResults (VoiceRec1.Words(channel))
x = recRes.RecScore'x = 64

This is the same as calling:

x = recRes.RecScore (0) 'x = 64

Methods

GetRecResults

(recStr As String)

This method must be called first, it passes the VoiceRec control recognition result string (VoiceRec1.Words(channel)) property to the RecResult ActiveX DLL and parses it into the appropriate RecResults ActiveX properties and methods.

EXAMPLE

Dim x As Integer
Set recRes = New RecResult
recRes.GetRecResults (VoiceRec1.Words(channel))

Interpretation_SlotInterpretation

(Optional x As Integer = 0, Optional y As Integer = 0) As String

This method returns the slot-interpretation, where x is the NumResults index and y is the Interpretation_NumSlots index. Interpretation_SlotInterpretation is a 0-based array with the default value set to 0.

i.e NumResults(0), Interpretation_NumSlots(0).

EXAMPLE

Assume that VoiceRec1.Words(channel) returns:

***RECOGNIZED 0: "withdraw five hundred dollars from my checking account" (Conf=64 )***INTERPRETATION 0:{<amount 500> <command-type withdraw> <source-account checking>}***SLOTCONFIDENCE 0:{<amount 66> <command-type 73> <source-account 63>}***RECOGNIZED 1: "withdraw five hundred dollars to my checking account" (Conf=64 )***INTERPRETATION 1:{<amount 500> <command-type withdraw> <destination-account checking>}***SLOTCONFIDENCE 1:{<amount 66> <command-type 73> <destination-account 56>}

Dim str As String
Set recRes = New RecResult
recRes.GetRecResults (VoiceRec1.Words(channel))
str = recRes.Interpretation_SlotInterpretation' returns 500

This is the same as calling:

str = recRes.Interpretation_ SlotInterpretation (0, 0)

However, calling:

str = recRes.Interpretation_ SlotInterpretation (0, 1)'returns withdraw

returns "withdraw"

Interpretation_SlotName

(Optional x As Integer = 0, Optional y As Integer = 0) As String

This method returns the interpretation slot-name, where x is the NumResults index and y is the Interpretation_NumSlots index. Interpretation_SlotName is a 0-based array with the default value set to 0.

i.e NumResults(0), Interpretation_NumSlots(0).

EXAMPLE

Assume that VoiceRec1.Words(channel) returns:

***RECOGNIZED 0: "withdraw five hundred dollars from my checking account" (Conf=64 )***INTERPRETATION 0:{<amount 500> <command-type withdraw> <source-account checking>}***SLOTCONFIDENCE 0:{<amount 66> <command-type 73> <source-account 63>}***RECOGNIZED 1: "withdraw five hundred dollars to my checking account" (Conf=64 )***INTERPRETATION 1:{<amount 500> <command-type withdraw> <destination-account checking>}***SLOTCONFIDENCE 1:{<amount 66> <command-type 73> <destination-account 56>}

Dim str As String
Set recRes = New RecResult
recRes.GetRecResults (VoiceRec1.Words(channel))
str = recRes.Interpretation_SlotName' returns amount

This is the same as calling:

str = recRes.Interpretation_SlotName (0, 0)

However, calling:

str = recRes.Interpretation_SlotName (0, 1)'returns command-type

returns "command-type".

SlotConfidence_SlotName

(Optional x As Integer = 0, Optional y As Integer = 0) As String

This method returns the Slot-Confidence slot-name, where x is the NumResults index and y is the SlotConfidence_NumSlots index. SlotConfidence_SlotName is a 0-based array with the default value set to 0.

i.e NumResults(0), SlotConfidence_NumSlots (0).

EXAMPLE

Assume that VoiceRec1.Words(channel) returns

***RECOGNIZED 0: "withdraw five hundred dollars from my checking account" (Conf=64 )***INTERPRETATION 0:{<amount 500> <command-type withdraw> <source-account checking>}***SLOTCONFIDENCE 0:{<amount 66> <command-type 73> <source-account 63>}***RECOGNIZED 1: "withdraw five hundred dollars to my checking account" (Conf=64 )***INTERPRETATION 1:{<amount 500> <command-type withdraw> <destination-account checking>}***SLOTCONFIDENCE 1:{<amount 66> <command-type 73> <destination-account 56>}

Dim str As String
Set recRes = New RecResult
recRes.GetRecResults (VoiceRec1.Words(channel))
str = recRes.SlotConfidence_SlotName' returns amount

This is the same as calling:

str = recRes.SlotConfidence _SlotName (0, 0)

However, calling:

str = recRes.SlotConfidence _SlotName (0, 1)'returns command-type

returns "command-type".

SlotConfidence_SlotScore

(Optional x As Integer = 0, Optional y As Integer = 0) As Long

This method returns the slot-confidence score, where x is the NumResults index and y is the SlotConfidence_NumSlots index. SlotConfidence_SlotScore is a 0-based array with the default value set to 0.

i.e NumResults(0), SlotConfidence_NumSlots (0).

EXAMPLE

Assume that VoiceRec1.Words(channel) returns:

***RECOGNIZED 0: "withdraw five hundred dollars from my checking account" (Conf=64 )***INTERPRETATION 0:{<amount 500> <command-type withdraw> <source-account checking>}***SLOTCONFIDENCE 0:{<amount 66> <command-type 73> <source-account 63>}***RECOGNIZED 1: "withdraw five hundred dollars to my checking account" (Conf=64 )***INTERPRETATION 1:{<amount 500> <command-type withdraw> <destination-account checking>}***SLOTCONFIDENCE 1:{<amount 66> <command-type 73> <destination-account 56>}

Dim x As Integer
Set recRes = New RecResult
recRes.GetRecResults (VoiceRec1.Words(channel))
x = recRes.SlotConfidence_SlotName' returns 66

This is the same as calling:

x = recRes.SlotConfidence _SlotScore(0, 0)

However, calling:

x = recRes.SlotConfidence _SlotScore(0, 1)'returns 73

returns 73.

EXAMPLE

Copy this code in the General Declarations section of a working VBVoice Nuance project

'General Declarations
Option Explicit
Private recRes As RecResult

Copy this code in a VoiceRec control's Exit event.

Private Sub VoiceRec1_Exit(ByVal channel As Integer, Node As Integer)
Dim x As Integer
Dim y As Integer
Debug.Print "Nuance Recognition String = " & VoiceRecEnglish.Words(channel)
Debug.Print ""

Set recRes = New RecResult

'pass nuance recognition string to ActiveX RecResult
recRes.GetRecResults (VoiceRecEnglish.Words(channel))

'setup loop to display all RecResult properties and methods
'use recRes.NumResults to loop for all Recognition's
For x = 0 To recRes.NumResults - 1
'display recRes.Recognized(x)
Debug.Print "recres.Recognized(" & x & ") - " & recRes.Recognized(x)
'display recRes.RecScore(x)
Debug.Print "recres.RecScore(" & x & ") - " & recRes.RecScore(x)

'use recRes.Interpretation_NumSlots(x) to loop for all Interpretations
For y = 0 To recRes.Interpretation_NumSlots(x) - 1
'recRes.Interpretation_SlotName(x, y)
Debug.Print "recres.Interpretation_SlotName(" & x & ", " & y & ") - " & _
recRes.Interpretation_SlotName(x, y)

'recRes.Interpretation_SlotInterpretation(x, y)
Debug.Print "recres.Interpretation_SlotInterpretation(" & x & ", " & y & ") - " & _
recRes.Interpretation_SlotInterpretation(x, y)
Next y

'use recRes.SlotConfidence_NumSlots(x) to loop for all SlotConfidences
For y = 0 To recRes.SlotConfidence_NumSlots(x) - 1
'recRes.SlotConfidence_SlotName(x, y)
Debug.Print "recres.SlotConfidence_SlotName(" & x & ", " & y & ") - " & _
recRes.SlotConfidence_SlotName(x, y)

'recRes.SlotConfidence_SlotScore(x, y)
Debug.Print "recres.SlotConfidence_SlotScore(" & x & ", " & y & ") - " & _
recRes.SlotConfidence_SlotScore(x, y)
Next y
Next x
End Sub

The output would look something like this:

Nuance Recognition String = ***RECOGNIZED 0: "withdraw five hundred dollars from my checking account" (Conf=64 )***INTERPRETATION 0:{<amount 500> <command-type withdraw> <source-account checking>}***SLOTCONFIDENCE 0:{<amount 66> <command-type 73> <source-account 63>}***RECOGNIZED 1: "withdraw five hundred dollars to my checking account" (Conf=64 )***INTERPRETATION 1:{<amount 500> <command-type withdraw> <destination-account checking>}***SLOTCONFIDENCE 1:{<amount 66> <command-type 73> <destination-account 56>}

recres.Recognized(0) - withdraw five hundred dollars from my checking account
recres.RecScore(0) - 64
recres.Interpretation_SlotName(0, 0) - amount
recres.Interpretation_SlotInterpretation(0, 0) - 500
recres.Interpretation_SlotName(0, 1) - command-type
recres.Interpretation_SlotInterpretation(0, 1) - withdraw
recres.Interpretation_SlotName(0, 2) - source-account
recres.Interpretation_SlotInterpretation(0, 2) - checking
recres.SlotConfidence_SlotName(0, 0) - amount
recres.SlotConfidence_SlotScore(0, 0) - 66
recres.SlotConfidence_SlotName(0, 1) - command-type
recres.SlotConfidence_SlotScore(0, 1) - 73
recres.SlotConfidence_SlotName(0, 2) - source-account
recres.SlotConfidence_SlotScore(0, 2) - 63
recres.Recognized(1) - withdraw five hundred dollars to my checking account
recres.RecScore(1) - 64
recres.Interpretation_SlotName(1, 0) - amount
recres.Interpretation_SlotInterpretation(1, 0) - 500
recres.Interpretation_SlotName(1, 1) - command-type
recres.Interpretation_SlotInterpretation(1, 1) - withdraw
recres.Interpretation_SlotName(1, 2) - destination-account
recres.Interpretation_SlotInterpretation(1, 2) - checking
recres.SlotConfidence_SlotName(1, 0) - amount
recres.SlotConfidence_SlotScore(1, 0) - 66
recres.SlotConfidence_SlotName(1, 1) - command-type
recres.SlotConfidence_SlotScore(1, 1) - 73
recres.SlotConfidence_SlotName(1, 2) - destination-account
recres.SlotConfidence_SlotScore(1, 2) - 56
VoiceRec Nuance RecResult ActiveX Parser