Add() 공개 메소드

Maps the specified word to the specified list of cursorPosition in a sequence.
public Add ( string str, List pos ) : void
str string the new word
pos List word's positions in the sequence
리턴 void
 public void AddTest()
 {
     var alphabet = new FrequencyDictionary();
     var alphabetTest = new FrequencyDictionary(chain);
     string[] words = { "A", "G", "C", "T" };
     int power = 1;
     alphabet.Add(words[0], alphabetTest[words[0]]);
     alphabet.Add(words[0], alphabetTest[words[0]]);
     Assert.True(alphabet.Contains(words[0]) && alphabet.Count == power);
 }
        /// <summary>
        /// The cut.
        /// </summary>
        /// <param name="parameters">
        /// The current parameters for segmentation.
        /// </param>
        /// <returns>
        /// The convoluted chain <see cref="ComplexChain"/>.
        /// </returns>
        public override ComplexChain Cut(ContentValues parameters)
        {
            int maxWindowLen = (int)parameters.Get(Enum.GetName(typeof(Parameter), Parameter.Window));
            int windowDec = (int)parameters.Get(Enum.GetName(typeof(Parameter), Parameter.WindowDecrement));

            convoluted = (ComplexChain)parameters.Get(Formalism.GetName(typeof(Formalism), Formalism.Sequence));
            alphabet = new FrequencyDictionary();

            for (int winLen = maxWindowLen; (winLen >= windowDec) && (winLen > 1); winLen -= windowDec)
            {
                bool flag = true;
                while (flag)
                {
                    UpdateParams(parameters, winLen);
                    KeyValuePair<List<string>, List<int>>? pair = WordExtractorFactory.GetSeeker(extractor).Find(parameters);
                    flag = pair != null;
                    if (flag)
                    {
                        pair.Value.Value.Reverse();
                        foreach (int position in pair.Value.Value)
                        {
                            convoluted.Join(position, winLen);
                        }

                        alphabet.Add(Helper.ToString(pair.Value.Key), pair.Value.Value);
                    }
                }
            }

            FindLastWords();

            return convoluted;
        }
        /// <summary>
        /// The clone.
        /// </summary>
        /// <returns>
        /// The <see cref="FrequencyDictionary"/>.
        /// </returns>
        public FrequencyDictionary Clone()
        {
            var alphabet = new FrequencyDictionary();
            for (IEnumerator<string> e = words.Keys.GetEnumerator(); e.MoveNext();)
            {
                string word = e.Current;
                List<int> wordPositions = this[word];
                alphabet.Add(word, new List<int>(wordPositions));
            }

            return alphabet;
        }