From this error message I believe that perhaps the path I am supposed to use in the config_megam command is supposed to be one of the files inside the megam folder rather than the path to the megam folder itself. So, I am wondering if anybody has any experience with this particular config_megam command and knows what '.../path/to/megam' should be? In the interim I changed the classifier from the Maxent to the NaiveBayes classifier in order to continue working through the concept presented in the Natural Language Processing with Python text where this question arose. Sincerely, George
Fred.
Just to be clear: you unzipped that file, and built the project (by typing "make" or "make opt" in a terminal window) without any errors? If so, where are the binary files ("megam" or "megam.opt") located on your machine?
14) Hi Fred, I did unzip the file but I didn't build it. I didn't realize that was necessary. I suppose that would be why I can't seem to find the location of the binary files. Would you please tell me the full "make" command I would need to type in Terminal to build the project. Thanks, George
15) If you look at the contents of the README file, it should have all the information you need. In principle, you should be able to simply type "make" and it will build the megam binary. If there are errors, let me know and we'll see what's needed to get you further along.
I'm working right now, so my answers won't always come this quickly, just so you know.
Fred.
16) Hi Fred, Thanks for your help. I believe I have OCaml installed on my machine. I went to the Ocaml website, downloaded the file and then installed it, however I am not familiar with OCaml so I hope I didn't miss a step. Thank you for letting me know about the read me file. I'll look at it tomorrow morning and follow it's instructions. I'll let you know my results. Don't work too hard. Sincerely, george
17) Good Morning Fred, I read the Readme file in megam. Unfortunately when I ran make at the terminal prompt I got an error message saying:
Since I was in my root directory when I ran the "make" command I though that perhaps for "make" to work I need to change to my megam directory. After changing to the megam directory I re-ran the "make" command. Unfortunately I got the same error message.
18) Hi George...
20) Hi George.
[N.B. you'll need to enter your administrator password]
22) Hi Fred, I found the problem. It turns out that make is an optional install in the latest version of Xcode. In order to install "make" it is necessary to open Xcode and got to Xcode- >Preferences- >Downloads and install the component named command line tools. Once installed I opened Terminal and typed make -v to see if make was present and was rewarded with the version of make that is now present on my system.
This is good progress! Now just cd into the megam directory and type "make" and you should be good to go...(barring any compilation errors, of course).
F.
24) Hi Fred, I cd'd into my megam directory and typed make. Unfortunately the result is somewhat ambiguous. Here is the terminal output, it appears to fail but I'm not sure:
george-ortons-macbook-pro:megam_0.92 George Orton$ make
ocamldep *.mli *.ml > .depend
ocamlc -g -custom -o megam str.cma -cclib -lstr bigarray.cma -cclib -lbigarray unix.cma -cclib -lunix -I /usr/local/bin fastdot_c.c fastdot.cmo intHashtbl.cmo arry.cmo util.cmo data.cmo bitvec.cmo cg.cmo wsemlm.cmo bfgs.cmo pa.cmo perceptron.cmo radapt.cmo kernelmap.cmo abffs.cmo main.cmo
fastdot_c.c:4:19: error: alloc.h: No such file or directory
fastdot_c.c:5:22: error: bigarray.h: No such file or directory
fastdot_c.c:6:20: error: custom.h: No such file or directory
fastdot_c.c:7:18: error: fail.h: No such file or directory
fastdot_c.c:8:20: error: intext.h: No such file or directory
fastdot_c.c:10:22: error: mlvalues.h: No such file or directory
fastdot_c.c:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c_mult_dense_sparse’
fastdot_c.c:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c_mult_dense_sparse_val’
fastdot_c.c:67: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c_norm_dense’
fastdot_c.c:82: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c_mult_dense_dense’
fastdot_c.c:99: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c_mult_dense’
fastdot_c.c:114: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c_add_dense_dense’
fastdot_c.c:135: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c_add_dense_sparse’
fastdot_c.c:155: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c_add_dense_sparse_val’
make: *** [megam] Error 2
george-ortons-macbook-pro:megam_0.92 George Orton$
When I look in my megam directory in Finder I find several new files have been created, so something definitely happened. However when I try to run my nltk code I get the same error message I have been getting all along saying that the megam file cannot be found. When I first posted this question on the nltk forum Steven Bird pointed out a link that seems to be similar to what I experienced when building megam. This is the link:
The pertinent portion of the post seems to be:
An update: Hal Daume III (creator of MegaM) wrote me 10 Jan, advising
me to change the WITHSTR line in Makefile so that it points to str.cma
Similar to what we are instructed to do for WCLIBS and caml.
Then you do the same for WITHUNIX and unix.cma, and WITHBIGARRAY and
bigarray.cma
I've already changed the WITHCLIBS line in megams Makefile to point to ocaml. "WITHCLIBS =-I /usr/local/bin" . At least I think this is correct, when I installed ocaml the dialogue box indicated that the ocaml command line executables were going to be installed in this location.
This is a copy of my current megam makefile:
# Usage of this Makefile:
# To incrementally recompile the system, type
# make
# To recompute dependancies between modules, type
# make depend
# To remove the executable and all the compiled files, type
# make clean
# To compile using the native code compiler
# make opt
#
##################################################################
EXEC = megam
# If you need special libraries provided with the Caml system,
# (graphics, arbitrary precision numbers, regular expression on strings, ...),
# you must set the variable LIBS to the proper set of libraries. For
# instance, to use the graphics library set LIBS to $(WITHGRAPHICS):
LIBS=$(WITHSTR) $(WITHBIGARRAY) $(WITHUNIX) $(WITHCLIBS)
# You may use any of the following predefined variable
# WITHGRAPHICS : provides the graphics library
# WITHUNIX : provides the Unix interface library
# WITHSTR : provides the regular expression string manipulation library
# WITHNUMS : provides the arbitrary precision arithmetic package
# WITHTHREADS : provides the byte-code threads library
# WITHDBM : provides the Data Base Manager library
#
#
########################## End of Documentation ####################
########################## User's variables #####################
#
# The Caml sources (including camlyacc and camllex source files)
########################## Advanced user's variables #####################
#
# The Caml compilers. #
# You may fix here the path to access the Caml compiler on your machine
CAMLC = ocamlc -g
CAMLOPT = ocamlopt -unsafe -ccopt -O4 -ccopt -ffast-math -inline 99999
CAMLDEP = ocamldep
CAMLLEX = ocamllex
CAMLYACC = ocamlyacc
# Should be set to -custom if you use any of the libraries above
# or if any C code have to be linked with your program
# (irrelevant for ocamlopt)
CUSTOM=-custom
# Default setting of the WITH* variables. Should be changed if your
# local libraries are not found by the compiler.
WITHGRAPHICS =graphics.cma -cclib -lgraphics -cclib -L/usr/X11R6/lib -cclib -lX11
WITHUNIX =unix.cma -cclib -lunix
WITHSTR =str.cma -cclib -lstr
WITHBIGARRAY =bigarray.cma -cclib -lbigarray
WITHNUMS =nums.cma -cclib -lnums
WITHTHREADS =threads.cma -cclib -lthreads
WITHDBM =dbm.cma -cclib -lmldbm -cclib -lndbm
#WITHCLIBS =-I /usr/lib/ocaml/3.09.2/caml
#WITHCLIBS =-I /usr/lib/ocaml/caml
WITHCLIBS =-I /usr/local/bin
################ End of user's variables #####################
##############################################################
################ This part should be generic
################ Nothing to set up or fix here
##############################################################
all: depend $(EXEC)
opt : $(EXEC).opt
#ocamlc -custom other options graphics.cma other files -cclib -lgraphics -cclib -lX11
#ocamlc -thread -custom other options threads.cma other files -cclib -lthreads
#ocamlc -custom other options str.cma other files -cclib -lstr
#ocamlc -custom other options nums.cma other files -cclib -lnums
#ocamlc -custom other options unix.cma other files -cclib -lunix
#ocamlc -custom other options dbm.cma other files -cclib -lmldbm -cclib -lndbm
SOURCES1 = $(SOURCES:.mly=.ml)
SOURCES2 = $(SOURCES1:.mll=.ml)
OBJS = $(SOURCES2:.ml=.cmo)
OPTOBJS = $(SOURCES2:.ml=.cmx)
$(EXEC): $(OBJS)
$(CAMLC) $(CUSTOM) -o $(EXEC) $(LIBS) $(OBJS)
$(EXEC).opt: $(OPTOBJS)
$(CAMLOPT) -o $(EXEC).opt $(LIBS:.cma=.cmxa) $(OPTOBJS)
.SUFFIXES:
.SUFFIXES: .ml .mli .cmo .cmi .cmx .mll .mly
.ml.cmo:
$(CAMLC) -c $<
.mli.cmi:
$(CAMLC) -c $<
.ml.cmx:
$(CAMLOPT) -c $<
.mll.cmo:
$(CAMLLEX) $<
$(CAMLC) -c $*.ml
.mll.cmx:
$(CAMLLEX) $<
$(CAMLOPT) -c $*.ml
.mly.cmo:
$(CAMLYACC) $<
$(CAMLC) -c $*.mli
$(CAMLC) -c $*.ml
.mly.cmx:
$(CAMLYACC) $<
$(CAMLOPT) -c $*.mli
$(CAMLOPT) -c $*.ml
.mly.cmi:
$(CAMLYACC) $<
$(CAMLC) -c $*.mli
$(CAMLLEX) $<
$(CAMLYACC) $<
clean:
rm -f *.cm[iox] *~ .*~ #*#
rm -f $(EXEC)
rm -f $(EXEC).opt
.depend: $(SOURCES2)
$(CAMLDEP) *.mli *.ml > .depend
depend: $(SOURCES2)
$(CAMLDEP) *.mli *.ml > .depend
include .depend
It appears to me that the suggestions listed in the post that Steven referenced are already in place in my megam makefile. At this point my best guess is that I have a failed megam build on my system but I really don't know how to check megam functionality other than to run it in my existing nltk code, which as I said earlier can't seem to find megam. Do you know of a way independent of nltk that can be used to check for a successful megam build? Thanks, George