/// <summary> /// Updates Score in array and return it /// </summary> /// <param name="startIndex">Start index of term to calculate split set score</param> /// <param name="endIndex">End index of term to calculate split set score</param> /// <returns>Split Set Score</returns> private SplitSetScore PopulateBestSplitSetScore(int startIndex, int endIndex) { for (int startPosition = endIndex; startPosition >= startIndex; startPosition--) { List <SplitPositionWithIdentification> possibleIndexes = TokenDictionary.GetPossibleEndIndexesList(_term, startPosition, endIndex); SplitSetScore bestSplitSetScore = null; for (int currentSplitPosition = startPosition; currentSplitPosition <= endIndex; currentSplitPosition++) { SplitPositionWithIdentification splitPositionWithIdentification = possibleIndexes.FirstOrDefault(x => x.Position == currentSplitPosition) ?? new SplitPositionWithIdentification(currentSplitPosition, SplitIdentification.Unidentified); SplitSetScore splitSetScore = new SplitSetScore(splitPositionWithIdentification, GetBestSplitSetScore(currentSplitPosition + 1), startPosition); if (splitSetScore.IsBetterThan(bestSplitSetScore)) { bestSplitSetScore = splitSetScore; } } _splitSetScores[startPosition] = bestSplitSetScore; } return(_splitSetScores[startIndex]); }