Beispiel #1
0
        private PivotIndexItem CreatePivotIndexItemIfNeed(GroupedNGram groupedSyllable)
        {
            if (!_pivotIndex.ContainsKey(groupedSyllable.NGram))
            {
                _pivotIndex[groupedSyllable.NGram] = new PivotIndexItem();
            }

            return(_pivotIndex[groupedSyllable.NGram]);
        }
Beispiel #2
0
 private void CalculateIntersectionForNGram(GroupedNGram groupedNgram, Dictionary <int, double> intersections)
 {
     if (_pivotIndex.ContainsKey(groupedNgram.NGram))
     {
         foreach (IndexedNgramProperty indexedNgramProperty in _pivotIndex[groupedNgram.NGram].IndexedItemReferences)
         {
             if (!intersections.ContainsKey(indexedNgramProperty.WordIndex))
             {
                 intersections[indexedNgramProperty.WordIndex]
                     = Math.Min(groupedNgram.TotalPhraseNGramCount, indexedNgramProperty.NgramCount);
             }
             else
             {
                 intersections[indexedNgramProperty.WordIndex]
                     += Math.Min(groupedNgram.TotalPhraseNGramCount, indexedNgramProperty.NgramCount);
             }
         }
     }
 }