Python small parsers --------------- Small implementations of Earley and CKY parsers for Context Free Grammars, primarily for teaching purposes. Uses portions of nltk_lite. Questions, comments, revision: gawron@mail.sdsu.edu. BUILD -------- This is a source distribution which needs to be built. To build this run python setup.py build INSTALL -------- To install this in Linux/Unix run the following three commands: % python setup.py build % python setup.py install To install in Windows: > C:\Python24\python.exe setup.py build > C:\Python24\python.exe setup.py install Your version of Python may of course be installed in a different directory and the path to your Python.exe would then differ. RUN ---- >>> import small_parsers.simple_earley_parser >>> import small_parsers.simple_earley >>> import small_parsers.simple_cky_parser Each file contains examples and instructions at the bottom. Each imports modules small_grammar and small_parser. USING Python's Tar package (for Windows folks) illustrated with Python 2.3.4 [works with that version or later] You should start python in the site-packages directory of your Python installation. You should have a copy of the tar file in that directory. THEN: --------------------------------------------- Python 2.3.4 (#1, Oct 26 2004, 16:42:40) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import tarfile >>> FileObj = tarfile.open('small_parsers-0.1.tar.gz','rb:gz') >>> FileObj >>> for tinfo in FileObj: ... FileObj.extract(tinfo) ... >>>