主なものとして
- Jaccard係数
- Simpson係数
- コサイン距離
共起尺度、共起頻度の指標は自然言語処理関連でよく使われているらしい。
- 文書中の単語の出現数から文書間の類似性をみるなど
data Cofree f a = a :< (f (Cofree f a)) | |
-- Fix point | |
newtype Mu f = Mu { unMu :: f (Mu f) } | |
extract :: Cofree f a -> a | |
extract (a :< _) = a | |
-- catamorphism | |
cata :: Functor f => (f b -> b) -> Mu f -> b |
Lensについて
自分用のメモという感じ
Lensの定義を見てみよう.
type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t
Lensを作ってみよう. s
がforall f.
の外にあっても問題ないので外に出しておこう. その方が今は都合がいい.
つまりs
t
a
b
はそれぞれなんらかの型として,
// | |
// main.swift | |
// SwiftLine | |
// | |
// Created by ISHII 2bit on 2014/06/03. | |
// Copyright (c) 2014 buffer Renaiss. All rights reserved. | |
// | |
import Foundation |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
. 5 . | . . 1 | 4 7 9 | |
. . 2 | 7 . . | . . 8 | |
. . . | . 4 6 | 2 . . | |
------+-------+------ | |
. 4 6 | . . 9 | 5 3 7 | |
. . . | . 6 . | . . . | |
8 9 3 | 5 . . | 6 4 . | |
------+-------+------ | |
. . 9 | 6 1 . | . . . | |
1 . . | . . 2 | 3 . . |
#! /usr/bin/env python | |
# -*- coding:utf-8 -*- | |
import concurrent.futures | |
import sys | |
import subprocess | |
import time | |
from collections import defaultdict | |
from data import sentences |