Index: src/natools-smaz-tools.adb ================================================================== --- src/natools-smaz-tools.adb +++ src/natools-smaz-tools.adb @@ -798,10 +798,38 @@ end loop; return Result; end Simple_Dictionary; + + procedure Simple_Dictionary_And_Pending + (Counter : in Word_Counter; + Word_Count : in Natural; + Selected : out String_Lists.List; + Pending : out String_Lists.List) + is + use type Ada.Containers.Count_Type; + Target_Count : constant Ada.Containers.Count_Type + := Ada.Containers.Count_Type (Word_Count); + Set : Scored_Word_Sets.Set; + begin + for Cursor in Word_Maps.Iterate (Counter.Map) loop + Scored_Word_Sets.Insert (Set, To_Scored_Word (Cursor)); + end loop; + + Selected := String_Lists.Empty_List; + Pending := String_Lists.Empty_List; + + for Cursor in Scored_Word_Sets.Iterate (Set) loop + if String_Lists.Length (Selected) < Target_Count then + Selected.Append (Scored_Word_Sets.Element (Cursor).Word); + else + Pending.Append (Scored_Word_Sets.Element (Cursor).Word); + end if; + end loop; + end Simple_Dictionary_And_Pending; + function To_Scored_Word (Cursor : in Word_Maps.Cursor) return Scored_Word is Word : constant String := Word_Maps.Key (Cursor); Index: src/natools-smaz-tools.ads ================================================================== --- src/natools-smaz-tools.ads +++ src/natools-smaz-tools.ads @@ -155,10 +155,19 @@ (Counter : in Word_Counter; Word_Count : in Natural) return String_Lists.List; -- Return the Word_Count words in Counter that have the highest score, -- the score being count * length. + + procedure Simple_Dictionary_And_Pending + (Counter : in Word_Counter; + Word_Count : in Natural; + Selected : out String_Lists.List; + Pending : out String_Lists.List); + -- Return in Selected the Word_Count words in Counter that have the + -- highest score, and in Pending the remaining words, + -- the score being count * length. type Dictionary_Counts is array (Ada.Streams.Stream_Element) of String_Count; procedure Evaluate_Dictionary