struct
(** A (word structured) text is a matrix of strings. *) |
type t = string list list;;
(** A text matrix filter is a function from and to string list lists. *) |
type filter = t -> t ;;
(** Convert a raw text in a matrix of words.
By default the word delimiter is the char d=' '
and squeeze=true .
Example:
*) |
let of_string ?(squeeze=true) ?(d=' ') x =
List.map (split ~squeeze ~d) (of_string x)
;;
(** Convert a matrix of words in a raw text.
By default the word delimiter is the string d=" " .
*) |
let to_string ?(d=" ") m =
to_line (big (merge "\n") (List.map (big (merge d)) m)) ;;
end