MegaM is Hal Daumé III’s maxent (logistic regression, and much more) modeling software written in OCaml. It is feature-packed and seems to be used a lot, despite being slightly dated. NLTK is able to use it.
In order to compile it as of 2012, with the current version of OCaml, I had to do some tricks that I would like to document here. It’s no big deal but it could save somebody precious minutes.
- Download and unpack the gzip archive.
- Install ocaml using macports:
sudo port install ocaml. Note: this installed version 3.12.1_5, YMMV with newer versions later. - Point the compiler to the correct headers. First run
ocamlc -whereto find out the correct path. On my system it’s/opt/local/lib/ocaml/caml. Change theWITHCLIBSline (#73) in the Makefile to point there. - As of OCaml 3.12.0, the
-lstrcompiler flag should be replaced with-lcamlstr. It occurs on line #62 within the definition ofWITHSTR. - Run
makeormake optand enjoy.
Comments !