NGram

Computes $(LUCKY N-Gram) Model of Input Range range.

If N == 1 this N-gram becomes a standard $(LUCKY Histogram), also called a $(LUCKY Unigram).

If Bin/Bucket Type RequestedBinType, requested by user, is void it will be chosen automatically based on element type of Range.

TODO Add optimized put() be precalculating maximum number of elements that can be inserted without any risk overflow.

struct NGram (
ValueType
int N = 1
Kind kind = Kind.saturated
Storage storage = Storage.denseDynamic
Symmetry symmetry = Symmetry.ordered
RequestedBinType = void
Range
) if (
is(RequestedBinType == void) ||
isUnsigned!RequestedBinType
||
isFloatingPoint!RequestedBinType
) {
enum isBinary;
enum isDense;
enum isSparse;
enum cacheDeepDenseness;
enum getStorage;
enum noABins;
BinType[ValueType[N]] _bins;
StaticBitArray!noABins _bins;
StaticBitArray!noABins[noABins] _bins;
StaticBitArray!noABins[noABins][noABins] _bins;
StaticBitArray!noABins _bins;
StaticBitArray!noABins[] _bins;
StaticBitArray!noABins[][] _bins;
StaticBitArray!noABins[][][] _bins;
StaticBitArray!noABins[][][][] _bins;
BinType[noABins] _bins;
BinType[noABins][noABins] _bins;
BinType[] _bins;
BinType[][] _bins;
BinType[][][] _bins;
BinType[][][][] _bins;
BinType[][][][][] _bins;
BinType[ValueType[N]] _bins;
enum isAA;
ulong _deepDenseness;
}

Alias This

_bins

Members

Aliases

BinType
alias BinType = bool

Determine Bin (Counter) Type.

Functions

denseness
Q denseness(int depth)
inc
NGram inc(ValueType[N] ng)

Increase bin of ng. Bin of ng must already be allocated if its stored in a map.

incs
T incs(T x)

Saturated Increment x by one.

incs
T incs(T x)

Saturated Increment x by one.

invalidateStats
void invalidateStats()

Invalidate Local Statistics.

matchDenser
CommonType!(ulong, BinType) matchDenser(NGram!(rhsValueType, N, rhsKind, rhsStorage, symmetry, RequestedBinType, RhsRange) rhs)

Scalar (Dot) Product Match this with rhs.

opIndex
BinType opIndex(T ng)
opIndexAssign
auto opIndexAssign(T ng)
put
NGram put(ValueType[N] ng)

Put NGram Element ng in this.

put
NGram put(T range)

Put NGram Elements range in this.

typeName
string typeName()

Manifest constants

bitsE
enum bitsE;

Number of Bits in ValueType (element). TODO This may have to be fixed for ref types.

combE
enum combE;

Number of combinations in element.

noBins
enum noBins;

Maximum number of bins (possible).

Meta