缘起
一直使用有道词典的在线版,对其的英英释义下的WordNET感到好奇,就点进去看了一下。我原本因为是个论文检索什么的,原来是普林斯顿(princeton)大学的一些的教授搞得的一个英语词法数据库(lexical database of English),顿时觉得这玩意好NB,看了一下还有的下载,就下载了一个用用,毕竟不是什么时候都想上网查单词的。
正文
系统配置:Ubuntu 12.04 LTS
安装前提:tcl/tk 包,gcc编译器
1.前期准备
- gcc编译器:大多数的Linux发行版都预装的这个软件包的。如果没有装,命令:sudo apt-get install build-essential ,就会将一些基本的编译的工具安装好,包括gcc编译器和libc.so等库
- 安装tcl/tk包,tcl/tk的网站: http://www.tcl.tk/ 安装命令: sudo apt-get install tcl tcl-dev
2.正式安装
2.1 下载WordNet
2.2 解压
2.3 正式安装
./configure --with-tk=/usr/lib/tk8.5/ --with-tcl=/usr/lib/tcl8.5/
(备注:
1.这里的tcl和tk的版本的号可能每个人安装的不同,我安装的8.5(2013.9),现在8.6也可以从官网http://www.tcl.tk/下载
2.--with-tk=/usr/lib/tk8.5/ --with-tcl=/usr/lib/tcl8.5/必须要有,否则就会出现 configure: WARNING: Can't find Tcl configuration 和configure: WARNING: Can't find Tk configuration。 这也是我最初安装时出现的问题。
)
输出结果:
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for ranlib... ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for strchr... yes
checking for strdup... yes
checking for strrchr... yes
checking for strstr... yes
checking for strtol... yes
checking for nl_langinfo and CODESET... yes
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for Tcl configuration... found /usr/lib/tcl8.5/tclConfig.sh
checking for Tk configuration... configure: WARNING: Can't find Tk configuration definitions
xiajian@xiajian-pc:~/software/WordNet-3.0$ ./configure --with-tk=/usr/lib/tk8.5/ --with-tcl=/usr/lib/tcl8.5/
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for ranlib... ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for strchr... yes
checking for strdup... yes
checking for strrchr... yes
checking for strstr... yes
checking for strtol... yes
checking for nl_langinfo and CODESET... yes
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for Tcl configuration... found /usr/lib/tcl8.5/tclConfig.sh
checking for Tk configuration... found /usr/lib/tk8.5/tkConfig.sh
checking for existence of /usr/lib/tcl8.5/tclConfig.sh... loading
checking for existence of /usr/lib/tk8.5/tkConfig.sh... loading
configure: creating ./config.status
config.status: creating Makefile
config.status: creating dict/Makefile
config.status: creating doc/Makefile
config.status: creating doc/html/Makefile
config.status: creating doc/man/Makefile
config.status: creating doc/pdf/Makefile
config.status: creating doc/ps/Makefile
config.status: creating include/Makefile
config.status: creating include/tk/Makefile
config.status: creating src/Makefile
config.status: creating lib/Makefile
config.status: creating lib/wnres/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default commands
WordNet is now configured
Installation directory: /usr/local/WordNet-3.0
To build and install WordNet:
make
make install
To run, environment variables should be set as follows:
PATH - include ${exec_prefix}/bin
WNHOME - if not using default installation location, set to /usr/local/WordNet-3.0
See INSTALL file for details and additional environment variables
which may need to be set on your system.
(仔细看上面的最后的一段关于安装的描述,如果不想将WordNet安装在默认的目录时,需要设置WNHOME变量,如果想直接在commandline中使用需要配置PATH变量,可以考虑在当前用户的主目录下的.bashrc中进行配置)
make (编译程序)
make install (安装程序,如果是使用默认安装,需要使用sudo提升权限,不然以普通用户的权限不能向/usr/local目录中写入和复制文件的)
make uninstall(卸载程序,如果安装时使用了sudo,卸载时也要使用,原因是相同的,权限问题)
WordNet截图:
备注:
- 这里使用时暂时还没有给WordNet配置Path,而是直接到安装目录/usr/local/WordNet-3.0/bin中参考脚本的,这个目录下有三个脚本:
- wn 大概是命令行接口
- wnb 是上面的图形界面接口,但是在使用时候出现了个问题,
./wnb: 3: ./wnb: wishwn: not found 这个问题前几天遇到过得,就是在shell脚本中调用shell脚本的问题,不知道WordNet开发者使用的什么shell解释器,在我的机器上这样是不能执行的。需要将wnb脚本中的第三行的 wishwn "$0" "$@" & 修改为$(pwd)/wishwn "$0" "$@" &。(事后发现,在PATH中配置路径后不需要修改脚本,而使用./方式运行时需要修改) - wishwn, 功能不明,不过直接执行的话出现的界面是这样的:
- 如果对WordNet的界面感到倒胃口,觉得其几乎没有什么美学可言,一点都不优美,不如网页版的有道词典。好吧,我就是这么想的。可以考虑卸载WordNet, make uninstall. (备注:卸载的时候仅仅将文件删除了,目录没有删除,如果非常介意的话,就自己手动的目录也删了把 rm -r WordNet-3.0/)
后记
小结
参考资料
2.WordNet:http://blog.youkuaiyun.com/wen_2/article/details/13004817
3. Prolog与WordNet:http://blog.youkuaiyun.com/skiffloveblue/article/details/9359449
4.WordNet词网研究:http://blog.youkuaiyun.com/skiffloveblue/article/category/1508785

这篇博客详细记录了如何在Ubuntu 12.04 LTS系统上安装WordNet的过程,包括安装所需的tcl/tk包和gcc编译器。在安装过程中,博主遇到了配置路径和依赖的问题,并给出了解决方案,如修改wnb脚本以使其能够正确执行。尽管WordNet的界面朴素,但其作为英语词法数据库的价值不容忽视。
5411

被折叠的 条评论
为什么被折叠?



