See SNoW documentation.
Note: if for whatever reason you modify or rebuild the SNoW library, you will need to rebuild pySnow by first removing the build directory and then running "python setup.py build" again.
Modify the variables:
PATHTOSNOWLIB = "//home/nshah/ids/sandbox/active_ids/lib/Snow_v3.2" PATHTOSNOWHEADERS = PATHTOSNOWLIB
to point to your installation of Snow_v3.2
You should now be able to run the command:
python setup.py build
This in turn should create the directory "build" and a couple sub-directories "lib.linux-i686-2.4" and "temp.linux-i686-2.4" (the names may be different). If all goes well, there will be a dynamically linked library 'snow.so' within "lib.linux-i686-2.4".
python setup.py install
(for which you will most probably need super user priviledges) or simply copy the library "snow.so" to somewhere in your PYTHONPATH.
Fire up your python interpreter and try typing
import snow
Equivalent to running SNoW in training mode. Command line arguments are passed in as a dictionary of key,value pairs. In addition to the supported output modes of SNoW the command can also redirect output to a string that is returned as the result of the command. This is the default.
Example:
original snow command: ## ../snow -train -I $train_file -F $net_file -A $arch_file becomes: import snow args = {'I':train_file, 'F':net_file, 'A':arch_file} result = snow.train(args)
Equivalent to running SNoW in testing mode. Command line arguments are passed in as a dictionary of key,value pairs. In addition to the supported output modes of SNoW the command can also redirect output to a string that is returned as the result of the command. This is the default.
Example: original snow command: ## ../snow -test -I $test_file -F $net_file becomes: import snow args = {'I':test_file, 'F':net_file} result = snow.test(args)
Equivalent to running SNoW in evaluate mode. Command line arguments are passed in as a dictionary of key,value pairs. In addition to the supported output modes of SNoW the command can also redirect output to a string that is returned as the result of the command. This is the default.
Example: TBD
args = {'I':test_file, 'F':net_file} session = snow.SnowSession(snow.MODE_INTERACTIVE,args)
To update the network or evaluate an example use the "update" method:
testdata = open(test_file,"r") for ex in testdata: result=session.update('e,'+ex) print result
args = {'I':test_file, 'F':net_file} session = snow.SnowSession(snow.MODE_SERVER,args)
To evaluate and example use the "evaluateExample" method:
testdata = open(test_file,"r") for ex in testdata: result=session.evaluateExample(ex) print result
Note while this mode has the semantics of the traditional server mode, there is no socket communication and no additional thread.