Note: This is a unfinished work, will polish it later.
เข้าค้าง ๆ มานานละ ไม่เสร็จซะที โพสต์ไปก่อนละกัน เดี๋ยวมาแก้ทีหลัง ไม่งั้นลืมแน่
วิธีติดตั้ง NLTK บน UNIX, Mac OS X, และ cygwin บน Windows
(ใครมี gcc และ Python 2.4 แล้ว ก็ข้ามส่วนนั้นไปได้เลย
สำหรับคนใช้ cygwin เลือกลง gcc, python ได้จากโปรแกรม install ของ cygwin เลย)
Install gcc
As most UNIX systems already has gcc, I will discussed only about Mac OS X
(if your system already has gcc (or Xcode), skip this).
- Install Xcode 1.5, for a latest gcc from Apple.
(You need an Apple Developer Connection account to download this) - Check if your gcc need a patch or not.
At a command line, type gcc -v
If the build number is 1666 or lower, you have to install a November2004gccupdater package to fix Apple’s gcc bug.
Install Python 2.4 and Tkinter
If your system already has Python 2.4 (or newer) and a working Tkinter, skip this.
To test it, read (7).
- Install PantherPythonFix
- Install Tcl/Tk Aqua
- Install Python 2.4 for Mac OS X from source
- download the source code
- unzip it
- ./configure
- make
- sudo make install
- change Python path and links
- symbolic links
- set PYTHOHPATH in .profile
- test if the default Python is Python 2.4
python -V
- test if the Python + Tcl/Tk works?
run Example 2-1 of
http://www.pythonware.com/library/tkinter/introduction/hello-tkinter.htm
Install NLTK
read http://nltk.sourceforge.net/install.html
- install Numarray
- sudo python setup.py install
- install NLTK
- sudo python setup.py install
- install NLTK Data Package
- extract to …
- change NLTK_CORPORA environment variable in your .profile file to that path
- install NLTK Contributions Package (optional)
Install PyWordNet & WordNet
UNIX, Mac OS X: Download WordNet and install it.
Cygwin: You can install WordNet from the cygwin setup program, it is in Utils category.
In cygwin, a WNHOME environment variable should be set as /lib/wnres. You can do this by modify the /etc/profile file.
WNHOME=/lib/wnres
export WNHOME
In general case, it may not necessary to do this.
But if you also has a WordNet for Windows installed (probably in C:\Program Files\WordNet), you have to set WNHOME in cygwin explicitly. Unless the WordNet for Windows’s WNHOME will confused cygwin’s WordNet.
To install PyWordNet, type python setup.py install
When you import wordnet module, you will see several warnings say:
Exception exceptions.AttributeError: “DbfilenameShelf instance has no attribute ‘writeback’” in ignored.
You haven’t did anything wrong, everybody faces this. May be it will get fixed in next version of PyWordNet.