IEnumerator GetQuestion() { WaitForSeconds wait = new WaitForSeconds(5); yield return(wait); Item item = new Item(); while (true) { QuestionStructure question = board.GetQuestion(); awnsers.Clear(); tags.Clear(); item = new Item(); if (question != null) { question.pergunta_texto = question.pergunta_texto.ToLower(); question.pergunta_texto = TextCleaner.CleanText(question.pergunta_texto); Debug.Log("Respondendo: " + question.pergunta_texto); if (item.LoadItem(question.produto_nome)) { Debug.Log("Verficando Tags"); foreach (string key in item.intents.Keys) { if (question.pergunta_texto.Contains(key)) { tags.Add(key); Debug.Log("Tag Encontrada: " + key); awnsers.Add(item.intents[key]); } } if (awnsers.Count > 0) { CreateAwnser(); } else { board.Next(); } } else { Debug.Log("Item nao cadastrado"); } } yield return(wait); } }
public void Register(string id, string description) { description = description.Replace(" : ", ":"); string[] content = description.Split(':'); Item item = new Item(); item.ID = id; for (int i = 0; i < content.Length - 1; i++) { if (i % 2 == 0) { content[i] = TextCleaner.CleanText(content[i]); content[i] = TextCleaner.RemovePonctuation(content[i]); item.AddIntent(content[i], content[i + 1]); } } item.SaveItem(); }