Table of Contents

Class NGram<T>

Namespace
LibGameAI.NGrams
Assembly
NGrams.dll

A regular N-Gram.

public class NGram<T> : INGram<T>

Type Parameters

T

The type of the actions.

Inheritance
NGram<T>
Implements
Inherited Members

Constructors

NGram(int)

Creates a new N-Gram.

public NGram(int nValue)

Parameters

nValue int

The N in N-Gram (window size + 1).

Properties

NValue

The N in N-Gram (window size + 1).

public int NValue { get; }

Property Value

int

Methods

GetActionsFrequency(IReadOnlyCollection<T>)

Return the number of times the given sequence of actions has been seen.

public int GetActionsFrequency(IReadOnlyCollection<T> actions)

Parameters

actions IReadOnlyCollection<T>

Sequence of actions, which must of size N-1.

Returns

int

Number of times the given sequence of actions has been seen.

GetMostLikely(IReadOnlyList<T>)

Get the most likely action given a sequence of actions.

public T GetMostLikely(IReadOnlyList<T> actions)

Parameters

actions IReadOnlyList<T>

The actions list, which should be at least of size N-1.

Returns

T

The most likely action for the given a sequence of actions.

RegisterSequence(IReadOnlyList<T>)

Register a sequence of actions.

public void RegisterSequence(IReadOnlyList<T> actions)

Parameters

actions IReadOnlyList<T>

The actions list, which should be at least of size N.

SequenceToString(IEnumerable<T>)

Converts a sequence of objects to a string.

public static string SequenceToString(IEnumerable<T> actions)

Parameters

actions IEnumerable<T>

Sequence of objects.

Returns

string

String representing sequence of objects.