private void MergeNodes(PhraseNode existingNode, PhraseNode newNode) { foreach (var newNext in newNode.Next) { if (!newNext.IsPlaceholder) { existingNode.AddNode(newNext); } } }
public void AddNode(PhraseNode node) { var nodeWithSameWord = Next.FirstOrDefault(n => n.BaseWord == node.BaseWord); if (nodeWithSameWord == null) { Next.Add(node); } else { MergeNodes(nodeWithSameWord, node); } }
public void Select(PhraseNode node) { SelectedNodes.Add(node); }
public PhraseTree(PhraseNode root) : this() { Root = root; }