public void Merge(NGramNode <TSymbol> toBeMerged)
 {
     if (_children != null)
     {
         foreach (TSymbol symbol in _children.Keys)
         {
             if (toBeMerged._children.ContainsKey(symbol))
             {
                 _children[symbol].Merge(toBeMerged._children[symbol]);
             }
         }
         foreach (TSymbol symbol in toBeMerged._children.Keys)
         {
             if (!_children.ContainsKey(symbol))
             {
                 _children[symbol] = toBeMerged._children[symbol];
             }
         }
     }
     _count += toBeMerged.GetCount();
 }
Exemple #2
0
 /**
  * <summary>Gets count of given sequence of symbol.</summary>
  * <param name="symbols">sequence of symbol.</param>
  * <returns>count of symbols.</returns>
  */
 public int GetCount(TSymbol[] symbols)
 {
     return(rootNode.GetCount(symbols, 0));
 }