void CheckNode(Node node, int multiplyer, Sentence sentence, Dictionary<Variant, int> variants) { foreach (var variant in node.Variants) { if (sentence.Question.Contains(variant.LinkName)) { if (!variants.ContainsKey(variant)) variants.Add(variant, 0); variants[variant] += 1 * multiplyer; } } foreach (var childNode in knowlegeBaseManager.GetChilds(node.Id)) { CheckNode(childNode, multiplyer, sentence, variants); } }
/// <summary> /// конструктор /// </summary> public NodeBuilder() { node = new Node(); }
/// <summary> /// Добавление новой ветви /// </summary> /// <param name="node"> Добавляемая ветвь</param> public void AddNode(Node node) { if (Base.Nodes.Find(x => x.Id == node.Id) != null) throw new Exception("Multiple id entry"); Base.Nodes.Add(node); }