Segmenter.Base.Collectors.FrequencyDictionary.GetWords C# (CSharp) Méthode

GetWords() public méthode

Returns a list of words of this FrequencyDictionary. Be careful! The new word can not be added to the end of the list as the data are hashed
public GetWords ( ) : List
Résultat List
        public List<string> GetWords()
        {
            if (words.Count == 0)
            {
                return new List<string>();
            }

            return new List<string>(words.Keys);
        }

Usage Example

        /// <summary>
        /// Calculates the theoretical volume the alphabet for a chain.
        /// </summary>
        /// <param name="chain">
        /// An estimated chain.
        /// </param>
        /// <param name="alphabet">
        /// Current alphabet.
        /// </param>
        /// <returns>
        /// The theoretical volume the alphabet.
        /// </returns>
        public double TheoryVolume(ComplexChain chain, FrequencyDictionary alphabet)
        {
            double f = 0;
            List<string> wordsList = alphabet.GetWords();
            foreach (string word in wordsList)
            {
                double freq = Frequency(chain, word);
                if (freq > f)
                {
                    f = freq;
                }
            }

            double z = chain.GetLength();
            double k = 1 / Math.Log(f * z);
            double b = (k / f) - 1;
            double v = (k * z) - b;
            return v;
        }
All Usage Examples Of Segmenter.Base.Collectors.FrequencyDictionary::GetWords