public static KnowledgeClassifier <string> Advice(this KnowledgeClassifier <string> classifier, string nodeData, string cls)
        {
            var node = GraphLayerBase.CreateReference(nodeData);

            classifier.Advice(node, cls);
            return(classifier);
        }
Exemplo n.º 2
0
        private static void KnowledgeClassifier()
        {
            var dataLayer = new PresidentLayer();
            var graph     = new ComposedGraph(dataLayer);

            var node1 = graph.GetNode("Barack_Obama");
            var node2 = graph.GetNode("Miloš_Zeman");
            var node3 = graph.GetNode("Michelle_Obama");

            var log = new MultiTraceLog(new[] { node1, node2, node3 }, graph);

            var classifier = new KnowledgeClassifier <string>(graph);

            classifier.Advice(node1, "president");
            classifier.Advice(node2, "president");
            classifier.Advice(node3, "wife");

            var node4 = graph.GetNode("Ivana_Zemanová");
            var node5 = graph.GetNode("Andrej_Kiska");

            var test1 = classifier.Classify(node4);
            var test2 = classifier.Classify(node5);
        }
Exemplo n.º 3
0
        public void SetPattern(IEnumerable <NodeReference> nodes, string pattern)
        {
            //reset default value, because we have advice


            switch (nodes.Count())
            {
            case 0:
                throw new NotSupportedException("Cannot set patter for zero nodes");

            case 1:
                _singleDefaultValue = null;
                SingleNodeClassifier.Advice(nodes.First(), pattern);
                break;

            default:
                //TODO other nodes can be also taken into consideration
                _multiDefaultValue = null;
                MultipleNodesClassifier.Advice(nodes.First(), pattern);
                break;
            }
        }