3 instantiations of NGram
Microsoft.Extensions.AI.Evaluation.NLP (3)
Common\NGramExtensions.cs (3)
14
where T : IEquatable<T> =>
new
(values);
39
nGrams.Add(new
NGram
<T>(next));
78
nGrams.Add(new
NGram
<T>(input.Slice(i, s)));
19 references to NGram
Microsoft.Extensions.AI.Evaluation.NLP (19)
Common\BLEUAlgorithm.cs (6)
70
List<
NGram
<string>> hypGrams = hypothesis.CreateNGrams(n);
71
MatchCounter<
NGram
<string>> hypCounts = new(hypGrams);
73
Dictionary<
NGram
<string>, int> maxCounts = [];
77
List<
NGram
<string>> refGrams = rf.CreateNGrams(n);
78
MatchCounter<
NGram
<string>> refCounts = new(refGrams);
93
Dictionary<
NGram
<string>, int> clippedCounts = [];
Common\GLEUAlgorithm.cs (3)
28
MatchCounter<
NGram
<string>> hypNGrams = new(hypothesis.CreateAllNGrams(minN, maxN));
34
MatchCounter<
NGram
<string>> refNGrams = new(reference.CreateAllNGrams(minN, maxN));
37
MatchCounter<
NGram
<string>> overlapNGrams = hypNGrams.Intersect(refNGrams);
Common\NGram.cs (3)
16
internal readonly struct NGram<T> : IEquatable<
NGram
<T>>, IEnumerable<T>
34
public bool Equals(
NGram
<T> other)
37
public override bool Equals(object? obj) => obj is
NGram
<T> other && Equals(other);
Common\NGramExtensions.cs (7)
13
public static
NGram
<T> CreateNGram<T>(this ReadOnlySpan<T> values)
16
internal static List<
NGram
<T>> CreateNGrams<T>(this T[] input, int n)
25
internal static List<
NGram
<T>> CreateNGrams<T>(this ReadOnlySpan<T> input, int n)
33
List<
NGram
<T>> nGrams = [];
48
internal static List<
NGram
<T>> CreateAllNGrams<T>(this T[] input, int minN, int maxN = -1)
58
internal static List<
NGram
<T>> CreateAllNGrams<T>(this ReadOnlySpan<T> input, int minN, int maxN = -1)
72
List<
NGram
<T>> nGrams = [];