/// <summary> /// The get taxons value. /// </summary> /// <param name="alphabet"> /// The alphabet. /// </param> /// <returns> /// The <see cref="double"/>. /// </returns> public double GetTaxonsValue(FrequencyDictionary alphabet) { double taxons = 0; List<List<int>> positions = alphabet.GetWordsPositions(); for (int index = 0; index < alphabet.Count; index++) { int countT = positions[index].Count; taxons += (Math.Log(countT) * countT) - countT; } return taxons; }
/// <summary> /// The max frequency. /// </summary> /// <param name="alphabet"> /// The alphabet. /// </param> /// <returns> /// The <see cref="int"/>. /// </returns> private int MaxFrequency(FrequencyDictionary alphabet) { return alphabet.GetWordsPositions().Max(p => p.Count); }
/// <summary> /// The symmetry. /// </summary> /// <param name="alphabet"> /// The alphabet. /// </param> /// <returns> /// The <see cref="double"/>. /// </returns> private double Symmetry(FrequencyDictionary alphabet) { double taxons = 0; double merons = 0; int arrayMaxLength = 0; List<List<int>> positions = alphabet.GetWordsPositions(); for (int index = 0; index < alphabet.Count; index++) { int countT = positions[index].Count; taxons += (Math.Log(countT) * countT) - countT; int arraySize = positions[index].Count; if (arrayMaxLength < arraySize) { arrayMaxLength = arraySize; } } for (int meronIndex = 0, countM = 0; meronIndex < arrayMaxLength; meronIndex++) { for (int index = 0; index < alphabet.Count; index++) { if (positions[index].Count >= meronIndex) { countM = countM + 1; } } merons += (Math.Log(countM) * countM) - countM; countM = 0; } return taxons + merons; }