2015年12月6日日曜日

Google groupsに登録したメールアドレスの話

私は学校で『学食テレビ』という未知の企画に参加しています。
それがどういった組織なのかは話せば長くなるので今回は割愛しますが、その『学食テレビ』の直近における定例ミーティングで『メーリスを外部サービスでよいので作りましょう』と言われたので、使い勝手がよさそうなGoogle groupsを利用することにしました。

やり方はGoogle公式サイトにも書いてありそうなので、雑に書くと以下のような手順を踏みました。

・Google groupsサイトにアクセスして、グループを作成する。
・グループ名,グループのためのメールアドレスを作成する。
・各種設定を終えた後にメンバーのメールアドレス宛にグループへの招待状を送信することにより、メーリングリスト機能が全員使える。

しかしここで一つの問題に気づきました。
私はあと数ヶ月で学校を卒業するので、すぐにオーナー権限を譲渡できる状態にしなければなりません。
それにはGoogleのアドレス、すなわちドメインが@gmail.comのものを登録しているメンバーでないと譲渡できないよと言われたのです。

そうなんですかー仕方ないなーとボヤきつつ、学食テレビのメンバーに『@gmail.comのドメインで誰か登録しておいてください』と告知しておいたところ、メンバーの一人から『Googleアカウントに他のメールアドレスを紐づけすることで、gmailでなくてもよさそうです』という報告が寄せられました。

そうなのか。
それまで私はその学食テレビグループでgmailのアドレスと、学内アドレスの二つを登録するという、いわば二重登録状態だったのですが、さっそくGoogleアカウントにアドレスを追加してみることにした。

やり方は非常に簡易。

・Googleの個人アカウント情報ページに飛ぶ。
・個人情報とプライバシー設定>個人情報>メール で追加する。
その際に確認メールが届くので,URLを踏むと設定完了。

いそいそとGoogle groupsページに飛ぶと、二重に登録されていた私が一つのアドレスに統合されている。おお。
しかし優先されたのはあとから登録した学内メールではなく、@gmail.comだったので、やはりオーナーだとそちらが優先される仕様なのかもしれません。

Googleのこの統合制度が早くて感動したので、以上Googleさまを讃えるメモでした。

自然言語処理の話・0

この前、この本を買いました。

入門 自然言語処理
Steven Bird
固定リンク: http://www.amazon.co.jp/dp/4873114705 

自然言語処理(NLP:National Language processing)とはなんじゃらほい、と人のために簡単に解説します。
自然言語とは日本語や英語のように我々が日常で使うような、文脈や状況によって使われる単語の意味が変わるような言語です。(対義語に機械言語(マシン語)というものがあります。)
この自然言語をコンピューターに使わせようとするとき、人間からの命令や指示、意見、質問などに対する応答をうまくしていこうという分野が自然言語処理です。

雑な紹介もあとにして、買ったからには色々やりましょう。
この本は入門書としてはとても有名なので、研究室配属をされて与えられた課題の知識が現状で散見している自分にも適していそうです。

ではまず本に書かれていることを実践していくために、環境を構築しなければなりません。
この本ではPythonプログラミング言語とNLTK(自然言語ツールキット) を使うそうです。
Pythonはインストール済みですので、NLTKをインストールします。

手順はhttp://www.nltk.org/にも記載されているので、その通りに行う。

sudo pip install -U nltk
sudo: pip: command not found

えー(´□`)

調べたところ、pipコマンドをインストールする必要があるらしい。

sudo easy_install pip
Searching for pip
Reading http://pypi.python.org/simple/pip/
Best match: pip 7.1.2
Downloading https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz#md5=3823d2343d9f3aaab21cf9c917710196
Processing pip-7.1.2.tar.gz
Running pip-7.1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Q_Y0GH/pip-7.1.2/egg-dist-tmp-LuOZFo
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching 'pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching 'dev-requirements.txt'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
Adding pip 7.1.2 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.6 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Installed /Library/Python/2.6/site-packages/pip-7.1.2-py2.6.egg
Processing dependencies for pip
Finished processing dependencies for pip
 

いくつかファイルが見つからないぞとお怒りですが、pipコマンド自体はインストールできているっぽい。
ではもう一度NLTKをインストールしましょう。

Installing collected packages: nltk
Running setup.py install for nltk
Successfully installed nltk-3.1


はいお疲れさまでした。

ではPythonを起動してさっそくNLTKをインポートさせます。
bookモジュールから全ての項目をロードさせます。数秒ほどかかりました。

python
>>> from nltk.book import *
*** Introductory Examples for the NLTK Book ***
Loading text1, ..., text9 and sent1, ..., sent9
Type the name of the text or sentence to view it.
Type: 'texts()' or 'sents()' to list the materials.
text1: Moby Dick by Herman Melville 1851
text2: Sense and Sensibility by Jane Austen 1811
text3: The Book of Genesis
text4: Inaugural Address Corpus
text5: Chat Corpus
text6: Monty Python and the Holy Grail
text7: Wall Street Journal
text8: Personals Corpus
text9: The Man Who Was Thursday by G . K . Chesterton 1908



うーん気持ちがいい。
ではテキスト検索をやってみる。

>>>textn.concordance("word")

で、テキストnからwordがある周辺文章を表示してくれるそうです。
text7はタイトルから明らかに経済の話みたいなので、n=7, wordにeconomyを入れてみたいと思います。

>>> text7.concordance("economy")
Displaying 25 of 27 matches:
d on South Korea 's export-oriented economy . Exports in October stood at $ 5.2
veloping world . The declaration by Economy Minister Nestor Rapanelli is believ
r reflection that the growth of the economy is leveling off , the government sa
ey indicated that the manufacturing economy contracted in October for the sixth
nomists are n't predicting that the economy is about *-1 to slip into recession
continues *-1 to indicate a slowing economy , it is n't signaling an imminent r
itters about the course of the U.S. economy . INGERSOLL-RAND Co . -LRB- Woodcli
 further evidence of a slowing U.S. economy , and traders note that the market
ndicates an expanding manufacturing economy . But most said 0 the index had no
er in New York . Signs of a slowing economy are increasing pressure *ICH*-2 on
s on prices have moderated . `` The economy is clearly slowing , '' says *T*-1
e stated objective of * slowing the economy to a point where hopefully some dow
said 0 he is `` pleased '' with the economy 's recent performance , and does n'
ountry , indicated that the overall economy remains in a pattern of sluggish gr
 the need for a change in their own economy , '' says 0 *T*-1 Charles Dallara ,
ayouts most robustly only after the economy and corporate profits have been gro
iably , those strong periods in the economy give way to recessionary environmen
wth , reflecting a weakening in the economy and corporate profits . PaineWebber
utions of *-1 jeopardizing Japan 's economy by *-2 raising the salary stakes fo
s have fallen through cracks in the economy into the grim , brutal world of our
t part provided a mixed view of the economy . `` Whether you thought 0 the econ
nomy . `` Whether you thought 0 the economy was growing weak or holding * stead
agement blurred that picture of the economy . In a monthly report prepared * fo
ntry 's recession had ended and the economy was growing again . In his first st
 due to the apparent slowing of the economy . But it *EXP*-1 is n't clear yet w


なるほどね!
テキスト検索に成功したところで短いながら今日は終わります。