21
LING 581: Advanced Computational Linguistics Lecture Notes March 29th

LING 581: Advanced Computational Linguistics Lecture Notes March 29th

Embed Size (px)

Citation preview

LING 581: Advanced Computational Linguistics

Lecture NotesMarch 29th

Step 1: Install WordNet 3.0

• URL: http://wordnet.princeton.edu/wordnet/download/

• File: WordNet-3.0.tar.gz expands to

Step 1: Install WordNet 3.0

• Process1. configure

2. make

3. sudo make install

(platform dependencies)(compile programs)(put compiled programs

into their proper places)

but things may not run smooth …

Step 1: Install WordNet 3.0Configuredouglass-dhcp45:research sandiway$ mv ~/Downloads/WordNet-3.0 .douglass-dhcp45:research sandiway$ cd WordNet-3.0/douglass-dhcp45:WordNet-3.0 sandiway$ ./configure --help`configure' configures WordNet 3.0 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them asVAR=VALUE. See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print `checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for `--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or `..']

Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX

[/usr/local/WordNet-3.0] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX

[PREFIX] By default, `make install' will install all the files in`/usr/local/WordNet-3.0/bin', `/usr/local/WordNet-3.0/lib' etc. You can specifyan installation prefix other than `/usr/local/WordNet-3.0' using `--prefix',for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin]

--libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man]

Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names

Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors

Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) --with-tk directory containing tk configuration (tkConfig.sh)

Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> CPP C preprocessor

Use these variables to override the choices made by `configure' or to helpit to find libraries and programs with nonstandard names/locations.

Report bugs to [email protected].

Step 1: Install WordNet 3.0./configure

--with-tcl=/Library/Frameworks/Tcl.framework --with-tk=/Library/Frameworks/Tk.framework

checking for gcc... gccchecking for C compiler default output file name... a.outchecking whether the C compiler works... yeschecking whether we are cross compiling... nochecking for suffix of executables... checking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking for gcc option to accept ANSI C... none neededchecking for ranlib... ranlibchecking for a BSD-compatible install... /usr/bin/install -cchecking how to run the C preprocessor... gcc -Echecking for egrep... grep -Echecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking locale.h usability... yeschecking locale.h presence... yeschecking for locale.h... yeschecking malloc.h usability... nochecking malloc.h presence... nochecking for malloc.h... nochecking for stdlib.h... (cached) yeschecking for string.h... (cached) yeschecking for stdlib.h... (cached) yeschecking for GNU libc compatible malloc... yes

checking for strchr... yeschecking for strdup... yeschecking for strrchr... yeschecking for strstr... yeschecking for strtol... yeschecking for nl_langinfo and CODESET... yeschecking whether build environment is sane... yeschecking for gawk... nochecking for mawk... nochecking for nawk... nochecking for awk... awkchecking whether make sets $(MAKE)... yeschecking for style of include used by make... GNUchecking dependency style of gcc... gcc3checking for Tcl configuration... found /Library/Frameworks/Tcl.framework/tclConfig.shchecking for Tk configuration... found /Library/Frameworks/Tk.framework/tkConfig.shchecking for existence of /Library/Frameworks/Tcl.framework/tclConfig.sh... loadingchecking for existence of /Library/Frameworks/Tk.framework/tkConfig.sh... loadingconfigure: creating ./config.statusconfig.status: creating Makefileconfig.status: creating dict/Makefileconfig.status: creating doc/Makefileconfig.status: creating doc/html/Makefileconfig.status: creating doc/man/Makefileconfig.status: creating doc/pdf/Makefileconfig.status: creating doc/ps/Makefileconfig.status: creating include/Makefileconfig.status: creating include/tk/Makefileconfig.status: creating src/Makefileconfig.status: creating lib/Makefileconfig.status: creating lib/wnres/Makefileconfig.status: creating config.hconfig.status: executing depfiles commandsconfig.status: executing default commands

WordNet is now configured

Installation directory: /usr/local/WordNet-3.0

options specific to MacOS X

Default prefix is /usr/local

requires Xcode to

be installed for the

Mac

Step 1: Install WordNet 3.0• Makedouglass-dhcp45:WordNet-3.0 sandiway$ makemake all-recursive…Making all in srcif gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../include

-I/Library/Frameworks/Tcl.framework/Versions/8.4/Headers -I/usr/local/include -I.. -I../include -I/Library/Frameworks/Tcl.framework/Versions/8.4/Headers -I/usr/local/include -g -O2 -MT wn-wn.o -MD -MP -MF ".deps/wn-wn.Tpo" -c -o wn-wn.o `test -f 'wn.c' || echo './'`wn.c; \then mv -f ".deps/wn-wn.Tpo" ".deps/wn-wn.Po"; else rm -f ".deps/wn-wn.Tpo"; exit 1; fi

wn.c: In function ‘printsearches’:wn.c:286: warning: format not a string literal and no format argumentswn.c: In function ‘error_message’:wn.c:347: warning: format not a string literal and no format argumentsgcc -g -O2 -o wn wn-wn.o -L../lib -lWN if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../include

-I/Library/Frameworks/Tcl.framework/Versions/8.4/Headers -I/usr/local/include -I.. -I../include -I/Library/Frameworks/Tcl.framework/Versions/8.4/Headers -I/usr/local/include -g -O2 -MT wishwn-tkAppInit.o -MD -MP -MF ".deps/wishwn-tkAppInit.Tpo" -c -o wishwn-tkAppInit.o `test -f 'tkAppInit.c' || echo './'`tkAppInit.c; \then mv -f ".deps/wishwn-tkAppInit.Tpo" ".deps/wishwn-tkAppInit.Po"; else rm -f ".deps/wishwn-tkAppInit.Tpo"; exit 1; fi

In file included from tkAppInit.c:16:

/usr/include/tk.h:23:3: error: #error Tk 8.5 must be compiled with tcl.h from Tcl 8.5

make[2]: *** [wishwn-tkAppInit.o] Error 1make[1]: *** [all-recursive] Error 1make: *** [all] Error 2

• src/MakefileTK_INCLUDE_SPEC =

-I/Library/Frameworks/Tk.framework/Versions/8.4/HeadersTCL_INCLUDE_SPEC =

-I/Library/Frameworks/Tcl.framework/Versions/8.4/HeadersTCL_LIB_SPEC = -F/Library/Frameworks -framework TclTK_LIBS = -lpthread -framework CoreFoundation -framework

Carbon TK_LIB_SPEC = -F/Library/Frameworks -framework TkTK_PREFIX = /usr/localTK_XINCLUDES =

INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/include $(TCL_INCLUDE_SPEC) $(TK_INCLUDE_SPEC) $(TK_XINCLUDES) -I$(TK_PREFIX)/include

wishwn-tkAppInit.o: tkAppInit.cif $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(wishwn_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT wishwn-tkAppInit.o -MD -MP -MF "$(DEPDIR)/wishwn-tkAppInit.Tpo" -c -o wishwn-tkAppInit.o `test -f 'tkAppInit.c' || echo '$(srcdir)/'`tkAppInit.c; \then mv -f "$(DEPDIR)/wishwn-tkAppInit.Tpo" "$(DEPDIR)/wishwn-tkAppInit.Po"; else rm -f "$(DEPDIR)/wishwn-tkAppInit.Tpo"; exit 1; fi

Not a mere warning. A fatal

compilation error

The fix

Step 1: Install WordNet 3.0• sudo make installdouglass-dhcp45:WordNet-3.0 sandiway$ sudo make installPassword:Making install in docMaking install in htmlmake[3]: Nothing to be done for `install-exec-am'.test -z "/usr/local/WordNet-3.0/doc/html" || /Users/sandiway/research/WordNet-3.0/install-sh -d

"/usr/local/WordNet-3.0/doc/html" /usr/bin/install -c -m 644 'binsrch.3WN.html' '/usr/local/WordNet-3.0/doc/html/binsrch.3WN.htm.l…Making install in manmake[3]: Nothing to be done for `install-exec-am'.test -z "/usr/local/WordNet-3.0/man/man1" || /Users/sandiway/research/WordNet-3.0/install-sh -d

"/usr/local/WordNet-3.0/man/man1" /usr/bin/install -c -m 644 './grind.1' '/usr/local/WordNet-3.0/man/man1/grind.1’…Making install in pdfmake[3]: Nothing to be done for `install-exec-am'.test -z "/usr/local/WordNet-3.0/doc/pdf" || /Users/sandiway/research/WordNet-3.0/install-sh -d

"/usr/local/WordNet-3.0/doc/pdf" /usr/bin/install -c -m 644 'binsrch.3.pdf' '/usr/local/WordNet-3.0/doc/pdf/binsrch.3.pdf’Making install in psmake[3]: Nothing to be done for `install-exec-am'.test -z "/usr/local/WordNet-3.0/doc/ps" || /Users/sandiway/research/WordNet-3.0/install-sh -d "/usr/local/WordNet-

3.0/doc/ps" /usr/bin/install -c -m 644 'binsrch.3.ps' '/usr/local/WordNet-3.0/doc/ps/binsrch.3.ps’make[3]: Nothing to be done for `install-exec-am'.make[3]: Nothing to be done for `install-data-am'.Making install in dictmake[2]: Nothing to be done for `install-exec-am'.test -z "/usr/local/WordNet-3.0/dict" || /Users/sandiway/research/WordNet-3.0/install-sh -d "/usr/local/WordNet-

3.0/dict” /usr/bin/install -c -m 644 'adj.exc' '/usr/local/WordNet-3.0/dict/adj.exc' /usr/bin/install -c -m 644 'adv.exc' '/usr/local/WordNet-3.0/dict/adv.exc' /usr/bin/install -c -m 644 'cntlist' '/usr/local/WordNet-3.0/dict/cntlist' /usr/bin/install -c -m 644 'cntlist.rev' '/usr/local/WordNet-3.0/dict/cntlist.rev' /usr/bin/install -c -m 644 'data.adj' '/usr/local/WordNet-3.0/dict/data.adj' /usr/bin/install -c -m 644 'data.adv' '/usr/local/WordNet-3.0/dict/data.adv’ /usr/bin/install -c -m 644 'data.noun' '/usr/local/WordNet-3.0/dict/data.noun' /usr/bin/install -c -m 644 'data.verb' '/usr/local/WordNet-3.0/dict/data.verb' /usr/bin/install -c -m 644 'frames.vrb' '/usr/local/WordNet-3.0/dict/frames.vrb' /usr/bin/install -c -m 644 'index.adj' '/usr/local/WordNet-3.0/dict/index.adj'

/usr/bin/install -c -m 644 'index.adv' '/usr/local/WordNet-3.0/dict/index.adv' /usr/bin/install -c -m 644 'index.noun' '/usr/local/WordNet-3.0/dict/index.noun' /usr/bin/install -c -m 644 'index.sense' '/usr/local/WordNet-3.0/dict/index.sense' /usr/bin/install -c -m 644 'index.verb' '/usr/local/WordNet-3.0/dict/index.verb' /usr/bin/install -c -m 644 'log.grind.3.0' '/usr/local/WordNet-3.0/dict/log.grind.3.0' /usr/bin/install -c -m 644 'noun.exc' '/usr/local/WordNet-3.0/dict/noun.exc' /usr/bin/install -c -m 644 'sentidx.vrb' '/usr/local/WordNet-3.0/dict/sentidx.vrb' /usr/bin/install -c -m 644 'sents.vrb' '/usr/local/WordNet-3.0/dict/sents.vrb' /usr/bin/install -c -m 644 'verb.Framestext' '/usr/local/WordNet-3.0/dict/verb.Framestext' /usr/bin/install -c -m 644 'verb.exc' '/usr/local/WordNet-3.0/dict/verb.exc' /usr/bin/install -c -m 644 'lexnames' '/usr/local/WordNet-3.0/dict/lexnames'Making install in includeMaking install in tkmake[3]: Nothing to be done for `install-exec-am'.test -z "/usr/local/WordNet-3.0/include/tk" || /Users/sandiway/research/WordNet-3.0/install-sh -d

"/usr/local/WordNet-3.0/include/tk" /usr/bin/install -c -m 644 'tk.h' '/usr/local/WordNet-3.0/include/tk/tk.h' /usr/bin/install -c -m 644 'tkDecls.h' '/usr/local/WordNet-3.0/include/tk/tkDecls.h'make[3]: Nothing to be done for `install-exec-am'.test -z "/usr/local/WordNet-3.0/include" || /Users/sandiway/research/WordNet-3.0/install-sh -d

"/usr/local/WordNet-3.0/include" /usr/bin/install -c -m 644 'wn.h' '/usr/local/WordNet-3.0/include/wn.h'Making install in libMaking install in wnresmake[3]: Nothing to be done for `install-exec-am'.test -z "/usr/local/WordNet-3.0/lib/wnres" || /Users/sandiway/research/WordNet-3.0/install-sh -d

"/usr/local/WordNet-3.0/lib/wnres" /usr/bin/install -c -m 644 'license.txt' '/usr/local/WordNet-3.0/lib/wnres/license.txt' /usr/bin/install -c -m 644 'wn.xbm' '/usr/local/WordNet-3.0/lib/wnres/wn.xbm' /usr/bin/install -c -m 644 'wnb.man' '/usr/local/WordNet-3.0/lib/wnres/wnb.man' /usr/bin/install -c -m 644 'wngloss.man' '/usr/local/WordNet-3.0/lib/wnres/wngloss.man'test -z "/usr/local/WordNet-3.0/lib" || /Users/sandiway/research/WordNet-3.0/install-sh -d

"/usr/local/WordNet-3.0/lib" /usr/bin/install -c -m 644 'libWN.a' '/usr/local/WordNet-3.0/lib/libWN.a' ranlib '/usr/local/WordNet-3.0/lib/libWN.a'make[3]: Nothing to be done for `install-data-am'.Making install in srctest -z "/usr/local/WordNet-3.0/bin" || /Users/sandiway/research/WordNet-3.0/install-sh -d "/usr/local/WordNet-

3.0/bin" /usr/bin/install -c 'wn' '/usr/local/WordNet-3.0/bin/wn' /usr/bin/install -c 'wishwn' '/usr/local/WordNet-3.0/bin/wishwn'test -z "/usr/local/WordNet-3.0/bin" || /Users/sandiway/research/WordNet-3.0/install-sh -d "/usr/local/WordNet-

3.0/bin" /usr/bin/install -c 'wnb' '/usr/local/WordNet-3.0/bin/wnb’

Step 1: Install WordNet 3.0• Set the PATH$ ls /usr/local/WordNet-3.0/bin/wishwn wn wnb$ export PATH=/usr/local/WordNet-3.0/bin:

$PATH$ printenv PATH/usr/local/WordNet-3.0/bin:/Users/

sandiway/bin:/usr/local/sicstus4/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

• Set the PATH permanently• ~/.bash-loginulimit -d unlimitedexport

PATH=/Users/sandiway/bin:/usr/local/sicstus4/bin:/opt/local/bin:/usr/local/WordNet-3.0/bin:$PATH

$ wnb

Step 2: Install an Language Interface

Perl(similar things exist for Python)

EXERCISE FOR THE READER

Requires installing WordNet 3.0

Step 3: Measuring Similarity

Requires installing WordNet::QueryData first

Example: Rolling your own• Based on WordNet 1.7.1• Example:

– happy/a is in [happy]– happy and unhappy/a are

antonyms– For [unhappy], see also [sad]– sad/a is in the synset [sad]– happy/a is in [happy]– For [happy], see also [glad]– glad and sad/a are antonyms– happy/s is in [happy,pleased]

[happy,pleased] and [glad] are similar

– glad and sad/a are antonyms

Example: Rolling your own

• Full graph:– does full

breadth-first search…

Using WordNet

Using WordNet: Example

Using WordNet: Example

Using WordNet: Example

Using WordNet: Example

Using WordNet: Example

Using WordNet: Example

Using WordNet: Example

Using WordNet: Example