Contains a pairs of objects word and its positions.
コード例 #1
0
        /// <summary>
        /// An estimated characteristic of occurrence of the subject word in the sequence
        /// </summary>
        /// <param name="accord">
        /// Checking word.
        /// </param>
        /// <param name="chainLength">
        /// Length of whole sequence.
        /// </param>
        /// <param name="winLen">
        /// Length of the scanning window.
        /// </param>
        /// <param name="minusOne">
        /// Data for "minus one" subword.
        /// </param>
        /// <param name="mid">
        /// Data for "minus two" subword.
        /// </param>
        /// <returns>
        /// Design characteristic of occurrence of the word.
        /// </returns>
        public double DesignExpected(List<string> accord, int chainLength, int winLen, DataCollector minusOne, DataCollector mid)
        {
            int shortWord = 2;
            int midlLength = winLen - 2;
            int minusLength = winLen - 1;

            List<int> left = minusOne.Positions(accord.GetRange(0, accord.Count - 1));
            List<int> right = minusOne.Positions(accord.GetRange(1, accord.Count - 1));
            List<int> middle = midlLength != 0 ? mid.Positions(accord.GetRange(1, accord.Count - 2)) : new List<int>();

            double criteria = -1;
            if (winLen == shortWord)
            {
                criteria = Frequency(left, chainLength, minusLength)
                           * Frequency(right, chainLength, minusLength);
            }
            else if (middle != null)
            {
                criteria = (Frequency(left, chainLength, minusLength)
                            * Frequency(right, chainLength, minusLength))
                           / Frequency(middle, chainLength, midlLength);
            }

            return criteria;
        }
コード例 #2
0
        /// <summary>
        /// The find.
        /// </summary>
        /// <param name="par">
        /// The par.
        /// </param>
        /// <returns>
        /// The <see cref="T:KeyValuePair{List{string},List{int}}?"/>.
        /// </returns>
        public override sealed KeyValuePair<List<string>, List<int>>? Find(ContentValues par)
        {
            var convoluted = (ComplexChain)par.Get(Enum.GetName(typeof(Formalism), Formalism.Sequence));
            double pbalance = (int)par.Get(Enum.GetName(typeof(Parameter), Parameter.Balance)) / 100.0;
            int windowLen = (int)par.Get(Enum.GetName(typeof(Parameter), Parameter.Window));
            var alphabet = (FrequencyDictionary)par.Get(Enum.GetName(typeof(Formalism), Formalism.Alphabet));
            var level = (double)par.Get(Enum.GetName(typeof(Parameter), Parameter.CurrentThreshold));
            int scanStep = 1;
            int disp = 0;
            int length = convoluted.GetLength();

            fullEntry = new DataCollector();
            minusOneEntry = new DataCollector();
            minusTwoEntry = new DataCollector();

            var it = new StartIterator(convoluted, windowLen, scanStep);
            CriterionMethod criteriaCalculator = new ConvolutedCriterionMethod();

            while (it.HasNext())
            {
                it.Next();
                fullEntry.Add(it, disp);
                FindLess(it);
            }

            CalculateStd(convoluted, pbalance, windowLen, length, criteriaCalculator);

            return DiscardCompositeWords(alphabet, level);
        }