naive-rete
naive-rete copied to clipboard
Function "delete_descendents_of_token" missing
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.
PS: the right_activation
function in negative_node.py
needs to be changed in the same manner as well (line 50).
could you give a test case, i can't remember the detail now :(