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 -*- | |
""" | |
Parse iTunes Library and Generate Word Cloud | |
""" | |
""" | |
Copy "iTunes Music Library.xml" to the same directory as Python script | |
""" | |
import matplotlib.pyplot as plt | |
from lxml import etree | |
from collections import defaultdict |
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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<a:fontScheme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="ヒラギノ角ゴ+Avenir"><a:majorFont><a:latin typeface="Avenir Next"/><a:ea typeface="Hiragino Kaku Gothic ProN W3"/><a:cs typeface=""/></a:majorFont><a:minorFont><a:latin typeface="Avenir Next"/><a:ea typeface="Hiragino Kaku Gothic ProN W3"/><a:cs typeface=""/></a:minorFont></a:fontScheme> |
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 numpy as np | |
def sigmoid(x): | |
return 1./(1.+np.exp(-x)) | |
def sigmoid_deriv(x): | |
return x * (1.0 - 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
# -*- coding: utf-8 -*- | |
""" | |
お手製のニューラルネットワーク | |
トレーニング編 | |
""" | |
import sys | |
import numpy as np | |
from collections import defaultdict | |
def create_features(line, ids): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 -*- | |
""" | |
Chainerを用いた多層パーセプトロンの実装 | |
多分に参考にしました: https://github.com/ichiroex/xor-mlp-chainer | |
""" | |
import sys | |
import numpy as np | |
import chainer | |
from chainer import cuda, Function, gradient_check, Variable, optimizers, serializers, utils | |
from chainer import Link, Chain, ChainList |
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 -*- | |
""" | |
docomoの言語解析API(固有表現抽出)を叩くサンプルコード | |
""" | |
import requests | |
import json | |
BASEURL = "https://api.apigw.smt.docomo.ne.jp/gooLanguageAnalysis/v1/entity?APIKEY=" | |
APIKEY = "YOUR APIKEY" #ここにAPIKEYを入力 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
text = open("00001.dict", encoding="shift-jis").read() | |
tree = etree.fromstring(text.encode("shift-jis")) | |
print(etree.tostring(tree, encoding="utf-8", xml_declaration=True, doctype="<!DOCTYPE gda>").decode("utf8")) |
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 nltk.tree import Tree | |
from nltk.tree import ParentedTree | |
from nltk.tree import ImmutableParentedTree | |
def main(): | |
tree = ImmutableParentedTree.fromstring("(ROOT (S (NP (NNP Dog)) (VP (VBZ likes) (NP (NN cat))) (. .)))") | |
t = tree.leaf_treeposition(1) | |
x = tree.leaf_treeposition(2) |
OlderNewer