/// <summary> /// Calculation method. /// </summary> /// <param name="chain"> /// Source sequence. /// </param> /// <param name="link"> /// Redundant parameter, not used in calculations. /// </param> /// <returns> /// Average word length in <see cref="double"/> value. /// </returns> public double Calculate(Chain chain, Link link) { int chainLength = chain.GetLength(); int sum = 0; for (int i = 0; i < chainLength; i++) { sum += ((ValueString)chain[i]).Value.Length; } return sum / (double)chainLength; }
/// <summary> /// Calculation method. /// </summary> /// <param name="chain"> /// Source sequence. /// </param> /// <param name="link"> /// Link of intervals in chain. /// </param> /// <returns> /// Variations count as <see cref="double"/>. /// </returns> public double Calculate(Chain chain, Link link) { int count = 1; for (int i = 0; i < chain.GetLength(); i++) { var j = chain[i] as ValuePhantom; if (j != null) { count *= ((ValuePhantom)chain[i]).Cardinality; } } return count; }
/// <summary> /// Calculation method. /// </summary> /// <param name="chain"> /// Source sequence. /// </param> /// <param name="link"> /// Redundant parameter, not used in calculations. /// </param> /// <returns> /// Cut length vocabulary entropy as <see cref="double"/>. /// </returns> public double Calculate(Chain chain, Link link) { return Math.Log(chain.GetLength() - cutLength.Calculate(chain, link) + 1, 2); }
/// <summary> /// Calculation method. /// </summary> /// <param name="chain"> /// Source sequence. /// </param> /// <param name="link"> /// Redundant parameter, not used in calculations. /// </param> /// <returns> /// Chain length as <see cref="double"/>. /// </returns> public double Calculate(Chain chain, Link link) { return chain.GetLength(); }