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

30 lines
883 B
C#
Raw Permalink 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()
{
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;
}
}