AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Set membership problem
 
 

You are going to love this issue!

I have been battling a challenge with testing a matched variable against a set, and I think I’ve tracked down the problem.

Consider the following concepts:

concept: ~valentines_day (valentine Valentine Valentine_Day Valentines_Day)
concept: ~named_date (~valentines_day

and this test, which I’ve simplified from my actual code which is spread over several rules, but shows the problem in a single line.

:testpattern (_~named_date _0?~named_datebook valentines day 

The _~named_date correctly matches the input and memorizes it.
But the _0?~named_date test unexpectedly fails.

I think I’ve tracked it down to the HandleRelation function. For a ? operation against a memorized variable it calls GetNextSpot() and tests returned value, which is a starting position, against the starting word position of that match variable.

The problem is that GetNextSpot() returns the value of the startPosition parameter, but that, and the endPosition, and passed into the function as the address of variables and as HandleRelation passes those two parameters as the same junk variable then startPosition and endPosition point to the same place and hence contain the same value - the endPosition because that is assigned last.

FunctionResult HandleRelation(charword1,charopcharword2,bool output,unsigned intidcharword1valcharword2val)

 . . .

 
unsigned int junk;
 if (
GetNextSpot(Dindex 1junkjunk) == indexresult NOPROBLEM_BIT// otherwise failed and we would have known 
unsigned int GetNextSpot(WORDP D,int start,unsigned int &startPosition;,unsigned intendPositionbool reverse)

 . . .

 else if (
at start)
 
{
  
if (at == 0xff) return 0// end of data going forward
  
startPosition at;
  
endPosition end;
  return 
startPosition;
 

Therefore where the matched variable is a phrase then the test fails.

For now, I’ve modified the code to have 2 junk variables.

 

 

 
  [ # 1 ]

So… a couple of things.

1) you test _0 against the set, but _0 is “valentine day” singular. You should be using ‘_0
2. Even so, the phrase “valentines day” in lower case is NOT in the set.
3. The system did not force uppercase on your words “valentines day”, but it managed the problem because it found a sequence of words, which if in upper case would be useful, ergo you matched on the sequence, though the original words are not capitalized. At present the system cannot tell it came from a sequence vs the original words. A flaw for now.
You could, knowing it is a proper name, call ^pos(noun proper ‘_0) to get the correct version.
4. Your concept set really should also include “Valentine’s Day” for completeness.

 

 
  [ # 2 ]

Thank you.

I must admit that this area has been the most confusing to me. For example, if I say “book tynwald day”, and I have the concept: ~tynwald_day (Tynwald_Day) then (lowercase) tynwald day is substituted into Tynwald_Day and hence that becomes the raw input and I only need the single item in the concept because the substitution process handles both uppercase and lowercase input.

But I guess I’ve confused myself with Valentines Day because it didn’t appear to follow the same processing and all the combinations.

 

 
  login or register to react
‹‹ Tokenize change in 6.2c      New Chatbot ››