Пример #1
0
    public List <baseGroceryItemSO> SearchCategoriesSTT(string sentence)
    {
        Dictionary <baseGroceryItemSO.GROCERY_ID, baseGroceryItemSO> groceryList = GroceryItemDatabase.Instance.GetGroceryScriptableObjectDict();

        List <baseGroceryItemSO> groceryWithKeyWords = new List <baseGroceryItemSO>();

        foreach (KeyValuePair <baseGroceryItemSO.GROCERY_ID, baseGroceryItemSO> entry in groceryList)
        {
            baseGroceryItemSO groceryItem = entry.Value;
            if (groceryItem == null)
            {
                continue;
            }

            List <string> groceryKeyword = groceryItem.GetKeywordsString();
            foreach (string keyword in groceryKeyword)
            {
                if (sentence.Contains(keyword))
                {
                    groceryWithKeyWords.Add(groceryItem);
                    break;
                }
            }
        }

        return(groceryWithKeyWords);
    }