WordNetをWSLにインストールする

WordNetとは米国プリンストン大学で長い間、開発されてきて、計算言語処理の分野では広く有名な電子化辞書のことです。WordNetはWindows版でもLinux版でもインストールして稼働できますが、自然言語処理を前提にすると、どうしてもWordNetについて、言及せざるを得ないのです。以下は、WordNet本(MIT出版)のホームページからの引用です。

WordNetは、人間の語彙記憶に関する現在の心理言語学的理論にヒントを得て設計されたオンライン語彙参照システムで、バージョン1.6が最新版です。

WordNetは電子的な語彙データベースであり、計算言語学、テキスト分析、および多くの関連分野の研究者が利用できる最も重要なリソースであると考えられています。WordNetの設計は、人間の語彙記憶に関する現在の心理言語学的および計算理論にインスパイアされています。英語の名詞、動詞、形容詞、副詞は、同義語セットに整理され、それぞれが語彙化された1つの基本概念を表します。本書の目的は2つあります。第一に、WordNetの設計とその理論的動機について述べること。第二に、語義識別、情報検索、動詞の選択的嗜好、語彙連鎖などの代表的な応用例を紹介することです。

https://direct.mit.edu/books/book/1928/WordNetAn-Electronic-Lexical-Database

この記述は、多分出版当時(1998年)のものであろう。今(2024年)では最新WordNetバージョンはv.3.1 だが(辞書データのみ)、システムとしてはLinux/Unixではv.3,0まで、Windowsではv.2.1までしか提供されていない。ところがWSLを利用すれば、Windowsでv.3,0が利用できてしまうのだ。だからここでその方法を紹介するのもそれなりの価値はあるだろう。

最初にここを参考にWindowsにWSLをインストールする。この記事はトリプルストアのためのものですが、ここではWordNet 3.0をインストールします。

WSLのubuntuに入って、以下のようにしてWordNet 3.0をインストールする。ここからはWSL上ではない素のubuntuでも同様です。

最初に updateupgrade をやっておきます。インストールできたら、wnでCUIベースの利用、wnbでGUIベースの利用となります。


To run a command as administrator (user "root"), use "sudo ".
See "man sudo_root" for details.

seiji@WIN-L6ELGAOOGP1:~$ sudo apt update [sudo] password for seiji: Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]  省略 Get:38 http://archive.ubuntu.com/ubuntu jammy-backports/multiverse amd64 c-n-f Metadata [116 B] Fetched 28.8 MB in 10s (2891 kB/s)
Reading package lists… Done Building dependency tree… Done
Reading state information… Done 41 packages can be upgraded. Run 'apt list --upgradable' to see them. seiji@WIN-L6ELGAOOGP1:~$ sudo apt upgrade Reading package lists… Done
Building dependency tree… Done Reading state information… Done
Calculating upgrade… Done The following packages have been kept back: python3-update-manager update-manager-core The following packages will be upgraded: binutils binutils-common binutils-x86-64-linux-gnu curl distro-info distro-info-data irqbalance libbinutils libc-bin libc6 libcryptsetup12 libctf-nobfd0 libctf0 libcurl3-gnutls libcurl4 libperl5.34 libpython3.10 libpython3.10-minimal libpython3.10-stdlib libsqlite3-0 libssh-4 locales openssh-client perl perl-base perl-modules-5.34 python3-cryptography python3-distro-info python3-software-properties python3.10 python3.10-minimal software-properties-common systemd-hwe-hwdb tar vim vim-common vim-runtime vim-tiny xxd 39 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. 31 standard LTS security updates
Need to get 41.5 MB of archives. After this operation, 20.5 kB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libperl5.34 amd64 5.34.0-3ubuntu1.3 [4820 kB]  省略 Get:39 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 systemd-hwe-hwdb all 249.11.4 [2978 B] Fetched 41.5 MB in 13s (3179 kB/s)
Extracting templates from packages: 100%  省略 Processing triggers for man-db (2.10.2-1) …
seiji@WIN-L6ELGAOOGP1:~$ wn Command 'wn' not found, but can be installed with: sudo apt install wordnet seiji@WIN-L6ELGAOOGP1:~$ sudo apt install wordnet Reading package lists… Done
省略
Need to get 10.3 MB of archives. After this operation, 41.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 fonts-dejavu-core all 2.37-2build1 [1041 kB] 省略 Setting up wordnet-gui (1:3.0-37) … Processing triggers for man-db (2.10.2-1) … Processing triggers for libc-bin (2.35-0ubuntu3.5) … seiji@WIN-L6ELGAOOGP1:~$ wn usage: wn word [-hgla] [-n#] -searchtype [-searchtype…] wn [-l] -h Display help text before search output -g Display gloss -l Display license and copyright notice -a Display lexicographer file information -o Display synset offset -s Display sense numbers in synsets -n# Search only sense number # searchtype is at least one of the following: -ants{n|v|a|r} Antonyms -hype{n|v} Hypernyms -hypo{n|v}, -tree{n|v} Hyponyms & Hyponym Tree -entav Verb Entailment -syns{n|v|a|r} Synonyms (ordered by estimated frequency) -smemn Member of Holonyms -ssubn Substance of Holonyms -sprtn Part of Holonyms -membn Has Member Meronyms -subsn Has Substance Meronyms -partn Has Part Meronyms -meron All Meronyms -holon All Holonyms -causv Cause to -pert{a|r} Pertainyms -attr{n|a} Attributes -deri{n|v} Derived Forms -domn{n|v|a|r} Domain -domt{n|v|a|r} Domain Terms -faml{n|v|a|r} Familiarity & Polysemy Count -framv Verb Frames -coor{n|v} Coordinate Terms (sisters) -simsv Synonyms (grouped by similarity of meaning) -hmern Hierarchical Meronyms -hholn Hierarchical Holonyms -grep{n|v|a|r} List of Compound Words -over Overview of Senses seiji@WIN-L6ELGAOOGP1:~$ wnb seiji@WIN-L6ELGAOOGP1:~$

以下は wnb としたときの画面表示です。このように ubuntu/WSL のコマンドからWindows上で WordNet 3.0 が使えることが分かります。

WordNet の使い方は、このあとおいおい紹介していきます。