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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "Microsoft/EdgeOnWindows10" | |
config.vm.box_version = "1.0" | |
config.vm.provider "virtualbox" do |vb| | |
# guiの設定 | |
vb.gui = true |
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
from notebook.base.handlers import APIHandler as IPyAPIHandler | |
import json | |
class APIHandler(IPyAPIHandler): | |
def set_default_headers(self): | |
self.set_header('Content-Type', 'application/json') | |
def finish(self, chunk=None): | |
if type(chunk) == dict: |
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 | |
from logging import getLogger, Formatter, StreamHandler | |
import logging | |
def logger( | |
logger_name='', | |
level=logging.DEBUG, | |
Handler=StreamHandler, |
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 chainer | |
import chainer.functions as F | |
from chainer import LinkHook | |
from typing import List, Optional | |
import cv2 | |
class IntermidateCache(LinkHook): | |
def __init__(self, layer: chainer.Chain): | |
layer.add_hook(self) |
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 chainer | |
import chainer.functions as F | |
class Dropout1d(chainer.Chain): | |
''' | |
spatial dropout module (1d) | |
''' | |
def __init__(self, raito=.5): | |
super().__init__() |
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 | |
import chainer | |
import chainer.functions as F | |
import chainer.links as L | |
try: | |
from chainer.backend import get_array_module | |
except: | |
import numpy as np |
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 | |
from io import BytesIO | |
import cv2 | |
from fnmatch import fnmatch | |
from google.cloud.storage import Client, Blob | |
import numpy as np | |
import pandas as pd | |
import os.path | |
from pathlib import Path |
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 MeCab | |
class MeCabGenerator(object): | |
def __init__(self, dict_path='/usr/local/lib/mecab/dic/mecab-ipadic-neologd'): | |
self.mecab = MeCab.Tagger ('-d {}'.format(dict_path)) | |
def parse(self, text): | |
return self._generator_wrapper(text) | |
def get_morphemes(self, text, surface_filter=lambda x: x): |
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 CaboCha | |
class CaboChaGenerator(object): | |
def __init__(self): | |
self.c = CaboCha.Parser() | |
def parse_to_chunk(self, text): | |
tree = self.c.parse(text) | |
for i in range(tree.chunk_size()): | |
chunk = tree.chunk(i) | |
chunk_tokens = [ |
OlderNewer