treeChange.ml 880 Bytes
open Xstd
open PreTypes

let remove_interps paths tokens =
  let paths_ls = Array.to_list paths in
    Array.iter (fun (id,super,label) ->
      if ((ExtArray.get tokens id).orth = "," ||
          (ExtArray.get tokens id).orth = "." ||
          (ExtArray.get tokens id).orth = "-") &&
        not (List.exists (fun (_,super,_) -> super = id) paths_ls)
        then paths.(id) <- (0,-1,"")) paths; paths

let move_comp paths tokens =
  let correct_dep (id,super,label) =
    let is_comp = function
        Lemma(_,"comp",_) -> true
      |  _ -> false in
    if ((ExtArray.get tokens id).orth = "by" || (ExtArray.get tokens id).orth = "że")
        && is_comp (ExtArray.get tokens id).token
      then (let id_S, super_S, label_S = paths.(super) in
        paths.(id) <- (id,super_S,label);
        paths.(super) <- (id_S, id, label_S)) in
  Array.iter correct_dep paths; paths