Re: Modifying PyKE engine to create compiled_krb folder in a different directory

198 views
Skip to first unread message
Message has been deleted

sam helsen

unread,
May 17, 2016, 4:06:19 AM5/17/16
to PyKE


On Friday, May 13, 2016 at 1:35:54 PM UTC+5:30, sam helsen wrote:
Hi,

I am starting to like PyKE very much and am looking forward to replace many of my python module with PyKE as I find PyKE very intuitive and well managed.

I know the below has been asked multiple times, but somehow I couldn't follow the treads. My concern is very simple.

I have two directory
1. code  (../code)    -- which contains many modules including pyke rule base and python codes
2. dataset (../dataset) -- contains datasets of all the module including pyke ".fbc" files.

Since PyKE rules are small in size and are quite alike python code I would like to have them in my code directory. On the other hand PyKE .fbc files (universal_facts) and ".compiled_krb" may stretch up-to many mb's even gigs depending on how much data you assert. Therefore I'd like to have them in my dataset directory

the structure I'd like to have looks like
1. (../code/PyKE.krb) and  (../code/python_code_to_access_PyKE.py)
2. (../dataset/compiled_krb/)      and    (../dataset/PyKE.kfb)


I have achieved the half of 2nd by manipulating the PyKE engine to engine = knowledge_engine.engine(__file__, "../dataset") and asserting statements into PyKE.fbc in ../dataset/ . 
However, when i run  "python_code_to_access_PyKE.py", I see that the "compiled_krb" folder is getting created in "../code/compiled_krb".  I'd like to have compiled_krb in ../dataset/  

Is their any way to put the compiled_krb folder into a desired location ?

I'd really appreciate any help.

Regards
Sam

Bruce Frederiksen

unread,
May 17, 2016, 5:50:42 AM5/17/16
to py...@googlegroups.com
See Creating an Inference Engine Object near the end:

All of the compiled Python .py source files and .fbc/.qbc pickle files generated from each source directory are placed, by default, in a compiled_krb target package. You may specify a different target package for any source directory by passing that source directory along with the target package name as a 2-tuple. Thus, specifying the default target package explicitly would look like:

>>> my_engine = knowledge_engine.engine((__file__, '.compiled_krb'))

You may specify the same target package for multiple source directories.

The last component of the target package will be created automatically if it does not already exist.


On Fri, May 13, 2016 at 4:05 AM, sam helsen <sam.he...@gmail.com> wrote:
Hi,

I am starting to like PyKE very much and am looking forward to replace many of my python module with PyKE as I find PyKE very intuitive and well managed.

I know the below has been asked multiple times, but somehow I couldn't follow the treads. My concern is very simple.

I have two directory
1. code  (../code)    -- which contains many modules including pyke rule base and python codes
2. dataset (../dataset) -- contains datasets of all the module including pyke ".fbc" files.

Since PyKE rules are small in size and are quite alike python code I would like to have them in my code directory. On the other hand PyKE .fbc files (universal_facts) and ".compiled_krb" may stretch up-to many mb's even gigs depending on how much data you assert. Therefore I'd like to have them in my dataset directory

the structure I'd like to have looks like
1. (../code/PyKE.krb) and  (../code/python_code_to_access_PyKE.py)
2. (../dataset/compiled_krb/)      and    (../dataset/PyKE.fbc)


I have achieved the half of 2nd by manipulating the PyKE engine to engine = knowledge_engine.engine(__file__, "../dataset") and asserting statements into PyKE.fbc in ../dataset/ . 
However, when i run  "python_code_to_access_PyKE.py", I see that the "compiled_krb" folder is getting created in "../code/compiled_krb".  I'd like to have compiled_krb in ../dataset/  

Is their any way to put the compiled_krb folder into a desired location ?

I'd really appreciate any help.

Regards
Sam

--
You received this message because you are subscribed to the Google Groups "PyKE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyke+uns...@googlegroups.com.
To post to this group, send email to py...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyke.
For more options, visit https://groups.google.com/d/optout.

sam helsen

unread,
May 17, 2016, 9:50:41 AM5/17/16
to PyKE
Hi Bruce,

Thanks for the reply, but somehow I am unable to understand the document. I have tried the approach, still I face the same problem.

I have my source path (for .py source files and .fbc/.qbc pickle files) set to :
dataset_path = ../dataset/pyke_data

The code I run to create a PyKE engine is present in 
code_path = ../code/pyke_module.py

Inside the pyke_module.py file I create the PyKE engine using the following piece of code,
engine = knowledge_engine.engine((dataset_path, '.data_dir'))

When I run the pyke_module.py file, Pyke creates a folder "data_dir" inside the ../code source directory rather that creating it inside ../dataset/pyke_data despite I have mentioned the source to be ../dataset/pyke_data

I'd really appreciate if you could point out where I am going wrong.

Thank you so much
Reply all
Reply to author
Forward
0 new messages