r0ller / alice

A Language Interpreter as semantiC Experiment in natural language processing
8 stars 0 forks source link

drop support for interpreting graphs with more than one head #75

Closed r0ller closed 9 months ago

r0ller commented 9 months ago

There is some code in interpreter::find_dependencies_for_functor() (the one for non-optional deps) that contains code that was meant to support graphs with more than one head. A minimal example for that is when A and B nodes are head (main) nodes and C is a dependency of both but A and B are not related to each other at all. The course of development did not follow that idea and now it poses a problem for nodes with a functor having more than one d_key. Let's extend the previous example to a diamond shape where A is the root, B and C are dependencies of A but B is a dependency of A's functor with d_key 1 and C is a dependency of A's functor with d_key 2. D is a dependency of B and C. When this function processes the dependencies of D (if any), in the end it'll check the node links of D and finds either B or C depending on which direction is processed first. So find_dependencies_for_node() will be called for the node D, registering B or C as it's main node, connecting the nodes in a way like A->B->D->C (or A->C->D->B) which is wrong since it should either be A->B->D or A->C->D.