<commit_before>with
     ada.Characters.latin_1,
     ada.Strings.unbounded,
     ada.Text_IO;


package body lace.Text.forge
is
   --------
   -- Files
   --

   function to_String (Filename : in forge.Filename) return String
   is
      use ada.Strings.unbounded,
          ada.Text_IO;

      the_File : ada.Text_IO.File_type;
      Pad      : unbounded_String;
   begin
      open (the_File, in_File, String (Filename));

      while not end_of_File (the_File)
      loop
         declare
            use ada.Characters;
            Line : constant String := get_Line (the_File);
         begin
            append (Pad, Line & latin_1.LF);
         end;
      end loop;

      close (the_File);

      return to_String (Pad);
   end to_String;



   function to_Text (Filename : in forge.Filename) return Item
   is
   begin
      return to_Text (to_String (Filename));
   end to_Text;



   procedure store (Filename : in forge.Filename;   the_String : in String)
   is
      use ada.Text_IO;

      File : File_type;
   begin
      create (File, out_File, String (Filename));
      put    (File, the_String);<commit_msg>lace.text.forge: Rid <CR> in line terminators.<commit_after>with
     ada.Characters.latin_1,
     ada.Directories,
     ada.Direct_IO,
     ada.Text_IO;


package body lace.Text.forge
is
   --------
   -- Files
   --

   function to_String (Filename : in forge.Filename) return String
   is
      use ada.Characters,
          ada.Directories;

      Length : constant Natural := Natural (Size (String (Filename)));

      subtype sized_String is String (1 .. Length);

      package my_IO is new ada.Direct_IO (sized_String);
      use my_IO;

      the_File : my_IO.File_type;
      Pad      : sized_String;
      Result   : sized_String;
      i        : Natural := 0;
   begin
      open  (the_File, in_File, String (Filename));
      read  (the_File, Pad);
      close (the_File);

      for Each of Pad
      loop
         if Each /= latin_1.CR
         then
            i          := i + 1;
            Result (i) := Each;
         end if;
      end loop;

      return Result (1 .. i);
   end to_String;



   function to_Text (Filename : in forge.Filename) return Item
   is
   begin
      return to_Text (to_String (Filename));
   end to_Text;



   procedure store (Filename : in forge.Filename;   the_String : in String)
   is
      use ada.Text_IO;

      File : File_type;
   begin
      create (File, out_File, String (Filename));
      put    (File, the_String);
{'fraction_non_alphanumeric': 0.09540918163672654, 'fraction_numerical': 0.0031936127744510976, 'mean_word_length': 1.9275700934579438, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2390536', 'n_tokens_mistral': 835, 'n_tokens_neox': 781, 'n_words': 223}