package orf

  1. Overview
  2. Docs

Source file feature_vector.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

type feature = int

type 'a t = (feature, 'a) Hashtbl.t

let iter f vec =
  Hashtbl.iter f vec

let zero () =
  Hashtbl.create 11

let get feat vec =
  try Hashtbl.find vec feat
  with Not_found -> 0

let set ft coef vec =
  Hashtbl.replace vec ft coef