Skip to content

Combinatory Categorial Grammar (CCG): Full set CCG, and probabilistic CCG

License

Notifications You must be signed in to change notification settings

bozsahin/ccglab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ccglab

Combinatory Categorial Grammar (CCG): CCG and probabilistic CCG, with full set of combinators and their powers.

CCGlab is Common Lisp code with some bash scripts for install and run-time tokenization.

CCGlab needs a linux, a native one or one in macosphere or windowsphere.

INSTALL FOR LINUXSPHERE AND MACOSPHERE

  1. git clone https://github.com/bozsahin/ccglab
    This will create the repository ccglab under you current directory.
    This is your ccglab home.
  2. cd ccglab
  3. Execute ./install bash script in the repo to get the extras needed, and to set up the paths so that CCGlab is usable from anywhere in your user account.

Depending on your package manager, which is assumed to be either dnf, yum, apt-get, pacman, brew (in this pecking order if all are present in your system), it will fetch sbcl and rlwrap (if not already present in your system). All linuxsphere (rolling and nonrolling distros, MACOS, Windows's WSL linux distros) have standard packages for these tools.

You can then run the ccglab script from anywhere after install.

Latest release is shown by (which-ccglab). Announced git releases may be slightly behind the latest, which is always this copy. Just clone this repo rather than download the release if you want the latest.

INSTALL FOR WINDOWS

You need a linux system for CCGlab. Once you get that, follow the instructions for Linuxsphere for CCGlab install.

There are three options for windows (I recommend the first one):

  1. For windows 10 onwards: Follow these directions. No partitions, no virtualbox, no hassles. You now have linux as a W10 app with ccglab in it.
  2. For windows earlier than W10: install a virtual box such as Oracle's: https://www.virtualbox.org/.

    Then follow one of the advices below for linuxes for ccglab install, depending on your virtual machine.

    I recommend setting up an Ubuntu or Mint virtualbox if you have no prior linux experience.

    If you use CCGLAB from a virtualbox, save your machine state rather than power off the virtual machine. You won't have to do all of the above over and over.

  3. For any windows: put a linux partition in your machine, and follow the instructions below depending on your linux. This one is for experienced users. This option is becoming easier too.

MANUAL INSTALL

If you're tired of weird defaults of linux installers, try the safe and longer way:

  • Just clone this repo, get the LALR parser somewhere in your machine, and set and export the following bash variables:
    1. CCGLAB_HOME to where the ccglab repo is
    2. LALR_HOME to where you saved lalrparser.lisp
    3. CCGLAB_LISP to full path of your ANSI Common Lisp binary
    4. RLWRAP to path of rlwrap if you have it, otherwise nil, i.e. RLWRAP=
    5. PATH=:.:$CCGLAB_HOME/bin:$PATH to overrride earlier installs of ccglab.
    6. Then open a new bash terminal and run ccglab

    Here is my local setup in ~/.bashrc file (create one if you don't have it):

           export CCGLAB_HOME=$HOME/mysrc/myrepos/ccglab
           export LALR_HOME=$HOME/mysrc/lisp
           export CCGLAB_LISP=/usr/local/bin/sbcl
           export RLWRAP=rlwrap
           export PATH=:.:$CCGLAB_HOME/bin:$PATH 
    

    And here is my ~/.bash_profile file (create one if you don't have it---bash may or may not use both):

           if [ -f ~/.bashrc ]; then
                      source ~/.bashrc
           fi
    

    The installer fetches the relevant sources (lalrparser, sbcl, rlwrap) and does the manual install automatically, and saves it in the files .bash_profile, .bashrc at your home.

    Also have a look at the companion repo called ccglab-database, which contains grammars and models developed in CCGlab

    COMMON LISPs FOR CCGLAB

    SBCL and CCL Common Lisps are usable out of the box for CCGlab. The install script sets up SBCL for CCGlab if you haven't got one already. If you have an ANSI Common Lisp, it can work with it too.

    GCL and CLisp are ANSI but the first one does not come with CLOS, and CLisp has weird locks on standard package files to turn them on. This is unfortunate because some CCGlab macros for the Lisp reader needs methods, therefore not usable in GCL/Clisp out of the box.

    I added Allegro CL support for CCGlab (for calling bash scripts etc.), but somewhat reluctantly. Its free versions are so cryptic about heap control you will avoid it, and spend most of your time garbage-collecting rather than doing useful work. Not worth it, folks.

    Design and development of CCGlab continues to be in SBCL, then occasionally checked with CCL. SBCL developers, you are my heros.

    THE WRAPPER

    You will appreciate the peace and comfort of the command-recaller rlwrap when you use a command-line tool like CCGlab. I am personally eternally grateful to its developers.

    THE CCG WRAPPER

    Steedman-notation for CCG is probably not SLR-parsable. I remember getting reduce-reduce conflicts in SLR which I didn't know how to eliminate without changing the notation. Thanks to Mark Johnson for the LALR parser, which is sufficient for CCG lexical entry and rule recognition.

    enjoy.

    --Cem Bozsahin

  • About

    Combinatory Categorial Grammar (CCG): Full set CCG, and probabilistic CCG

    Resources

    License

    Stars

    Watchers

    Forks

    Packages

    No packages published