-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug matching relex2logic rule constant #23
Comments
'all' can't be defined as a variable like the 2nd part in TENSEPOS rule. In LogicProcessor the checkRuleApplicability function create variables secondVariableName and secondVariableValue then it set the name of the node to variable secondVariableValue and the second part of the criteria to variable secondVariableName .. for later use I think it prints "I just recorded the value of 'all' to be 'all'" for debugging purpose |
is there a fix forthcoming? |
Just to make it more clear (instead of seeing "all" everywhere), here's the result of "some", which also has _quantity: Matching rule 'ALLRULE1'... "all" is treated as a variable instead of constant and get replaced as "some". The foundNode.isValued() check is somehow returning false, instead of true. |
For the sentence "John is a boy.", the gender-rule is failing too: Matching rule 'GENDER'... It looks like a problem with determining what is valued and what is not? Right now it looks like Dependency relations (those with underscores like _obj and _subj) are always non-valued, while Attributes (those without underscores) is usually valued with some exception (like tense). It looks like the bug is happening much earlier than Relex2Logic. Perhaps this is related to issue #26 |
Actually, why would we even use whether a FeatureNode is valued or not as a prerequisite for whether to treat a variable in ruleCriterium as a constant? Shouldn't we first check whether ruleCriterium.getSecondVariableName() is a constant (with or without the $ sign). If it is a constant, we try to match with foundNode.getValue() or foundNode.get("name").getValue(). Right now it looks like defining a rule with _quantity($a, $b), _quantity($a, b), _quantity(+a, +b), etc, will all be treated the same, since the $ sign isn't checked. |
Hi William, I agree with you. The $ sign should be checked to distinguish the variables from the constants... It seems to me that the failing of matching GENDER rule is also caused by not dealing with $ well enough, as $gender is not a constant, it should be matched while applying the GENDER rule. The value of the $gender will be replace in the helper function. (define (gender-rule word word_instance gender_type) If I understand correctly that what you meant by "what is valued" is about the constant and variable problems as well. So the constants should be valued, and the variables shouldn't be valued... I think it's correct that _obj, _subj etc dependency relations are non-valued because they are variables instead of constants... _subj($x, $y), _obj($x, $z).. However, I don't understand while the tense is usually valued. |
Sorry, it seems that I misunderstood about the "what is valued" problem... I think the point of detecting if the FeatureNode is valued or not is to traverse the whole FeatureStructure to check what kind of rules can be applied for each FeatureNode, not for treating a variable in ruleCriterium |
This issue is being discussed in a distinct email thread. Some excerpts: I said: William replied: I plan to reply: "relex does not know what a variable or a constant is; it does not have these concepts. Certainly, isValued() will not tell them apart, whatever these concepts may be." really -- I have no idea .. what is a 'variable' and what is a 'constant' ??? |
William Ma then states: Unless I completely misunderstood the expected result of Relex2Logic, right now multiple-conditional (and rules with constant) only seems to work randomly if one of the condition happens to be isValued? For single-conditional rules the method might be OK." |
Ah, so then variables are a concept untroduced by the relex2logic pattern matcher... makes sense. |
(Github is mangling the comments below. Hit the pencil icon in upper right to view them.) Hi All, On 8 May 2014 23:03, William Ma [email protected] wrote:
OK, that's just bizarre, that's some kind of bug. Relex itself does not have a concept of 'variable' and 'constant'; they're indistinguishable. From what I can tell, relex2logic introduces a new kind of pattern matcher, If the below is really the issue, then the relex2logic pattern matcher will Hard not to say "gee, well, I told you so" .... as I did ...
|
Linas, I don't think the needed bugfix to the RelEx2Logic rule engine will be Re your other comments, Misgana is shortly going to make a Good night... ben On Fri, May 9, 2014 at 11:32 PM, Linas Vepstas [email protected] wrote:
Ben Goertzel, PhD "In an insane world, the sane man must appear to be insane". -- Capt. "Emancipate yourself from mental slavery / None but ourselves can free |
I'm both thrilled and petrified. --linas On 9 May 2014 11:59, Ben Goertzel [email protected] wrote:
|
Hi Linas, The current RelEx2Logic rule engine code didn't introduce the constant and I checked the LogicProcessor.java code and I think the bug was just caused On Friday, May 9, 2014, Linas Vepstas [email protected] wrote:
|
Apparently Amen was already working on part of the bug. I will let him finish and work on what remains, if any. Just to clarify, in addition to the code not checking for variables and constants defined in the rule, it is also not handling multi-conditional. Right now it just happens to work for short sentence. |
I pulled the changes, but the issue doesn't seem to be resolved: For the all-rule and the sentence "All cats are green." I get an error indicating that the "all" in all-rule is now taken as a value as well?
|
@sebastianruder I just run "All cats are green." on relex and got the following result.
Would you please write out the details on how you got the error? |
I don't know what Sebastian is complaining about, but, for me, the following seems very wrong:
green is not a verb, how can it have a tense ???
This seems to say that all somethings are green, but what are the somethings? the parse nodes??? |
there are two bugs in that, one relex outputs tense(green, present) With regard to the interpretation of the application of all-rule on green that is a totally different bug that is being worked on. |
@amebel, I've pulled again but I unfortunately don't get the same output as you do. Can you help me? I run opencog-server.sh and do
|
@sebastianruder to be sure, did you already run
(or run the commands manually to rebuild) |
@amebel, thanks for the tip! I forgot to rebuild it. All clear. Works great now! 👍 |
Good to hear. |
I've just parsed some sentences, but the constant (e.g. |
Have you updated to the latest version and recompile? Those rules should already be fixed. At least on my machine those rules work. I will have to test those sentences tomorrow. |
You're right, William. It works. Didn't mean to bother you. The necessity of rebuilding after pulling the relex repo hasn't gotten stuck in my head yet. I will think of it next time. Thanks! |
No problem. Glad to see it working for someone else beside me :) |
The checkRuleApplicability method in LogicProcessor.java apparently cannot match constant if it's defined at the first part of the logic. For example, the sentence "I ate all cookies." produce
Matching rule 'ALLRULE1'...
Matching criterium: _quantity($noun, all)...
Found node '_quantity'
Its 'name' is '<< all >>'
I just recorded the value of 'all' to be 'all'
I just recorded the value of '$noun' to be 'cookie'
All criteria for rule 'ALLRULE1' satisfied, scheme output: ("all"-rule "cookie" (get-instance-name "cookie" "cookies@a8a3e64e-846e-40d3-bd86-57d56852a1f0" sentence_index))
where the constant "all" is treated as variable. If the constant is defined as the 2nd part of the logic as in the TENSEPOS rule, it is fine.
Matching rule 'TENSEPOS'...
Matching criterium: tense($W, $Tense)...
Found node 'tense'
It is valued, the value is 'past'
Found node 'tense'
Its 'name' is '<< past >>'
I just recorded the value of '$Tense' to be 'past'
I just recorded the value of '$W' to be 'eat'
Matching criterium: pos($W, verb)...
Found node 'pos'
It is valued, the value is 'verb'
This value matches the one specified in the rule!
Found node 'pos'
It is valued, the value is 'noun'
Found node 'pos'
It is valued, the value is 'adj'
Found node 'pos'
It is valued, the value is 'noun'
Found node 'pos'
It is valued, the value is 'punctuation'
Found node 'pos'
It is valued, the value is 'noun'
All criteria for rule 'TENSEPOS' satisfied, scheme output: (tense-rule "eat" (get-instance-name "eat" "ate@3b8bdc4e-86b6-4c06-bb3f-b6722a496cc1" sentence_index) "past")
The text was updated successfully, but these errors were encountered: