Downloading the Policy Parser
Click here to download the complete code for the Policy Parser.
The directory structure of the code (after expanding the .tar.gz file) is as follows:
- data/: contains the FCFG grammar file (.fcfg), the lexicon (.lex), the spelling change rules (.yaml), and the RDF ontology file (.n3).
- featureparse/: the Feature Parsing Library, written by Rob Speer and provided on the 6.863 website.
- PolicyInterpreter/: Contains the complete Python code for the Policy Interpreter. The file policyParser.py contains the main function for running our system on the command line, and policyInterpreter.py contains the algorithms for policy interpretation.
- RDFGenerator/: Contains the complete Python code for the RDF Generator. The file generate.py contains the algorithms for generating the RDF from a policy.
Executing the Policy Parser on the command line:
Even though the Policy Parser is available on the web for use, the user may wish you execute it on their own machine. The instructions for running the Policy Parser on the command line is as follows:
NOTE: The user must have the NLTK library already installed on the machine, and the path to the library should be added to the environment variable PYTHONPATH.
Untar PolicyParser.tar.gz into a directory of choice. In that directory, type:
bash$: cd PolicyInterpreter
bash$: python
Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for
more information.
>>> from policyParser import *
>>> result = runPolicyParser()
The Policy Parser asks the user for two inputs: the name of a policy and the sentence for the policy itself. The result of running the Policy Parser is a string that represent the generated RDF. To use the AIR reasoner with this policy, however, the RDF file must be stored at a location (URI) on the web. Thus, we recommend the user to use our web tool, which automatically stores the generated RDF on the web and provides an interface to retrieve the RDF for the use with the reasoner.