Natools

Check-in [bb325e8d12]
Login
Overview
Comment:tools/smaz: implement forced words for unoptimized dictionary generation
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bb325e8d12b0ab78a9e06f5a6b09b35ca0982f50
User & Date: nat on 2017-05-14 20:16:29
Other Links: manifest | tags
Context
2017-05-15
21:34
smaz_generic-tools: new version of Worst_Index limited to a range check-in: 579aa9f314 user: nat tags: trunk
2017-05-14
20:16
tools/smaz: implement forced words for unoptimized dictionary generation check-in: bb325e8d12 user: nat tags: trunk
2017-05-13
20:47
tools/smaz: refactor word count construction check-in: b2dbec1810 user: nat tags: trunk
Changes

Modified tools/smaz.adb from [d59b535a0b] to [c932ff0009].

1103
1104
1105
1106
1107
1108
1109


1110
1111
1112
1113
1114
1115





















1116
1117
1118
1119
1120
1121
1122
1103
1104
1105
1106
1107
1108
1109
1110
1111






1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139







+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







                     Pending,
                     Input,
                     Handler.Job_Count,
                     Method);
               end;

            when Dict_Sources.Unoptimized_Text_List =>
               declare
                  Needed : constant Integer
               return To_Dictionary
                 (Simple_Dictionary
                    (Make_Word_Counter (Handler, Input),
                     Handler.Dict_Size,
                     Method),
                  Handler.Vlen_Verbatim);
                    := Handler.Dict_Size
                     - Natural (Handler.Forced_Words.Length);
                  All_Words : String_Lists.List;
               begin
                  if Needed > 0 then
                     All_Words := Simple_Dictionary
                       (Make_Word_Counter (Handler, Input), Needed, Method);

                     for Word of reverse Handler.Forced_Words loop
                        All_Words.Prepend (Word);
                     end loop;
                  else
                     for Word of reverse Handler.Forced_Words loop
                        All_Words.Prepend (Word);
                        exit when Positive (All_Words.Length)
                          >= Handler.Dict_Size;
                     end loop;
                  end if;

                  return To_Dictionary (All_Words, Handler.Vlen_Verbatim);
               end;
         end case;
      end To_Dictionary;

   end Dictionary_Subprograms;