Natools

Check-in [25e91595e4]
Login
Overview
Comment:smaz-tools: refactor scoring in To_Scored_Word
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 25e91595e4715affa1a8677650203184162ddc1e
User & Date: nat on 2016-11-19 21:35:33
Other Links: manifest | tags
Context
2016-11-20
20:20
smaz-tools: fix computation of the first score in Worst_Index check-in: 18a2c1690b user: nat tags: trunk
2016-11-19
21:35
smaz-tools: refactor scoring in To_Scored_Word check-in: 25e91595e4 user: nat tags: trunk
2016-11-18
22:43
smaz-tools: add dictionary-independent scoring functions check-in: ebefb3c832 user: nat tags: trunk
Changes

Modified src/natools-smaz-tools.adb from [06e0074235] to [b14093a8af].

836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854

855
856
857
858
859
860
861
836
837
838
839
840
841
842

843






844
845
846

847
848
849
850
851
852
853
854







-

-
-
-
-
-
-



-
+








   function To_Scored_Word
     (Cursor : in Word_Maps.Cursor;
      Method : in Methods.Enum)
     return Scored_Word
   is
      Word : constant String := Word_Maps.Key (Cursor);
      Factor : Score_Value;
   begin
      case Method is
         when Methods.Encoded => Factor := Word'Length;
         when Methods.Frequency => Factor := 1;
         when Methods.Gain => Factor := Word'Length - 1;
      end case;

      return Scored_Word'
        (Size => Word'Length,
         Word => Word,
         Score => Score_Value (Word_Maps.Element (Cursor)) * Factor);
         Score => Score (Word_Maps.Element (Cursor), Word'Length, Method));
   end To_Scored_Word;


   function Worst_Index
     (Dict : in Dictionary;
      Counts : in Dictionary_Counts;
      Method : in Methods.Enum)