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
# -*- coding: utf-8 -*- | |
#定数の定義 | |
MAX_TURN = 60 #最大ターン数 | |
BOARD_SIZE = 8 #盤のサイズ(8*8) | |
EMPTY = 0 #空きマス | |
BLACK = 1 #黒石のマス | |
WHITE = -1 #白石のマス | |
WALL = 2 #番兵(ひっくり返すときに使う) |
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
# -*- coding: utf-8 -*- | |
#定数の定義 | |
MAX_TURN = 60 #最大ターン数 | |
BOARD_SIZE = 8 #盤のサイズ(8*8) | |
EMPTY = 0 #空きマス | |
BLACK = 1 #黒石のマス | |
WHITE = -1 #白石のマス | |
WALL = 2 #番兵(ひっくり返すときに使う) |
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
# -*- coding: utf-8 -*- | |
require "date" | |
require "fileutils" | |
#定数の定義 | |
BOARD_SIZE = 8 #盤のサイズ(8*8) | |
EMPTY = 0 #空きマス | |
BLACK = 1 #黒石のマス | |
WHITE = -1 #白石のマス | |
WALL = 2 #番兵(ひっくり返すときに使う) |
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
require 'natto' | |
require 'csv' | |
# nattoオブジェクトの作成 | |
# node_formatは%f[6]原形, %f[0]形態素 | |
$nm = Natto::MeCab.new(dicdir: "/usr/lib/mecab/dic/mecab-ipadic-neologd", node_format:'%f[6]\t%f[0]\n', unk_format: '%M\t未知語\n',eos_format:"") | |
def mecab(txt) | |
parse = $nm.parse(txt) | |
split = parse.split(/\n/) | |
split.map! do |str| | |
str.split(/\t/) |
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
# coding: utf-8 | |
require 'natto' | |
require 'csv' | |
# 分かち書きで出力 | |
$nm = Natto::MeCab.new(dicdir: "/usr/lib/mecab/dic/mecab-ipadic-neologd", output_format_type: :wakati) | |
def mecab(txt) | |
parse = $nm.parse(txt) | |
parse = "BOS " + parse + "EOS" | |
return parse |
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
require "twitter" | |
#1.で作成したkey,tokenのセット | |
client = Twitter::REST::Client.new do |config| | |
config.consumer_key = 'Consumer Key (API Key)' | |
config.consumer_secret = 'Consumer Secret (API Secret)' | |
config.access_token = 'Access Token' | |
config.access_token_secret = 'Access Token Secret' | |
end | |
# 1.指定ユーザーのツイートを取得する場合 |
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
<template> | |
<div id="wrapper"> | |
<div class="base"> | |
<div id="scaler" class="scaler"> | |
<section class="section section-1" data-z="0"> | |
<img src="../assets/4floor.png" width="100%" class="back"/> | |
</section> | |
<section class="section section-2" data-z="5"> | |
<img src="../assets/4floor.png" width="100%" class="back"/> | |
</section> |
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
import numpy as np | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from sklearn.cluster import KMeans | |
from sklearn.decomposition import PCA | |
import matplotlib.pyplot as plt | |
from scipy.cluster.hierarchy import dendrogram, linkage, fcluster, set_link_color_palette | |
np.set_printoptions(precision=2) | |
docs = np.array([ | |
#形態素毎にスペースで区切られた文書の配列 |
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
require "csv" | |
require 'natto' | |
data = [ | |
#文書の配列 | |
] | |
#tfの計算 | |
def tf(list) | |
word_store = Hash.new(0) #初期値0のハッシュ | |
list.each do |count| #出現回数のカウント |
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
# coding: utf-8 | |
require 'slack' | |
require 'date' | |
require 'httpclient' | |
require 'uri' | |
TOKEN = 'YOUR_TOKEN' | |
Slack.configure do |conf| | |
conf.token = TOKEN |
OlderNewer