#include "choices.h"
#include "structures.h"
#include "tordvars.h"
#include "callcpp.h"
#include "danerror.h"
#include "host.h"
Go to the source code of this file.
#define CHOICEBLOCK 100 |
Cells per block
Definition at line 31 of file choices.cpp.
CHOICES append_choice | ( | CHOICES | ratings, | |
const char * | string, | |||
float | rating, | |||
float | certainty, | |||
INT8 | config | |||
) |
Create a new choice record.
Store the string value in a safe place. Add the new choice record to the list. NB - This is only used by matchers, so permuter is always NO_PERM
Definition at line 48 of file choices.cpp.
References new_choice(), NO_PERM, and push_last().
Referenced by AdaptiveClassifier(), AddLargeSpeckleTo(), call_matcher(), and ConvertMatchesToChoices().
00052 { 00053 A_CHOICE *this_choice; 00054 00055 this_choice = new_choice (string, rating, certainty, config, NO_PERM); 00056 ratings = push_last (ratings, (LIST) this_choice); 00057 return (ratings); 00058 }
Copy a list of choices; there will be two copies in memory.
Definition at line 64 of file choices.cpp.
References class_certainty, class_config, class_permuter, class_probability, class_string, first, iterate_list, new_choice(), NIL, push(), and reverse_d().
Referenced by get_match_by_bounds(), and put_match().
00064 { 00065 CHOICES l; 00066 CHOICES result = NIL; 00067 00068 iterate_list(l, choices) { 00069 result = push (result, 00070 (LIST) new_choice (class_string (first (l)), 00071 class_probability (first (l)), 00072 class_certainty (first (l)), 00073 class_config (first (l)), 00074 class_permuter (first (l)))); 00075 } 00076 return (reverse_d (result)); 00077 }
void free_choice | ( | void * | arg | ) |
Free up the memory taken by one choice rating.
Definition at line 83 of file choices.cpp.
References strfree.
Referenced by append_number_choices(), convert_choice_list(), dawg_permute_and_select(), init_match_table(), number_permute_and_select(), permute_all(), permute_characters(), permute_subword(), and permute_top_choice().
00083 { //LIST choice) 00084 A_CHOICE *this_choice; 00085 LIST choice = (LIST) arg; 00086 00087 this_choice = (A_CHOICE *) choice; 00088 if (this_choice) { 00089 if (this_choice->string) 00090 strfree (this_choice->string); 00091 oldchoice(this_choice); 00092 } 00093 }
A_CHOICE* new_choice | ( | const char * | string, | |
float | rating, | |||
float | certainty, | |||
INT8 | config, | |||
char | permuter | |||
) |
Create a new choice record & store the string value in a safe place.
Definition at line 99 of file choices.cpp.
References choicestruct::certainty, choicestruct::config, choicestruct::permuter, choicestruct::rating, choicestruct::string, and strsave.
Referenced by append_choice(), append_next_choice(), append_number_choices(), check_block_occ(), copy_choices(), number_permute_and_select(), permute_compound_words(), permute_top_choice(), and permute_words().
00103 { 00104 A_CHOICE *this_choice; 00105 00106 this_choice = newchoice (); 00107 this_choice->string = strsave (string); 00108 this_choice->rating = rating; 00109 this_choice->certainty = certainty; 00110 this_choice->config = config; 00111 this_choice->permuter = permuter; 00112 return (this_choice); 00113 }
void print_choices | ( | const char * | label, | |
CHOICES | rating | |||
) |
Print the probability ratings for a particular blob or word.
Definition at line 119 of file choices.cpp.
References best_certainty, best_probability, best_string, CHARS_PER_LINE, cprintf(), FALSE, iterate, NIL, print_bold, show_bold, and TRUE.
Referenced by dawg_permute(), dawg_permute_and_select(), number_permute(), and number_permute_and_select().
00121 { 00122 int first_one = TRUE; 00123 char str[CHARS_PER_LINE]; 00124 int len; 00125 00126 cprintf ("%-20s\n", label); 00127 if (rating == NIL) 00128 cprintf (" No rating "); 00129 00130 iterate(rating) { 00131 00132 if (first_one && show_bold) { 00133 cprintf ("|"); 00134 len = sprintf (str, " %s ", best_string (rating)); 00135 print_bold(str); 00136 while (len++ < 8) 00137 cprintf (" "); 00138 } 00139 else { 00140 cprintf ("| %-7s", best_string (rating)); 00141 } 00142 00143 cprintf ("%5.2lf ", best_probability (rating)); 00144 00145 cprintf ("%5.2lf", best_certainty (rating)); 00146 first_one = FALSE; 00147 } 00148 cprintf ("\n"); 00149 }