Intent Recognizer Function for clearing Intent dictionary

dev
Nadine Ganz 2024-09-17 14:44:02 +02:00
parent 2a0e72ec07
commit e6d0accd34
3 changed files with 195880 additions and 192364 deletions

View File

@ -25,7 +25,11 @@ Tree("32_Grotto_Chatbot_Test") {
Composite(Sequence) {
BTC.Wait(5)
BTC.CompareUserSpeechInputStarted(false)
RunTree("32_Grotto_Chatbot_Test_No_Answer")
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
// Bilder Bergell
//BTC.Run("LoadScene.NEXT.35Slideshow")
}
}
}
@ -41,11 +45,13 @@ Tree("32_Grotto_Chatbot_Test_Compare_Intent") {
Composite(Race) {
Composite(Sequence) {
BTC.CompareIntentID("Story_B_Grotto.Nachfrage_Nonna_Grotto.2")
BTC.ClearPossbileSpeechIntents()
BTC.GetKeyDown("Return")
// ...
}
Composite(Sequence) {
BTC.CompareIntentID("Story_B_Grotto.Nachfrage_Nonna_Grotto.4")
BTC.ClearPossbileSpeechIntents()
BTC.GetKeyDown("Return")
// ...
}
@ -63,11 +69,13 @@ Tree("32_Grotto_Chatbot_Test_Compare_Intent") {
Composite(Race) {
Composite(Sequence) {
BTC.CompareIntentID("Story_B_Grotto.Nachfrage_Nonna_Grotto.2")
BTC.ClearPossbileSpeechIntents()
BTC.GetKeyDown("Return")
// ...
}
Composite(Sequence) {
BTC.CompareIntentID("Story_B_Grotto.Nachfrage_Nonna_Grotto.4")
BTC.ClearPossbileSpeechIntents()
BTC.GetKeyDown("Return")
// ...
}
@ -80,14 +88,6 @@ Tree("32_Grotto_Chatbot_Test_Compare_Intent") {
}
}
Tree("32_Grotto_Chatbot_Test_No_Answer") {
Composite(Sequence) {
// Bilder Bergell
BTC.StopSpeechIntentRecognition()
//BTC.Run("LoadScene.NEXT.35Slideshow")
}
}
Tree("32_Grotto_Kueche_Intro") {
Composite(Sequence) {
BTC.Run("AudioSource.AUDIO.Kueche1FIntro")

View File

@ -609,28 +609,21 @@ public class BTC : MonoBehaviour {
#endif
#endregion
#region SpeechRecognizer
#region Speech Intent Recognizer
private ViaggioAIManager _speechMng { get { return ViaggioAIManager.Instance; } }
private RequestDataModel _requestDataModel = new RequestDataModel();
private string _recognizedIntentID = "";
private bool _onIntentRecognitionInitiatedEventTriggered = false;
private bool _onIntentRecognitionSucceededEventTriggered = false;
private bool _onUserSpeechInputStartedEventTriggered = false;
private bool _onIntentRecognitionFailedEventTriggered = false;
private void OnEnable()
{
_speechMng.OnIntentRecognitionInitiatedEvent += IntentRecognitionInitiatedEventHandler;
_speechMng.OnIntentRecognitionSucceededEvent += IntentRecognitionSucceededEventHandler;
_speechMng.OnUserSpeechInputStartedEvent += UserSpeechInputStartedEventHandler;
_speechMng.OnIntentRecognitionFailedEvent += IntentRecognitionFailedEventHandler;
}
private void IntentRecognitionInitiatedEventHandler(object sender, bool e)
{
_onIntentRecognitionInitiatedEventTriggered = true;
}
private void IntentRecognitionSucceededEventHandler(object sender, string intentID)
{
_onIntentRecognitionSucceededEventTriggered = true;
@ -650,19 +643,16 @@ public class BTC : MonoBehaviour {
[Task]
public void AddPossbileSpeechIntent(string intentID, string intentText)
{
switch (Task.getState)
if (Task.getState == NodeState.FirstRun)
{
case NodeState.FirstRun:
_requestDataModel.PossibleIntents.Add(intentID, intentText);
foreach(var r in _requestDataModel.PossibleIntents)
{
Debug.Log($"Possible Intent: {r.Key}, {r.Value}");
}
_requestDataModel.PossibleIntents.Add(intentID, intentText);
foreach (var r in _requestDataModel.PossibleIntents)
{
Debug.Log($"Possible Intent: {r.Key}, {r.Value}");
}
Task.SetSucceeded();
break;
case NodeState.Aborting:
break;
Task.SetSucceeded();
return;
}
}
@ -758,6 +748,7 @@ public class BTC : MonoBehaviour {
if (Task.getState == NodeState.FirstRun)
{
_requestDataModel.PossibleIntents.Clear();
_recognizedIntentID = "";
Task.SetSucceeded();
return;
}
@ -775,6 +766,11 @@ public class BTC : MonoBehaviour {
}
#endregion
#region Speech Synthesizer
#endregion
#region Oculus Input
#if OCULUSVR_AVAILABLE
[Task]

File diff suppressed because it is too large Load Diff