30 lines
883 B
C#
30 lines
883 B
C#
|
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;
|
||
|
}
|
||
|
}
|