Natools

Diff
Login

Differences From Artifact [ac8c1a7478]:

To Artifact [301a580fd7]:


583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
         Input_Texts : in String_Lists.List;
         Job_Count : in Natural;
         Method : in Methods;
         Min_Dict_Size : in Positive;
         Max_Dict_Size : in Positive;
         Updated : out Boolean)
      is
         pragma Unreferenced (Max_Dict_Size);
         use type Ada.Streams.Stream_Element_Offset;

         No_Longer_Pending : String_Lists.Cursor;
         Log_Message : Ada.Strings.Unbounded.Unbounded_String;
         Original : constant Dictionary := Dict.Element;
         Worst_Index : constant Dictionary_Entry
           := Worst_Element







<







583
584
585
586
587
588
589

590
591
592
593
594
595
596
         Input_Texts : in String_Lists.List;
         Job_Count : in Natural;
         Method : in Methods;
         Min_Dict_Size : in Positive;
         Max_Dict_Size : in Positive;
         Updated : out Boolean)
      is

         use type Ada.Streams.Stream_Element_Offset;

         No_Longer_Pending : String_Lists.Cursor;
         Log_Message : Ada.Strings.Unbounded.Unbounded_String;
         Original : constant Dictionary := Dict.Element;
         Worst_Index : constant Dictionary_Entry
           := Worst_Element
635
636
637
638
639
640
641





































642
643
644
645
646
647
648
                     & " ("
                     & Ada.Streams.Stream_Element_Offset'Image
                        (Score - Old_Score)
                     & ')');
               end if;
            end;
         end loop;






































         if Length (Base) >= Min_Dict_Size then
            declare
               New_Score : Ada.Streams.Stream_Element_Count;
               New_Counts : Dictionary_Counts;
            begin
               Evaluate_Dictionary







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
                     & " ("
                     & Ada.Streams.Stream_Element_Offset'Image
                        (Score - Old_Score)
                     & ')');
               end if;
            end;
         end loop;

         if Length (Original) < Max_Dict_Size then
            Ada.Text_IO.Put_Line
              (Ada.Text_IO.Current_Error,
               "Condiering adding to dictionary");
            for Position in Pending_Words.Iterate loop
               declare
                  Word : constant String := String_Lists.Element (Position);
                  New_Dict : constant Dictionary
                    := Append_String (Original, Word);
                  New_Score : Ada.Streams.Stream_Element_Count;
                  New_Counts : Dictionary_Counts;
               begin
                  Evaluate_Dictionary
                    (Job_Count, New_Dict, Input_Texts, New_Score, New_Counts);

                  if New_Score < Score then
                     Dict := Holders.To_Holder (New_Dict);
                     Score := New_Score;
                     Counts := New_Counts;
                     No_Longer_Pending := Position;
                     Worst_Removed := False;
                     Updated := True;
                     Log_Message := Ada.Strings.Unbounded.To_Unbounded_String
                       ("Adding"
                        & Counts (Last_Code (New_Dict))'Img & "x "
                        & Natools.String_Escapes.C_Escape_Hex (Word, True)
                        & ", size"
                        & Score'Img
                        & " ("
                        & Ada.Streams.Stream_Element_Offset'Image
                           (Score - Old_Score)
                        & ')');
                  end if;
               end;
            end loop;
         end if;

         if Length (Base) >= Min_Dict_Size then
            declare
               New_Score : Ada.Streams.Stream_Element_Count;
               New_Counts : Dictionary_Counts;
            begin
               Evaluate_Dictionary