freq_test.ml 429 Bytes

open Xstd

let _ =
  let l = File.load_tab "../resources/NKJP1M/NKJP1M_frequencies.tab" (function
      [orth; lemma; interp; freq] -> orth, lemma, interp, int_of_string freq
    | _ -> failwith "load_frequencies") in
  let qmap = Xlist.fold l StringQMap.empty (fun qmap (orth, lemma, interp, freq) ->
    StringQMap.add_val qmap (lemma ^ "\t" ^ interp) freq) in
  StringQMap.iter qmap (fun k v -> Printf.printf "%d\t%s\n" v k)