naive-rete icon indicating copy to clipboard operation
naive-rete copied to clipboard

Function "delete_descendents_of_token" missing

Open Cybernetic1 opened this issue 5 years ago • 2 comments

In file ncc_node.py, line 65:

Token.delete_token_and_descendents(token)

should actually be Token.delete_descendents_of_token(token).

This function is explained in [Doorenbos 1995] section 2.8 (p.49). The pseudo-code is in p.158 of Appendix A.

Just add this function in Python, under class Token, in common.py:

@classmethod
def delete_descendents_of_token(cls, t):
    """
    :type t: Token
    """
    while t.children != []:
        cls.delete_token_and_descendents(t.children[0])

When the bug is not fixed, we get some errors when an NCC Partner node tries to delete tokens and complains that the tokens are not in the list.

Cybernetic1 avatar Sep 19 '19 12:09 Cybernetic1

PS: the right_activation function in negative_node.py needs to be changed in the same manner as well (line 50).

Cybernetic1 avatar Sep 20 '19 09:09 Cybernetic1

could you give a test case, i can't remember the detail now :(

dbbbit avatar Nov 28 '19 03:11 dbbbit