839
840
841
842
843
844
845
846
|
begin
return Scored_Word'
(Size => Word'Length,
Word => Word,
Score => Score_Value (Word_Maps.Element (Cursor)) * Word'Length);
end To_Scored_Word;
end Natools.Smaz.Tools;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
|
begin
return Scored_Word'
(Size => Word'Length,
Word => Word,
Score => Score_Value (Word_Maps.Element (Cursor)) * Word'Length);
end To_Scored_Word;
function Worst_Index
(Dict : in Dictionary;
Counts : in Dictionary_Counts;
Method : in Methods.Enum)
return Ada.Streams.Stream_Element
is
Result : Ada.Streams.Stream_Element := 0;
Worst_Score : Score_Value := Score_Encoded (Dict, Counts, 0);
S : Score_Value;
begin
for I in 1 .. Dict.Dict_Last loop
S := Score (Dict, Counts, I, Method);
if S < Worst_Score then
Result := I;
Worst_Score := S;
end if;
end loop;
return Result;
end Worst_Index;
end Natools.Smaz.Tools;
|