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
) {}

Constructors

this
this(Range range)
Undocumented in source.

Alias This

_bins

Members

Aliases

BinType
alias BinType = bool

Determine Bin (Counter) Type.

BinType
alias BinType = uint64_t
Undocumented in source.
BinType
alias BinType = RequestedBinType
Undocumented in source.
Q
alias Q = Rational!ulong
Undocumented in source.

Functions

denseness
Q denseness(int depth)
densenessUncached
Q densenessUncached(int depth)
Undocumented in source. Be warned that the author may not have intended to support it.
empty
bool empty()
Undocumented in source. Be warned that the author may not have intended to support it.
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.

normalize
void normalize()
Undocumented in source. Be warned that the author may not have intended to support it.
opAssign
typeof(this) opAssign(NGram!(ValueType, N, kind, storage, symmetry, RequestedBinType, RhsRange) rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
auto opBinary(NGram rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
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.

reset
void reset()
Undocumented in source. Be warned that the author may not have intended to support it.
shallowDenseness
Q shallowDenseness()
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.
typeName
string typeName()
value
auto ref value()
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

bitsE
enum bitsE;

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

cacheDeepDenseness
enum cacheDeepDenseness;
Undocumented in source.
combE
enum combE;

Number of combinations in element.

getStorage
enum getStorage;
Undocumented in source.
isAA
enum isAA;
Undocumented in source.
isBinary
enum isBinary;
Undocumented in source.
isDense
enum isDense;
Undocumented in source.
isSparse
enum isSparse;
Undocumented in source.
noABins
enum noABins;
Undocumented in source.
noBins
enum noBins;

Maximum number of bins (possible).

Properties

order
int order [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_bins
BinType[ValueType[N]] _bins;
Undocumented in source.
_bins
StaticBitArray!noABins _bins;
Undocumented in source.
_bins
StaticBitArray!noABins[noABins] _bins;
Undocumented in source.
_bins
StaticBitArray!noABins[noABins][noABins] _bins;
Undocumented in source.
_bins
StaticBitArray!noABins _bins;
Undocumented in source.
_bins
StaticBitArray!noABins[] _bins;
Undocumented in source.
_bins
StaticBitArray!noABins[][] _bins;
Undocumented in source.
_bins
StaticBitArray!noABins[][][] _bins;
Undocumented in source.
_bins
StaticBitArray!noABins[][][][] _bins;
Undocumented in source.
_bins
BinType[noABins] _bins;
Undocumented in source.
_bins
BinType[noABins][noABins] _bins;
Undocumented in source.
_bins
BinType[] _bins;
Undocumented in source.
_bins
BinType[][] _bins;
Undocumented in source.
_bins
BinType[][][] _bins;
Undocumented in source.
_bins
BinType[][][][] _bins;
Undocumented in source.
_bins
BinType[][][][][] _bins;
Undocumented in source.
_bins
BinType[ValueType[N]] _bins;
Undocumented in source.
_deepDenseness
ulong _deepDenseness;
Undocumented in source.

Meta