Getting ready...

We need to make some adjustments prior to implementing the hierarchical N-Gram predictor.

Add the following member function to the NGramPredictor class:

public int GetActionsNum(ref T[] actions) 
{ 
    string key = ArrToStrKey(ref actions); 
    if (!data.ContainsKey(key)) 
        return 0; 
    return data[key].total; 
} 

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.