/// <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 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); }
/// <summary> /// The find. /// </summary> /// <param name="par"> /// The par. /// </param> /// <returns> /// The <see cref="T:KeyValuePair{List{String},List{Int32}}"/>. /// </returns> public override sealed KeyValuePair<List<string>, List<int>>? Find(ContentValues par) { var convoluted = (ComplexChain)par.Get(Enum.GetName(typeof(Formalism), Formalism.Sequence)); var 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; var it = new StartIterator(convoluted, windowLen, scanStep); while (it.HasNext()) { it.Next(); fullEntry.Add(it, disp); } CalculateStd(convoluted, windowLen); return DiscardCompositeWords(alphabet, level); }