private void processorCalculateProbabilitiesInitialState_ErrorProcessEntity(ProbabilityInitialStateWrapper entity, Error error)
 {
     errorsMultithreadedProcess.Add(new WritableTuple<object, Error>(entity, error));
 }
        private Return<object> CalculateProbabilitiesInitialStateDirtyHands(ProbabilityInitialStateWrapper wrapper)
        {
            Return<object> _answer = new Return<object>();
            if (wrapper == null)
            {
                _answer.theresError = true;
                _answer.error = Utility.GetError(new ArgumentNullException("wrapper"), this.GetType());
            }
            else
            {
                try
                {
                    foreach (LanguageIdentificationModelWrapper _fragment in wrapper.fragmentsOfModel)
                    {
                        WritableTuple<string, int> _tuple = wrapper.countBeginningOfSentence.Where(t => t.Item1 == _fragment.initialString).FirstOrDefault();
                        if (_tuple == null)
                            throw new Exception(string.Format("Was impossible to find a combination for {0}", _fragment.initialString));

                        int _numberOfOccurrences = _tuple.Item2;

                        decimal _Pi = (decimal)_numberOfOccurrences / (decimal)wrapper.countSentences;
                        if (_Pi == 0)
                            _Pi = SOFT_PROBABILITY_0;
                        _fragment.probability = _Pi;
                    }
                }
                catch (Exception _ex)
                {
                    _answer.theresError = true;
                    _answer.error = Utility.GetError(_ex, this.GetType());
                }
            }
            return _answer;
        }