言語処理100本ノック 2015
81. 複合語からなる国名への対処
http://www.cl.ecei.tohoku.ac.jp/nlp100/
「英語では,複数の語の連接が意味を成すことがある.例えば,アメリカ合衆国は"United States",イギリスは"United Kingdom"と表現されるが,"United"や"States","Kingdom"という単語だけでは,指し示している概念・実体が曖昧である.そこで,コーパス中に含まれる複合語を認識し,複合語を1語として扱うことで,複合語の意味を推定したい.しかしながら,複合語を正確に認定するのは大変むずかしいので,ここでは複合語からなる国名を認定したい.
インターネット上から国名リストを各自で入手し,80のコーパス中に出現する複合語の国名に関して,スペースをアンダーバーに置換せよ.例えば,"United States"は"United_States","Isle of Man"は"Isle_of_Man"になるはずである.」
素人の言語処理100本ノック:81
https://qiita.com/segavvy/items/216888c3549cea3d8e81
# ./p81.py
Traceback (most recent call last):
File "./p81.py", line 10, in <module>
with open(fname_countries, 'rt') as data_file:
FileNotFoundError: [Errno 2] No such file or directory: 'countries.txt'
# vi countries.txt
:wq
# ./p81.py
# ls -al
total 1655536
drwxr-xr-x 1 root root 4096 Jan 23 15:18 .
drwxr-xr-x 1 root root 4096 Jan 20 02:13 ..
-rw-r--r-- 1 root root 725635680 Jan 23 15:02 corpus80.txt
-rw-r--r-- 1 root root 725635468 Jan 23 15:20 corpus81.txt
-rw-r--r-- 1 root root 0 Jan 23 15:18 countries.txt
-rw-r--r-- 1 root root 221903910 Feb 8 2015 enwiki-20150112-400-r10-105752.txt.bz2
-rw-r--r-- 1 root root 22022468 Mar 11 2015 enwiki-20150112-400-r100-10576.txt.bz2
解決
最後までおよみいただきありがとうございました。
いいね 💚、フォローをお願いします。
Thank you very much for reading to the last sentence.
Please press the like icon 💚 and follow me for your happy life.