UP-Viagg-io/Viagg-io/Assets/Scripts/Speech/LoadSpeechData.cs

36 lines
1.0 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LoadSpeechData : MonoBehaviour
{
[SerializeField]
TextAsset intentJson;
private Dictionary<string, string> _dicIntents = new Dictionary<string, string>();
// Start is called before the first frame update
void Start()
{
2025-01-27 16:13:40 +01:00
if (SpeechData.intents.Count > 0)
{
Debug.Log("SpeechData Intents are already set.");
return;
}
IntentList _intentList = JsonUtility.FromJson<IntentList>(intentJson.text);
foreach (IntentData _obj in _intentList.intents)
{
Debug.Log($"IntentID: {_obj.intentID}, Sentences Count: {_obj.intentSentences.Count}");
string _combinedSentences = string.Join(", ", _obj.intentSentences);
_dicIntents.Add(_obj.intentID, _combinedSentences);
Debug.Log($"Added {_combinedSentences} to {_obj.intentID}");
}
SpeechData.intents = _dicIntents;
}
}