This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ベイジアンフィルタのサンプル(Groovyバージョン) | |
* 元ネタ) 機械学習 はじめよう 第3回 ベイジアンフィルタを実装してみよう | |
* http://gihyo.jp/dev/serial/01/machine-learning/0003 | |
* | |
* 分かち書きにはGomokuを利用 | |
* https://github.com/sile/gomoku | |
* gomoku-0.0.4.jarをダウンロードし、~/.groovy/lib か <GROOVY_HOME>/lib にコピーしておく | |
* | |
* 学習ソースとしてWikipediaのテキストをJsoupで取得 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KEYWORD="tamori" && curl -N "http://www.google.com/uds/GimageSearch?q=${KEYWORD}&lang=ja&v=1.0" | python -c 'import sys,json;sys.stdout.writelines([u.get("url").encode("ascii")+"\n" for u in json.loads(sys.stdin.read()).get("responseData").get("results")])' | xargs wget -P "${KEYWORD}" | |
# 日本語対応した | |
KEYWORD="森田" && echo "dict(q='${KEYWORD}', lang='ja',v='1.0')" | python -c 'import sys,json,urllib;sys.stdout.writelines([u.get("url").encode("ascii")+"\n" for u in json.loads(urllib.urlopen("http://www.google.com/uds/GimageSearch?"+urllib.urlencode(eval(sys.stdin.read()))).read()).get("responseData").get("results")])' | xargs wget --no-cache -P "${KEYWORD}" |