Overview
Comment: | tools/smaz: actually implement dictionary optimization |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
fb7d230fe5900baca2b05464b4924ec3 |
User & Date: | nat on 2016-10-29 20:29:20 |
Other Links: | manifest | tags |
Context
2016-10-30
| ||
18:19 | tools/sxcat: add a command-line option to output a list of input atoms check-in: ac88f5abfb user: nat tags: trunk | |
2016-10-29
| ||
20:29 | tools/smaz: actually implement dictionary optimization check-in: fb7d230fe5 user: nat tags: trunk | |
2016-10-28
| ||
20:56 | tools/smaz: refactor scores out of the evaluation block check-in: fbe80ac184 user: nat tags: trunk | |
Changes
Modified tools/smaz.adb from [7214a27560] to [fa5ab81891].
︙ | |||
199 200 201 202 203 204 205 206 207 208 209 210 211 212 | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | + + + + + + | function To_Dictionary (Handler : in Callback'Class; Input : in Natools.Smaz.Tools.String_Lists.List) return Natools.Smaz.Dictionary; -- Convert the input into a dictionary given the option in Handler function Worst_Index (Dict : in Natools.Smaz.Dictionary; Counts : in Natools.Smaz.Tools.Dictionary_Counts) return Ada.Streams.Stream_Element; -- Remove the worstly-scored item from Dict overriding procedure Option (Handler : in out Callback; Id : in Options.Id; Argument : in String) is begin case Id is |
︙ | |||
355 356 357 358 359 360 361 | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | + - - - - + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | Score : in out Ada.Streams.Stream_Element_Count; Counts : in out Natools.Smaz.Tools.Dictionary_Counts; Pending_Words : in out Natools.Smaz.Tools.String_Lists.List; Input_Texts : in Natools.Smaz.Tools.String_Lists.List; Job_Count : in Natural; Updated : out Boolean) is use type Ada.Streams.Stream_Element_Offset; |
︙ | |||
704 705 706 707 708 709 710 711 712 713 714 715 716 717 | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | + + + + + + + + + + + + + + + + + + + + + + + | return Natools.Smaz.Tools.To_Dictionary (Natools.Smaz.Tools.Simple_Dictionary (Counter, 254), True); end if; end; end case; end To_Dictionary; function Worst_Index (Dict : in Natools.Smaz.Dictionary; Counts : in Natools.Smaz.Tools.Dictionary_Counts) 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_Encoded (Dict, Counts, I); if S < Worst_Score then Result := I; Worst_Score := S; end if; end loop; return Result; end Worst_Index; Opt_Config : constant Getopt.Configuration := Getopt_Config; Handler : Callback; Input_List, Input_Data : Natools.Smaz.Tools.String_Lists.List; begin Process_Command_Line : begin |
︙ |