Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to only use one intent at a time? #83

Open
luketurnerdev opened this issue Feb 7, 2023 · 10 comments
Open

Is it possible to only use one intent at a time? #83

luketurnerdev opened this issue Feb 7, 2023 · 10 comments

Comments

@luketurnerdev
Copy link

Hi there!

I have two intents setup in my Wit.ai configuration: reciteWord and reciteSentence.

  • Recite word is trained on a list of keywords (single words) and if the user says one of those keywords, the Response matcher comes back successfully.
  • Recite sentence is also trained on keywords (longer phrases) and behaves the same.

However, some words (e.g., "I") are also contained in phrases (e.g., "I Like Pizza"). Wit then matches the "I" as a recitedWord (entity) and ignores the recitedSentence, which is what I want.
wit

The intent in the response matcher is set to recite_sentence (see pic) but the JSON response that comes back still only matches recitedWords.

Also attached is my entity setup in Wit.
wit2

Any help would be appreciated!

@ChrisyShine
Copy link

@luketurnerdev Can you share the wit app id?

@luketurnerdev
Copy link
Author

luketurnerdev commented Feb 7, 2023

@ChrisyShine 471818378315989

@ChrisyShine
Copy link

If the sentence is for a purpose, why do you need to annotate the whole sentence as an entity? Is the intent recite_sentence enough?
So the annotation will be something like: The whole sentence is annotated as recite_sentence and some words within the sentence is annotated with recitedWords entities.

@luketurnerdev
Copy link
Author

@ChrisyShine Thank you for your response. I have removed recitedSentence as an entity, but i'm unsure how to access the callback for an intent.

Here is the current flow:

  1. User speaks a sentence.
  2. Wit recognizes the sentence as an intent (see pic)
    image
  3. I have added both the name of the intent, and the words uttered under Value Matchers (see pic):
    image
  4. I have added a callback method to On Multi Value Event
  5. Callback is never triggered.

Are intents handled differently than entities (perhaps formatted value events instead)? Please help me understand how to setup this callback to be triggered in much the same way.

Your help is much appreciated!

@yolanother
Copy link
Contributor

yolanother commented Feb 10, 2023

image

If you only want to match on one intent you should use the intent value above instead of a value matcher for the intents. Otherwise you'll need to make sure your first value matcher is set to require value.

This is likely what you are after:
image

@yolanother
Copy link
Contributor

I also noticed something else about your screenshots above. The paths you are using in your response matchers are incorrect and won't match values. I'd recommend using the Understanding Viewer to add matchers to the component as in the following screenshot.

image

If you wanted to process multiple intents you could do something like the following:
image

Note: if you want the value to match and be required to match you need to check "Content Required"

@luketurnerdev
Copy link
Author

Hi @yolanother , thanks very much for your response.

I have setup my Response Matcher as closely as I could to yours:

image

However,

  1. I notice that several options are not available, e.g., path, comparison method, etc. I have updated to the latest version of this package using package manager and am running Windows 11. I'm not sure where these other options are from?

  2. I also am unsure how to access the intent once it has been registered. Previously I put a callback into On Multi Value Event (see pic), but clearly the intent callbacks must be registered elsewhere? I would expect to see something like On Value Match (String), but no such option exists. I'd like to be able to use a function like the following, except with only a single string value instead of a String[] array:

image

Apologies for the many questions, I just couldn't seem to find the documentation for this, and the Shapes tutorial only covered the use of entities.

@yolanother
Copy link
Contributor

It is odd that you can't see the additional fields, they are in all versions of VSDK. Do you have any additional assets installed that effect how UI is rendered like Odin? What version of Unity are you running?

The intent won't show up in the values string array, you will need to use the value matcher and its event above that to get the value. There is another way to do it. You could match with a [MatchIntent] attribute instead of using a value matcher. If you do that you can get direct access to the wit response in your method.

EX:
[MatchIntent("recite_sentence")] public void StartWordCheck(WitResponseNode response) { var transcription = response.GetTranscription(); }

@luketurnerdev
Copy link
Author

Thanks for the quick response, I am running Unity 2022.1.4f1 and don't have any additional UI addons. I deleted and reinstalled the latest version of Wit from the Github repo, didn't seem to help.

I don't seem to have a place to enter callback events for intents in the GUI that I can see, but calling it from the script worked with your example, thank you!

Is there a full API documentation somewhere? Or at least somewhere in the source code you can point me to where the main intent functions are defined? Would be very helpful.

Thanks again!

@yolanother
Copy link
Contributor

Ok, we'll give 2022.1.4 a try. I would recommend using Voice SDK instead of wit-unity directly. Wit-unity is a submodule of Voice SDK and is meant for bleeding edge development. It won't always build.

Docs: https://developer.oculus.com/documentation/unity/voice-sdk-overview/
VSDK Download: https://developer.oculus.com/downloads/package/oculus-voice-sdk/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants