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..

Unknown top-level declaration error
 
 

I’m attempting to create a series of concepts to be used to determine if certain foods fall into a particular diets.
I’ve created a file called concepts.top and added a number of different food concepts and keywords.
For instance…

concept: ~meat NOUN NOUN_SINGULAR ( ~misc_meat ~beef ~pork ~poultry ~lamb ~fish ~shellfish )
concept: ~misc_meat NOUN NOUN_SINGULAR ( )
concept: ~beef NOUN NOUN_SINGULAR ( )
concept: ~pork NOUN NOUN_SINGULAR ( )
concept: ~lamb NOUN NOUN_SINGULAR ( )
concept: ~fish NOUN NOUN_SINGULAR ( )
concept: ~shellfish NOUN NOUN_SINGULAR ( ) 

And also added a particular diet like:

concept: ~paleo (~meat ~fruit ~nuts

I’ve created another file called keywords_meat.txt that has all my meat keywords:

~misc_meat (xacuti sauerbraten olive_loaf bone_soup_from_allowable_meats espetada machaca bistec hare bulalo .....) 

and beef, pork, lamb, etc.

I have a topic file called dietcheck.top where i’m testing for whether a food is paleo like this:

TOPIC: ~DIETCHECK keep repeat (paleo vegetarian vegan glutenfree)

#! testing for diet 
#! ~paleo (~meat ~fruit ~nuts ~nightshade ~honey)
?: (is _~paleo) ^keep() ^refine()
 
a: (_0?~meatMmmm...meaty goodness...Yesthat's paleo!

 a: () I don'
t recognize thatsorry

I am currently only getting 1 error, the “Unknown top-level declaration” on Line 1 of the keywords_meat.txt file. I would really appreciate some help in figuring out what could be causing this. I don’t see anything obviously wrong in the keyword list.

Thanks!

 

 

 
  [ # 1 ]

In your keywords_meat.txt file you can either start the line with concept: ~misc_meat, and because you have also defined it elsewhere then either remove it from the concepts.top file or add the keyword MORE to the definition in the text file.

But probably the preferred way is to turn the data in the text file into a CS table:

tablemeat (^food)
^
createfact(^food member ~misc_meat)
data:
xacuti sauerbraten olive_loaf bone_soup_from_allowable_meats espetada machaca 
bistec hare bulalo 

 

 

 
  [ # 2 ]

Me, I wouldnt make a table strictly for something which is a static concept. I’d just use a concept. Less typing.

 

 
  [ # 3 ]

Thanks Andy and Bruce!
Was able to fix my concept based on andy’s suggestion (though i stayed with concepts and not tables - based on Bruce’s comment) and get the “is it paleo?” to work!
Thanks again for the help.

Jon

 

 
  [ # 4 ]

I cannot work with concepts at all.

File RAWDATA/TEST/tutorial.top contains only two lines:

concept: ~bll [strike ball base]

s: (~bll) I don’t like baseball, I like handball.


When I try to build it ( :build mine ) I am getting this message!?

——Reading file tutorial.top
Reading concept ~bll
*** Error- line 3 of tutorial.top:
  in tutorial.top at 3: s: (~bll) I don’t like baseball, I like handball.
 
FILE-1 Unknown top-level declaration s: in RAWDATA/TEST/tutorial.top


Could anybody help please?

 

 
  [ # 5 ]

s: is a rule definition, it needs to be within a topic:

 

 
  [ # 6 ]

Thanks Andy.
Unfortunately, I still cannot do it.

File RAWDATA/TEST/tutorial.top is now:

topic: ~myblltopic []

concept: ~bll [strike ball base]

s: (~bll) I don’t like baseball, I like handball.

When I try to build it, I am getting the message!?

...
...
...
——Reading file tutorial.top
Reading topic ~myblltopic
Reading concept ~bll
*** Error- line 5 of tutorial.top:
  in tutorial.top at 5: s: (~bll) I don’t like baseball, I like handball.
 
FILE-1 Unknown top-level declaration s: in RAWDATA/TEST/tutorial.top
...
...
...

 

 
  [ # 7 ]

THe concept declaration terminates the topic definition so your rule is still freestanding.  any top level declaration will terminate a topic.

 

 
  [ # 8 ]

Thanks a lot. It works now.

 

 
  login or register to react
‹‹ no such bot error      Suzette rule files ››